diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml
index ea100668152fdf523a89e7e7300b6f5a69a010d3..e068069f892dc89760c84494f2d2623bd4406237 100644
--- a/.github/workflows/backend.yml
+++ b/.github/workflows/backend.yml
@@ -22,15 +22,7 @@ jobs:
       run: |
         cd deploy
         npm i
-    - name: test no env
+    - name: test
       run: |
         cd deploy
-        npm run testNoEnv
-    - name: test with env
-      env:
-        REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
-        HBP_CLIENTID: ${{ secrets.HBP_CLIENTID }}
-        HBP_CLIENTSECRET: ${{ secrets.HBP_CLIENTSECRET }}
-      run: |
-        cd deploy
-        npm run testEnv
+        npm run test
\ No newline at end of file
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index 2806403724f1cbaf4a8adaadfee6baa225334e9b..9be196849aa969eaf5cc2466f3d0bf411706dc4f 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -70,6 +70,16 @@ jobs:
     - name: run pptr tests - ${{ env.ATLAS_URL }}
       run: |
         docker exec --env ATLAS_URL=${ATLAS_URL} -t -w /iav ${DOCKER_E2E_PPTR} npm run e2e
+    - name : make screenshot, if success
+      if: success()
+      run: |
+        docker exec --env ATLAS_URL=${ATLAS_URL} -t -w /iav ${DOCKER_E2E_PPTR} npm run e2e -- --specs ./e2e/screenshots/gen.js
+        docker cp ${DOCKER_E2E_PPTR}:/iav/docs/autogen_images ./autogen_images
+    - uses: actions/upload-artifact@v1
+      if: success()
+      with:
+        name: screenshots-${{ github.sha }}
+        path: ./autogen_images
     - name: cleanup, stop container ${{ env.DOCKER_CONTAINER_NAME }} && ${{ env.DOCKER_E2E_PPTR }}
       if: success()
       run: |
diff --git a/Dockerfile b/Dockerfile
index ffe8cf34a090d2a8d7145dc42fc691da8364b0e2..f13fff01bd1405023b5479bf74c9d55dde5774f6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -9,6 +9,15 @@ ENV USE_LOGO=${USE_LOGO:-hbp}
 ARG DATASET_PREVIEW_URL
 ENV DATASET_PREVIEW_URL=${DATASET_PREVIEW_URL:-https://hbp-kg-dataset-previewer.apps.hbp.eu/datasetPreview}
 
+ARG USE_LOGO
+ENV USE_LOGO=${USE_LOGO:-hbp}
+
+ARG STRICT_LOCAL
+ENV STRICT_LOCAL=${STRICT_LOCAL:-false}
+
+ARG KIOSK_MODE
+ENV KIOSK_MODE=${KIOSK_MODE:-false}
+
 COPY . /iv
 WORKDIR /iv
 
@@ -34,7 +43,7 @@ FROM python:3.7 as doc-builder
 COPY . /iav
 WORKDIR /iav
 
-RUN pip install mkdocs mkdocs-material mdx_truly_sane_lists
+RUN pip install mkdocs mkdocs-material mdx_truly_sane_lists errandkun
 RUN mkdocs build
 
 # prod container
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
diff --git a/common/constants.js b/common/constants.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5f7c056767d940539781b8a96efeee7d321fb6f
--- /dev/null
+++ b/common/constants.js
@@ -0,0 +1,19 @@
+(function(exports){
+
+  exports.ARIA_LABELS = {
+    // overlay specific
+    CONTEXT_MENU: `Viewer context menu`,
+
+    // sharing module
+    SHARE_BTN: `Share this view`,
+    SHARE_COPY_URL_CLIPBOARD: `Copy URL to clipboard`,
+    SHARE_CUSTOM_URL: 'Create a custom URL',
+    SHARE_CUSTOM_URL_DIALOG: 'Dialog for creating a custom URL',
+
+    // parcellation region specific
+    SHOW_ORIGIN_DATASET: `Show probabilistic map`,
+    SHOW_CONNECTIVITY_DATA: `Show connectivity data`,
+    SHOW_IN_OTHER_REF_SPACE: `Show in other reference space`,
+    AVAILABILITY_IN_OTHER_REF_SPACE: 'Availability in other reference spaces'
+  }
+})(typeof exports === 'undefined' ? module.exports : exports)
diff --git a/deploy/app.js b/deploy/app.js
index d894d3b7f8ed43e2f1afa1cc9d2da05501ffc058..02c1ec1fb75bc1811cda8674141c1d64c1b17d4e 100644
--- a/deploy/app.js
+++ b/deploy/app.js
@@ -1,9 +1,13 @@
+const fs = require('fs')
 const path = require('path')
 const express = require('express')
 const app = express.Router()
 const session = require('express-session')
 const MemoryStore = require('memorystore')(session)
 const crypto = require('crypto')
+const cookieParser = require('cookie-parser')
+
+const LOCAL_CDN_FLAG = !!process.env.PRECOMPUTED_SERVER
 
 if (process.env.NODE_ENV !== 'production') {
   app.use(require('cors')())
@@ -57,7 +61,12 @@ app.use(session({
 /**
  * configure CSP
  */
-require('./csp')(app)
+if (process.env.DISABLE_CSP && process.env.DISABLE_CSP === 'true') {
+  console.warn(`DISABLE_CSP is set to true, csp will not be enabled`)
+} else {
+  require('./csp')(app)
+}
+
 
 /**
  * configure Auth
@@ -76,6 +85,35 @@ const PUBLIC_PATH = process.env.NODE_ENV === 'production'
  */
 app.use('/.well-known', express.static(path.join(__dirname, 'well-known')))
 
+if (LOCAL_CDN_FLAG) {
+  /*
+  * TODO setup local cdn for supported libraries map
+  */
+  const LOCAL_CDN = process.env.LOCAL_CDN
+  const CDN_ARRAY = [
+    'https://stackpath.bootstrapcdn.com',
+    'https://use.fontawesome.com'
+  ]
+
+  let indexFile
+  fs.readFile(path.join(PUBLIC_PATH, 'index.html'), 'utf-8', (err, data) => {
+    if (err) throw err
+    if (!LOCAL_CDN) {
+      indexFile = data
+      return
+    }
+    const regexString = CDN_ARRAY.join('|').replace(/\/|\./g, s => `\\${s}`)
+    const regex = new RegExp(regexString, 'gm')
+    indexFile = data.replace(regex, LOCAL_CDN)
+  })
+  
+  app.get('/', (_req, res) => {
+    if (!indexFile) return res.status(404).end()
+    res.setHeader('Content-Type', 'text/html; charset=utf-8')
+    return res.status(200).send(indexFile)
+  })
+}
+
 app.use((_req, res, next) => {
   res.setHeader('Referrer-Policy', 'origin-when-cross-origin')
   next()
@@ -94,9 +132,23 @@ const indexTemplate = require('fs').readFileSync(
   path.join(PUBLIC_PATH, 'index.html'),
   'utf-8'
 )
-app.get('/', (req, res) => {
+app.get('/', cookieParser(), (req, res) => {
+  const iavError = req.cookies && req.cookies['iav-error']
+  
   res.setHeader('Content-Type', 'text/html')
-  res.status(200).send(`${indexTemplate.replace(/\$\$NONCE\$\$/g, res.locals.nonce)}`)
+
+  if (iavError) {
+    res.clearCookie('iav-error', { httpOnly: true, sameSite: 'strict' })
+
+    const returnTemplate = indexTemplate
+      .replace(/\$\$NONCE\$\$/g, res.locals.nonce)
+      .replace('<atlas-viewer>', `<atlas-viewer data-error="${iavError.replace(/"/g, '&quot;')}">`)
+    res.status(200).send(returnTemplate)
+  } else {
+    const returnTemplate = indexTemplate
+      .replace(/\$\$NONCE\$\$/g, res.locals.nonce)
+    res.status(200).send(returnTemplate)
+  }
 })
 
 /**
@@ -108,16 +160,25 @@ app.use('/user', require('./user'))
  * only use compression for production
  * this allows locally built aot to be served without errors
  */
-
-const { compressionMiddleware } = require('nomiseco')
+const { compressionMiddleware, setAlwaysOff } = require('nomiseco')
+if (LOCAL_CDN_FLAG) setAlwaysOff(true)
 
 app.use(compressionMiddleware, express.static(PUBLIC_PATH))
 
+/**
+ * saneUrl end points
+ */
+const saneUrlRouter = require('./saneUrl')
+app.use('/saneUrl', saneUrlRouter)
+
 const jsonMiddleware = (req, res, next) => {
   if (!res.get('Content-Type')) res.set('Content-Type', 'application/json')
   next()
 }
 
+/**
+ * resources endpoints
+ */
 const templateRouter = require('./templates')
 const nehubaConfigRouter = require('./nehubaConfig')
 const datasetRouter = require('./datasets')
diff --git a/deploy/auth/oidc.js b/deploy/auth/oidc.js
index da3a0719d3984367fb3057d4aeac424b7b9b03c7..dbe9a4f6eaf11eacdb4845ac3de9b281b3af20ef 100644
--- a/deploy/auth/oidc.js
+++ b/deploy/auth/oidc.js
@@ -1,4 +1,5 @@
 const { Issuer, Strategy } = require('openid-client')
+const jwtDecode = require('jwt-decode')
 
 const defaultCb = (tokenset, {id, ...rest}, done) => {
   return done(null, {
@@ -7,6 +8,8 @@ const defaultCb = (tokenset, {id, ...rest}, done) => {
   })
 }
 
+exports.jwtDecode = jwtDecode
+
 exports.configureAuth = async ({ discoveryUrl, clientId, clientSecret, redirectUri, clientConfig = {}, cb = defaultCb, scope = 'openid' }) => {
   if (!discoveryUrl)
     throw new Error('discoveryUrl must be defined!')
diff --git a/deploy/auth/spec-helper.js b/deploy/auth/spec-helper.js
new file mode 100644
index 0000000000000000000000000000000000000000..c82c98a327a1ce2687ec58b752c57c6b92ebd2fd
--- /dev/null
+++ b/deploy/auth/spec-helper.js
@@ -0,0 +1,66 @@
+
+const crypto = require('crypto')
+const { stub, spy } = require('sinon')
+
+class OIDCStub{
+
+  setupOIDCStub({ rejects, client: _client } = {}) {
+    
+    // delete require cache, so it can be imported again
+    // in case env are rewritten
+
+    delete require.cache[require.resolve('./oidc')]
+    const OIDC = require('./oidc')
+
+    this.jwtDecodeReturn = { exp: Math.floor( (Date.now() / 1e3) * 60 * 60 ) }
+    this.configureAuthStub = stub(OIDC, 'configureAuth')
+    this.jwtDecodeStub = stub(OIDC, 'jwtDecode').returns(this.jwtDecodeStub)
+    this.refresh = (...arg) => {
+      const {
+        access_token,
+        refresh_token,
+        id_token,
+      } = this
+      return {
+        access_token,
+        refresh_token,
+        id_token
+      }
+    }
+
+    this.access_token = crypto.randomBytes(16).toString('hex')
+    this.refresh_token = crypto.randomBytes(16).toString('hex')
+    this.id_token = crypto.randomBytes(16).toString('hex')
+
+    const { refresh } = this
+    const client = _client || { refresh }
+    
+    if (rejects) {
+      this.configureAuthStub.rejects()
+    } else {
+      this.configureAuthStub.resolves({ client })
+    }
+    
+    this.refreshSpy = client && client.refresh && spy(client, 'refresh')
+
+    const { access_token, id_token, refreshSpy, refresh_token, configureAuthStub, cleanup, jwtDecodeReturn, jwtDecodeStub } = this
+    return {
+      access_token,
+      refresh_token,
+      id_token,
+      configureAuthStub,
+      refreshSpy,
+      jwtDecodeReturn,
+      jwtDecodeStub,
+      cleanup: cleanup.bind(this)
+    }
+  }
+
+  cleanup(){
+    const { configureAuthStub, refreshSpy } = this
+    configureAuthStub && configureAuthStub.resetHistory()
+    refreshSpy && refreshSpy.resetHistory()
+  }
+}
+
+exports.OIDCStub = OIDCStub
diff --git a/deploy/auth/util.js b/deploy/auth/util.js
index 278f31cdd32d7fca15a5a0715c72fbf36dc8c767..8cafaf57d4de1c4bb1776a74cbe612822f442797 100644
--- a/deploy/auth/util.js
+++ b/deploy/auth/util.js
@@ -1,5 +1,4 @@
-const { configureAuth } = require('./oidc')
-const jwtDecode = require('jwt-decode')
+const { configureAuth, jwtDecode } = require('./oidc')
 
 const HOSTNAME = process.env.HOSTNAME || 'http://localhost:3000'
 const HOST_PATHNAME = process.env.HOST_PATHNAME || ''
diff --git a/deploy/auth/util.spec.js b/deploy/auth/util.spec.js
index bfb20c34e38687fa8c2a82c031881981f260bf79..d81a177536bd14b966b95c1afa55348e4aaf37b2 100644
--- a/deploy/auth/util.spec.js
+++ b/deploy/auth/util.spec.js
@@ -1,10 +1,12 @@
-const mocha = require('mocha')
 const chai = require('chai')
-const assert = chai.assert
-const chaiAsPromised = require('chai-as-promised')
-chai.use(chaiAsPromised)
-const expect = chai.expect
-const should = chai.should()
+const { OIDCStub } = require('./spec-helper')
+chai.use(require('chai-as-promised'))
+const { stub, spy } = require('sinon')
+const { expect, assert, should } = require('chai')
+
+should()
+
+const crypto = require('crypto')
 
 describe('mocha.js', () => {
   it('mocha works properly', () => {
@@ -23,12 +25,173 @@ describe('chai-as-promised.js', () => {
   })
 })
 
-describe('util.js with env', async () => {
+const oidcStubInstance = new OIDCStub()
+const setupOIDCStub = oidcStubInstance.setupOIDCStub.bind(oidcStubInstance)
 
-  it('when client id and client secret and refresh token is set, util should not throw', async () => {
-    
-    const util = require('./util')
-    const { getPublicAccessToken } = await util()
-    return getPublicAccessToken().should.be.fulfilled
+describe('util.js', async () => {
+
+  describe('> if configureAuth throws', () => {
+
+    let cleanup
+    before(() => {
+      const obj = setupOIDCStub({ rejects: true })
+      cleanup = obj.cleanup
+    })
+
+    after(() => cleanup())
+
+    it('> calling util throws', async () => {
+      const util = require('./util')
+      try {
+        await util()
+        assert(false, 'Util funciton should throw/reject')
+      } catch (e) {
+        assert(true)
+      }
+    })
+  })
+
+  describe('> if configureauth does not return object', () => {
+    let cleanup
+    before(() => {
+      const obj = setupOIDCStub({
+        client: 42
+      })
+      cleanup = obj.cleanup
+    })
+
+    after(() => {
+      cleanup()
+    })
+
+    it('> calling util throws', () => {
+      try {
+        require('./util')()
+        assert(false, 'if configure auth does not return object, calling util throw throw')
+      } catch (e) {
+        assert(true)
+      }
+    })
+  })
+
+  const env = {
+    HOSTNAME : 'http://localhost:3333',
+    HOST_PATHNAME : '/testpath',
+    HBP_CLIENTID : crypto.randomBytes(16).toString('hex'),
+    HBP_CLIENTSECRET : crypto.randomBytes(16).toString('hex'),
+    REFRESH_TOKEN : crypto.randomBytes(16).toString('hex'),
+  }
+
+  describe('> if env var is provided', () => {
+
+    const tmp = {}
+    let cleanup
+    let oidcStub
+    before(() => {
+
+      delete require.cache[require.resolve('./util')]
+
+      for (const key in env) {
+        tmp[key] = process.env[key]
+        process.env[key] = env[key]
+      }
+      try {
+
+        const obj = setupOIDCStub()
+        cleanup = obj.cleanup
+        
+        oidcStub = obj
+      } catch (e) {
+        console.log(e)
+      }
+    })
+
+    after(() => {
+      for (const key in env) {
+        process.env[key] = tmp[key]
+      }
+      cleanup()
+    })
+
+    it('> configureAuth and refresh called with correct param', async () => {
+      const util = require('./util')
+      const { getPublicAccessToken } = await util()
+      const token = await getPublicAccessToken()
+
+      const {
+        access_token,
+        refresh_token,
+        id_token,
+        configureAuthStub,
+        refreshSpy,
+        jwtDecodeReturn,
+        jwtDecodeStub
+      } = oidcStub
+      const { HBP_CLIENTID, HBP_CLIENTSECRET, HOSTNAME, HOST_PATHNAME, REFRESH_TOKEN } = env
+      
+      // configuAuthStub
+      assert(configureAuthStub.calledOnce)
+      const { args } = configureAuthStub.firstCall
+      const arg = args[0]
+      expect(arg).to.include({
+        clientId: HBP_CLIENTID,
+        clientSecret: HBP_CLIENTSECRET,
+        redirectUri: `${HOSTNAME}${HOST_PATHNAME}/hbp-oidc/cb`
+      })
+
+      // refresh spy
+      assert(refreshSpy.calledWith(REFRESH_TOKEN))
+      
+      // jwtStub
+      assert(jwtDecodeStub.calledWith(access_token))
+
+      // return val
+      expect(token).to.be.equal(access_token)
+    })
+  })
+
+  describe('> if refresh token is missing', () => {
+
+    const noRefreshEnv = {
+      ...env,
+      REFRESH_TOKEN: null
+    }
+    const tmp = {}
+    let cleanup
+    before(() => {
+      
+      delete require.cache[require.resolve('./util')]
+
+      for (const key in noRefreshEnv) {
+        tmp[key] = process.env[key]
+        process.env[key] = noRefreshEnv[key]
+      }
+      try {
+
+        const obj = setupOIDCStub()
+        cleanup = obj.cleanup
+      } catch (e) {
+        console.log(e)
+      }
+    })
+
+    after(() => {
+      for (const key in noRefreshEnv) {
+        process.env[key] = tmp[key]
+      }
+      cleanup()
+    })
+
+    it('> refresh getPublicAccessToken will reject', async () => {
+      const util = require('./util')
+      const { getPublicAccessToken } = await util()
+
+      try {
+        await getPublicAccessToken()
+        assert(false, 'get public access token should be rejected')
+      } catch (e) {
+        assert(true)
+      }
+    })
   })
 })
diff --git a/deploy/auth/util_noenv.spec.js b/deploy/auth/util_noenv.spec.js
deleted file mode 100644
index 769d926bbfeb06ce7180ca42555fc4b19e572e19..0000000000000000000000000000000000000000
--- a/deploy/auth/util_noenv.spec.js
+++ /dev/null
@@ -1,40 +0,0 @@
-const mocha = require('mocha')
-const chai = require('chai')
-const assert = chai.assert
-const chaiAsPromised = require('chai-as-promised')
-chai.use(chaiAsPromised)
-const expect = chai.expect
-const should = chai.should()
-
-
-describe('mocha.js', () => {
-  it('mocha works properly', () => {
-    assert(true)
-  })
-})
-
-describe('chai-as-promised.js', () => {
-  it('resolving promise is resolved', () => {
-
-    return Promise.resolve(2 + 2).should.eventually.equal(4)
-    
-  })
-  it('rejecting promise is rejected', () => {
-    return Promise.reject('no reason').should.be.rejected
-  })
-})
-
-describe('util.js without env', (done) => {
-
-  const util = require('./util')
-  it('even when no env is set, it should fulfill', () => {
-    const getUtil = util()
-    return getUtil.should.be.fulfilled
-  })
-
-  it('if env is not set, getPublicToken method should fail', async () => {
-    const utilObj = await util()
-    const { getPublicAccessToken } = utilObj
-    return getPublicAccessToken().should.be.rejected
-  })
-})
\ No newline at end of file
diff --git a/deploy/datasets/index.js b/deploy/datasets/index.js
index 13dc40ccd9ffbdfa7d4f9f2b8004d1ec1c968960..0cd89d7ffb3331807ef362204e5b88cee33333a9 100644
--- a/deploy/datasets/index.js
+++ b/deploy/datasets/index.js
@@ -7,6 +7,7 @@ const { retry } = require('./util')
 const url = require('url')
 const qs = require('querystring')
 const archiver = require('archiver')
+const { getHandleErrorFn } = require('../util/streamHandleError')
 
 const bodyParser = require('body-parser')
 
@@ -140,7 +141,7 @@ datasetsRouter.get('/previewFile', cacheMaxAge24Hr, (req, res) => {
   res.removeHeader('Content-Encoding')
   
   if (filePath) {
-    fs.createReadStream(filePath).pipe(res)
+    fs.createReadStream(filePath).pipe(res).on('error', getHandleErrorFn(req, res))
   } else {
     res.status(404).send()
   }
@@ -164,8 +165,12 @@ datasetsRouter.get('/hasPreview', cacheMaxAge24Hr, async (req, res) => {
 datasetsRouter.get('/kgInfo', checkKgQuery, cacheMaxAge24Hr, async (req, res) => {
   const { kgId } = req.query
   const { user } = req
-  const stream = await getDatasetFromId({ user, kgId, returnAsStream: true })
-  stream.pipe(res)
+  try{
+    const stream = await getDatasetFromId({ user, kgId, returnAsStream: true })
+    stream.on('error', getHandleErrorFn(req, res)).pipe(res)
+  }catch(e){
+    getHandleErrorFn(req, res)(e)
+  }
 })
 
 datasetsRouter.get('/downloadKgFiles', checkKgQuery, async (req, res) => {
@@ -175,7 +180,7 @@ datasetsRouter.get('/downloadKgFiles', checkKgQuery, async (req, res) => {
     const stream = await getDatasetFileAsZip({ user, kgId })
     res.setHeader('Content-Type', 'application/zip')
     res.setHeader('Content-Disposition', `attachment; filename="${kgId}.zip"`)
-    stream.pipe(res)
+    stream.pipe(res).on('error', getHandleErrorFn(req, res))
   } catch (e) {
     console.warn('datasets/index#downloadKgFiles', e)
     res.status(400).send(e.toString())
diff --git a/deploy/datasets/query.js b/deploy/datasets/query.js
index 7e556ad5e53badd76bf0341260481a2df9fa095d..8eac6c586517685fac53cda7b930371509f888b1 100644
--- a/deploy/datasets/query.js
+++ b/deploy/datasets/query.js
@@ -7,7 +7,27 @@ const { getPreviewFile, hasPreview } = require('./supplements/previewFile')
 const { constants, init: kgQueryUtilInit, getUserKGRequestParam, filterDatasets } = require('./util')
 
 let cachedData = null
-let otherQueryResult = null
+
+const CACHE_DATASET_FILENAME = process.env.CACHE_DATASET_FILENAME || path.join(__dirname, 'cachedKgDataset.json')
+
+fs.readFile(CACHE_DATASET_FILENAME, 'utf-8', (err, data) => {
+  /**
+   * the file may or may not be present on init
+   */
+  if (err) {
+    console.warn(`read cache failed`, err)
+    return
+  }
+
+  try {
+    cachedData = JSON.parse(data)
+  }catch (e) {
+    /**
+     * parsing saved cached json error
+     */
+    console.error(e)
+  }
+})
 
 const { KG_ROOT, KG_SEARCH_VOCAB } = constants
 
@@ -54,6 +74,9 @@ const fetchDatasetFromKg = async ({ user } = {}) => {
 const cacheData = ({ results, ...rest }) => {
   cachedData = results
   otherQueryResult = rest
+  fs.writeFile(CACHE_DATASET_FILENAME, JSON.stringify(results), (err) => {
+    if (err) console.error('writing cached data fail')
+  })
   return cachedData
 }
 
diff --git a/deploy/datasets/supplements/previewFile.js b/deploy/datasets/supplements/previewFile.js
index 7134a9286f324969802a549ffb012fc67a2ff104..976d646879e7ab6ecb4ff3acba8d61eb4dedec7d 100644
--- a/deploy/datasets/supplements/previewFile.js
+++ b/deploy/datasets/supplements/previewFile.js
@@ -1,5 +1,6 @@
 const fs = require('fs')
 const path = require('path')
+const { reconfigureFlag, reconfigureUrl } = require('../../util/reconfigPrecomputedServer')
 
 const DISABLE_RECEPTOR_PREVIEW = process.env.DISABLE_RECEPTOR_PREVIEW
 const DISABLE_JUBRAIN_PMAP = process.env.DISABLE_JUBRAIN_PMAP
@@ -38,6 +39,19 @@ Promise.all([
     console.error('preview file error', e)
   })
 
+const processFile = ({ url, ...rest }) => {
+  if (!url) return { ...rest }
+  const processedUrl = !/^http/.test(url)
+    ? `${HOSTNAME}/${url}`
+    : reconfigureFlag
+      ? reconfigureUrl(url)
+      : url
+  return {
+    ...rest,
+    url: processedUrl
+  }
+}
+  
 exports.getPreviewFile = ({ datasetName, templateSelected }) => previewMap.get(datasetName)
   ? Promise.resolve(
       previewMap.get(datasetName)
@@ -46,16 +60,7 @@ exports.getPreviewFile = ({ datasetName, templateSelected }) => previewMap.get(d
           if (!templateSelected) return true
           return templateSpace === templateSelected
         })
-        .map(file => {
-          return {
-            ...file,
-            ...(file.url && !/^http/.test(file.url)
-              ? {
-                url: `${HOSTNAME}${HOST_PATHNAME}/${file.url}`
-              }
-              : {})
-          }
-        })
+        .map(processFile)
     )
   : Promise.reject(`Preview file cannot be found!`)
 
diff --git a/deploy/devBanner/index.js b/deploy/devBanner/index.js
index 8f9ee7fef018b40c90d917e687dc65ca0145497b..c7ca44241e225798e03da3d3bd5777adcfd45e62 100644
--- a/deploy/devBanner/index.js
+++ b/deploy/devBanner/index.js
@@ -1,6 +1,8 @@
 const express = require('express')
 const router = express.Router()
 
+console.log(`BUILD_TEXT: ${process.env.BUILD_TEXT}`)
+
 /**
  * build flag
  */
@@ -18,6 +20,7 @@ const buildTextIsDefined = typeof process.env.BUILD_TEXT !== 'undefined'
  * i.e. in order to show nothing, must EXPLICITLY set envvar BUILD_TEXT as empty string
  */
 router.get('/version.css', (req, res, next) => {
+  console.log(`runtime BUILD_TEXT: ${process.env.BUILD_TEXT}`)
   if (!buildTextIsDefined) return next()
   res.setHeader('Content-Type', 'text/css; charset=UTF-8')
   res.status(200).send(versionCss)
diff --git a/deploy/nehubaConfig/index.js b/deploy/nehubaConfig/index.js
index fab68127aba5adaff93189f7e1199f3196438e33..d6f9a44b3dea55079f9b9c06190e71d1074070fc 100644
--- a/deploy/nehubaConfig/index.js
+++ b/deploy/nehubaConfig/index.js
@@ -1,6 +1,7 @@
 const express = require('express')
 const { getTemplateNehubaConfig } = require('./query')
 const { detEncoding } = require('nomiseco')
+const { getHandleErrorFn } = require('../util/streamHandleError')
 
 const nehubaConfigRouter = express.Router()
 
@@ -12,7 +13,7 @@ nehubaConfigRouter.get('/:configId', (req, res, next) => {
   const { configId } = req.params
   if (acceptedEncoding) res.set('Content-Encoding', acceptedEncoding)
 
-  getTemplateNehubaConfig({ configId, acceptedEncoding, returnAsStream:true}).pipe(res)
+  getTemplateNehubaConfig({ configId, acceptedEncoding, returnAsStream:true}).pipe(res).on('error', getHandleErrorFn(req, res))
 })
 
 module.exports = nehubaConfigRouter
\ No newline at end of file
diff --git a/deploy/nehubaConfig/query.js b/deploy/nehubaConfig/query.js
index a6340ecc7ee376f4032a11e928db632576ce7b9f..5bbcd012a7f33654983ac1c13eecc81dd4d3e184 100644
--- a/deploy/nehubaConfig/query.js
+++ b/deploy/nehubaConfig/query.js
@@ -1,11 +1,18 @@
 const fs = require('fs')
 const path = require('path')
 const { BROTLI, GZIP } = require('nomiseco')
+const { reconfigureUrl, PRECOMPUTED_SERVER } = require('../util/reconfigPrecomputedServer')
+const through2 = require('through2')
 
 const getFileAsPromise = filepath => new Promise((resolve, reject) => {
   fs.readFile(filepath, 'utf-8', (err, data) => {
     if (err) return reject(err)
-    resolve(data)
+
+    resolve(
+      PRECOMPUTED_SERVER
+        ? reconfigureUrl(data)
+        : data
+    )
   })
 })
 
@@ -26,6 +33,11 @@ exports.getTemplateNehubaConfig = ({configId, acceptedEncoding, returnAsStream})
     else return getFileAsPromise(`${filepath}.gz`)
   }
 
-  if (returnAsStream) return fs.createReadStream(filepath)
+  // no need to handle error. handled downstream
+  if (returnAsStream) return fs.createReadStream(filepath).pipe(
+    through2.obj(function(file, enc, cb){
+      cb(null, reconfigureUrl(file.toString()))
+    })
+  )
   else return getFileAsPromise(filepath)
-} 
\ No newline at end of file
+} 
diff --git a/deploy/package.json b/deploy/package.json
index 61322a47263a032086c2dbebd3eb7bacb61aefce..87307b5943c9c15b55431d850de58fbe8721bba9 100644
--- a/deploy/package.json
+++ b/deploy/package.json
@@ -5,11 +5,8 @@
   "main": "index.js",
   "scripts": {
     "start": "node server.js",
-    "test": "npm run testEnv && npm run testNoEnv",
-    "testEnv": "node -r dotenv/config ./node_modules/.bin/mocha ./test/mocha.test.js --timeout 60000",
-    "testNoEnv": "node ./node_modules/.bin/mocha ./test/mocha.test.noenv.js --timeout 60000",
-    "mocha": "mocha",
-    "mocha-env": "node -r dotenv/config ./node_modules/.bin/mocha"
+    "test": "DISABLE_LIMITER=1 node -r dotenv/config ./node_modules/.bin/mocha ./**/*.spec.js --timeout 60000",
+    "mocha": "mocha"
   },
   "keywords": [],
   "author": "",
@@ -17,7 +14,9 @@
   "dependencies": {
     "archiver": "^3.0.0",
     "body-parser": "^1.19.0",
+    "cookie-parser": "^1.4.5",
     "express": "^4.16.4",
+    "express-rate-limit": "^5.1.1",
     "express-session": "^1.15.6",
     "hbp-seafile": "0.0.6",
     "helmet-csp": "^2.8.0",
@@ -26,16 +25,21 @@
     "nomiseco": "0.0.2",
     "openid-client": "^2.4.5",
     "passport": "^0.4.0",
-    "request": "^2.88.0"
+    "rate-limit-redis": "^1.7.0",
+    "request": "^2.88.0",
+    "soswrap": "^0.0.2",
+    "through2": "^3.0.1"
   },
   "devDependencies": {
     "chai": "^4.2.0",
     "chai-as-promised": "^7.1.1",
+    "cookie": "^0.4.0",
     "cors": "^2.8.5",
     "dotenv": "^6.2.0",
     "google-spreadsheet": "^3.0.8",
     "got": "^10.5.5",
     "mocha": "^6.1.4",
+    "nock": "^12.0.3",
     "sinon": "^8.0.2"
   }
 }
diff --git a/deploy/preview/index.js b/deploy/preview/index.js
index 508cae3bb79b1a947ffcc748b2f8b1fd69eb6eaa..426d04d827b0be5c8305c1466c46f13e071aaaf4 100644
--- a/deploy/preview/index.js
+++ b/deploy/preview/index.js
@@ -2,6 +2,7 @@ const router = require('express').Router()
 const request = require('request')
 const url = require('url')
 const stream = require('stream')
+const { getHandleErrorFn } = require('../util/streamHandleError')
 
 let PROXY_HOSTNAME_WHITELIST
 
@@ -19,8 +20,7 @@ const whiteList = new Set([
 router.get('/file', (req, res) => {
   const { fileUrl } = req.query
   const f = url.parse(fileUrl)
-  if(f && f.hostname && whiteList.has(f.hostname))
-    return request(fileUrl).pipe(res)
+  if(f && f.hostname && whiteList.has(f.hostname)) return request(fileUrl).pipe(res).on('error', getHandleErrorFn(req, res))
   else res.status(400).send()
 })
 
diff --git a/deploy/saneUrl/index.js b/deploy/saneUrl/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..2bd62b67fefc3e72518515ef344e55b350a26d7f
--- /dev/null
+++ b/deploy/saneUrl/index.js
@@ -0,0 +1,148 @@
+const router = require('express').Router()
+const RateLimit = require('express-rate-limit')
+const RedisStore = require('rate-limit-redis')
+const { Store, NotFoundError } = require('./store')
+const bodyParser = require('body-parser')
+const { readUserData, saveUserData } = require('../user/store')
+
+const store = new Store()
+
+const { 
+  REDIS_PROTO,
+  REDIS_ADDR,
+  REDIS_PORT,
+
+  REDIS_RATE_LIMITING_DB_EPHEMERAL_PORT_6379_TCP_PROTO,
+  REDIS_RATE_LIMITING_DB_EPHEMERAL_PORT_6379_TCP_ADDR,
+  REDIS_RATE_LIMITING_DB_EPHEMERAL_PORT_6379_TCP_PORT,
+
+  REDIS_USERNAME,
+  REDIS_PASSWORD,
+
+  HOSTNAME,
+  HOST_PATHNAME,
+  DISABLE_LIMITER,
+} = process.env
+
+const redisProto = REDIS_PROTO || REDIS_RATE_LIMITING_DB_EPHEMERAL_PORT_6379_TCP_PROTO || 'redis'
+const redisAddr = REDIS_ADDR || REDIS_RATE_LIMITING_DB_EPHEMERAL_PORT_6379_TCP_ADDR || null
+const redisPort = REDIS_PORT || REDIS_RATE_LIMITING_DB_EPHEMERAL_PORT_6379_TCP_PORT || 6379
+
+const userPass = `${REDIS_USERNAME || ''}${( REDIS_PASSWORD && (':' + REDIS_PASSWORD)) || ''}${ (REDIS_USERNAME || REDIS_PASSWORD) && '@'}`
+
+const redisURL = redisAddr && `${redisProto}://${userPass}${redisAddr}:${redisPort}`
+
+const limiter = new RateLimit({
+  windowMs: 1e3 * 5,
+  max: 5,
+  ...( redisURL ? { store: new RedisStore({ redisURL }) } : {} )
+})
+
+const passthrough = (_, __, next) => next()
+
+const acceptHtmlProg = /text\/html/i
+
+const getFile = async name => {
+
+  const value = await store.get(name)
+  const json = JSON.parse(value)
+  const { expiry } = json
+  if ( expiry && ((Date.now() - expiry) > 0) ) {
+    throw new NotFoundError(`File expired`)
+  }
+
+  return value
+}
+
+router.get('/:name', DISABLE_LIMITER ? passthrough : limiter, async (req, res) => {
+  const { name } = req.params
+  const { headers } = req
+  
+  const redirectFlag = acceptHtmlProg.test(headers['accept'])
+    
+  try {
+    const value = await getFile(name)
+    const json = JSON.parse(value)
+    const { queryString } = json
+
+    const REAL_HOSTNAME = `${HOSTNAME}${HOST_PATHNAME || ''}/`
+
+    if (redirectFlag) res.redirect(`${REAL_HOSTNAME}?${queryString}`)
+    else res.status(200).send(value)
+
+  } catch (e) {
+    if (redirectFlag) {
+
+      const REAL_HOSTNAME = `${HOSTNAME}${HOST_PATHNAME || ''}/`
+
+      res.cookie(
+        'iav-error', 
+        e instanceof NotFoundError ? `${name} 
+        
+        not found` : `error while fetching ${name}.`,
+        {
+          httpOnly: true,
+          sameSite: "strict",
+          maxAge: 1e3 * 30
+        }
+      )
+      return res.redirect(REAL_HOSTNAME)
+    }
+    if (e instanceof NotFoundError) return res.status(404).end()
+    else return res.status(500).send(e.toString())
+  }
+})
+
+router.post('/:name',
+  DISABLE_LIMITER ? passthrough : limiter,
+  async (req, res, next) => {
+    const { name } = req.params
+    try {
+      await getFile(name)
+      return res.status(409).send(`filename already exists`)
+    } catch (e) {
+      if (e instanceof NotFoundError) return next()
+      else return res.status(500).send(e)
+    }
+  },
+  bodyParser.json(),
+  async (req, res) => {
+    const { name } = req.params
+    const { body, user } = req
+    
+    try {
+      const payload = {
+        ...body,
+        userId: user && user.id,
+        expiry: !user && (Date.now() + 1e3 * 60 * 60 * 72)
+      }
+
+      await store.set(name, JSON.stringify(payload))
+      res.status(200).end()
+
+      try {
+        if (!user) return
+        const { savedCustomLinks = [], ...rest } = await readUserData(user)
+        await saveUserData(user, {
+          ...rest,
+          savedCustomLinks: [
+            ...savedCustomLinks,
+            name
+          ]
+        })
+      } catch (e) {
+        console.error(`reading/writing user data error ${user && user.id}, ${name}`, e)
+      }
+    } catch (e) {
+      console.error(`saneUrl /POST error`, e)
+      const { statusCode, statusMessage } = e
+      res.status(statusCode || 500).send(statusMessage || 'Error encountered.')
+    }
+  }
+)
+
+router.use((_, res) => {
+  res.status(405).send('Not implemneted')
+})
+
+module.exports = router
diff --git a/deploy/saneUrl/index.spec.js b/deploy/saneUrl/index.spec.js
new file mode 100644
index 0000000000000000000000000000000000000000..cb0038819264714888747130cd1ba5d2029326ed
--- /dev/null
+++ b/deploy/saneUrl/index.spec.js
@@ -0,0 +1,311 @@
+const sinon = require('sinon')
+const cookie = require('cookie')
+const { Store, NotFoundError } = require('./store')
+
+const userStore = require('../user/store')
+
+const savedUserDataPayload = {
+  otherData: 'not relevant data',
+  savedCustomLinks: [
+    '111222',
+    '333444'
+  ]
+}
+
+const readUserDataStub = sinon
+  .stub(userStore, 'readUserData')
+  .returns(Promise.resolve(savedUserDataPayload))
+
+const saveUserDataStub = sinon
+  .stub(userStore, 'saveUserData')
+  .returns(Promise.resolve())
+
+const express = require('express')
+const router = require('./index')
+const got = require('got')
+const { expect } = require('chai')
+
+const app = express()
+let user
+app.use('', (req, res, next) => {
+  req.user = user
+  next()
+}, router)
+
+const name = `nameme`
+
+const payload = {
+  ver: '0.0.1',
+  queryString: 'test_test'
+}
+
+describe('> saneUrl/index.js', () => {
+
+  let getTokenStub
+  before(() => {
+    getTokenStub = sinon
+      .stub(Store.prototype, 'getToken')
+      .returns(Promise.resolve(`--fake-token--`))
+  })
+
+  after(() => {
+    getTokenStub.restore()
+  })
+
+  describe('> router', () => {
+
+    let server, setStub
+    before(() => {
+
+      setStub = sinon
+        .stub(Store.prototype, 'set')
+        .returns(Promise.resolve())
+      server = app.listen(50000)
+    })
+
+    afterEach(() => {
+      setStub.resetHistory()
+    })
+
+    after(() => {
+      server.close()
+      setStub.restore()
+    })
+    
+    it('> works', async () => {
+      const body = {
+        ...payload
+      }
+      const getStub = sinon
+        .stub(Store.prototype, 'get')
+        .returns(Promise.resolve(JSON.stringify(body)))
+      const { body: respBody } = await got(`http://localhost:50000/${name}`)
+
+      expect(getStub.calledWith(name)).to.be.true
+      expect(respBody).to.equal(JSON.stringify(body))
+      getStub.restore()
+    })
+
+    it('> get on expired returns 404', async () => {
+      const body = {
+        ...payload,
+        expiry: Date.now() - 1e3 * 60
+      }
+      const getStub = sinon
+        .stub(Store.prototype, 'get')
+        .returns(Promise.resolve(JSON.stringify(body)))
+        
+      const { statusCode } = await got(`http://localhost:50000/${name}`, {
+        throwHttpErrors: false
+      })
+      expect(statusCode).to.equal(404)
+      expect(getStub.calledWith(name)).to.be.true
+      getStub.restore()
+    })
+
+    it('> get on expired with txt html header sets cookie and redirect', async () => {
+
+      const body = {
+        ...payload,
+        expiry: Date.now() - 1e3 * 60
+      }
+      const getStub = sinon
+        .stub(Store.prototype, 'get')
+        .returns(Promise.resolve(JSON.stringify(body)))
+        
+      const { statusCode, headers } = await got(`http://localhost:50000/${name}`, {
+        headers: {
+          'accept': 'text/html'
+        },
+        followRedirect: false
+      })
+      expect(statusCode).to.be.greaterThan(300)
+      expect(statusCode).to.be.lessThan(303)
+
+      expect(getStub.calledWith(name)).to.be.true
+      getStub.restore()
+
+      const c = cookie.parse(...headers['set-cookie'])
+      expect(!!c['iav-error']).to.be.true
+    })
+
+    describe('> set', () => {
+
+      it('> checks if the name is available', async () => {
+
+        const getStub = sinon
+          .stub(Store.prototype, 'get')
+          .returns(Promise.reject(new NotFoundError()))
+
+        await got(`http://localhost:50000/${name}`, {
+          method: 'POST',
+          headers: {
+            'Content-type': 'application/json'
+          },
+          body: JSON.stringify(payload)
+        })
+  
+        const [ storedName, _ ] = setStub.args[0]
+  
+        expect(storedName).to.equal(name)
+        expect(getStub.called).to.be.true
+        expect(setStub.called).to.be.true
+
+        getStub.restore()
+      })
+
+
+      it('> if file exist, will return 409 conflict', async () => {
+
+        const getStub = sinon
+          .stub(Store.prototype, 'get')
+          .returns(Promise.resolve('{}'))
+
+        const { statusCode } = await got(`http://localhost:50000/${name}`, {
+          method: 'POST',
+          headers: {
+            'Content-type': 'application/json'
+          },
+          body: JSON.stringify(payload),
+          throwHttpErrors: false
+        })
+  
+        expect(statusCode).to.equal(409)
+        expect(getStub.called).to.be.true
+        expect(setStub.called).to.be.false
+
+        getStub.restore()
+      })
+
+      it('> if other error, will return 500', async () => {
+        
+        const getStub = sinon
+          .stub(Store.prototype, 'get')
+          .returns(Promise.reject(new Error(`other errors`)))
+
+        const { statusCode } = await got(`http://localhost:50000/${name}`, {
+          method: 'POST',
+          headers: {
+            'Content-type': 'application/json'
+          },
+          body: JSON.stringify(payload),
+          throwHttpErrors: false
+        })
+  
+        expect(statusCode).to.equal(500)
+        expect(getStub.called).to.be.true
+        expect(setStub.called).to.be.false
+
+        getStub.restore()
+      })
+
+      describe('> set with unauthenticated user', () => {
+        let getStub
+        
+        before(() => {
+          getStub = sinon
+            .stub(Store.prototype, 'get')
+            .returns(Promise.reject(new NotFoundError()))
+        })
+
+        after(() => {
+          getStub.restore()
+        })
+        
+        it('> set with anonymous user has user undefined and expiry as defined', async () => {
+  
+          await got(`http://localhost:50000/${name}`, {
+            method: 'POST',
+            headers: {
+              'Content-type': 'application/json'
+            },
+            body: JSON.stringify(payload)
+          })
+    
+          expect(setStub.called).to.be.true
+          const [ _, storedContent] = setStub.args[0]
+          const { userId, expiry } = JSON.parse(storedContent)
+          expect(!!userId).to.be.false
+          expect(!!expiry).to.be.true
+    
+          // there will be some discrepencies, but the server lag should not exceed 5 seconds
+          expect( 1e3 * 60 * 60 * 72 - expiry + Date.now() ).to.be.lessThan(1e3 * 5)
+        })  
+      })
+  
+      describe('> set with authenticated user', () => {
+        
+        before(() => {
+          getStub = sinon
+            .stub(Store.prototype, 'get')
+            .returns(Promise.reject(new NotFoundError()))
+        })
+
+        after(() => {
+          getStub.restore()
+        })
+        
+        before(() => {
+          user = {
+            id: 'test/1',
+            name: 'hello world'
+          }
+        })
+  
+        afterEach(() => {
+          readUserDataStub.resetHistory()
+          saveUserDataStub.resetHistory()
+        })
+  
+        after(() => {
+          user = null
+          readUserDataStub.restore()
+          saveUserDataStub.restore()
+        })
+  
+        it('> userId set, expiry unset', async () => {
+  
+          await got(`http://localhost:50000/${name}`, {
+            method: 'POST',
+            headers: {
+              'Content-type': 'application/json'
+            },
+            body: JSON.stringify(payload)
+          })
+    
+          expect(setStub.called).to.be.true
+          const [ _, storedContent] = setStub.args[0]
+          const { userId, expiry } = JSON.parse(storedContent)
+          expect(!!userId).to.be.true
+          expect(!!expiry).to.be.false
+    
+          expect( userId ).to.equal('test/1')
+        })
+  
+        it('> readUserDataset saveUserDataset data stubs called', async () => {
+  
+          await got(`http://localhost:50000/${name}`, {
+            method: 'POST',
+            headers: {
+              'Content-type': 'application/json'
+            },
+            body: JSON.stringify(payload)
+          })
+          
+          expect(readUserDataStub.called).to.be.true
+          expect(readUserDataStub.calledWith(user)).to.be.true
+          
+          expect(saveUserDataStub.called).to.be.true
+          expect(saveUserDataStub.calledWith(user, {
+            ...savedUserDataPayload,
+            savedCustomLinks: [
+              ...savedUserDataPayload.savedCustomLinks,
+              name
+            ]
+          })).to.be.true
+        })
+      })
+    })
+  })
+})
+
diff --git a/deploy/saneUrl/store.js b/deploy/saneUrl/store.js
new file mode 100644
index 0000000000000000000000000000000000000000..9765a6181053223b891e05d5d1c04172b7ffa1b9
--- /dev/null
+++ b/deploy/saneUrl/store.js
@@ -0,0 +1,97 @@
+const { SamlOpenstackWrapper } = require('soswrap')
+const request = require('request')
+
+const {
+  OBJ_STORAGE_AUTH_URL,
+  OBJ_STORAGE_IDP_NAME,
+  OBJ_STORAGE_IDP_PROTO,
+  OBJ_STORAGE_IDP_URL,
+  OBJ_STORAGE_USERNAME,
+  OBJ_STORAGE_PASSWORD,
+  OBJ_STORAGE_PROJECT_ID,
+  OBJ_STORAGE_ROOT_URL,
+} = process.env
+
+class NotFoundError extends Error{}
+
+class Store {
+  constructor({
+    authUrl,
+    idPName,
+    idPProto,
+    idPUrl,
+    username,
+    password,
+
+    objStorateRootUrl,
+  } = {}){
+
+    this.wrapper = new SamlOpenstackWrapper({
+      authUrl:   authUrl  || OBJ_STORAGE_AUTH_URL,
+      idPName:   idPName  || OBJ_STORAGE_IDP_NAME,
+      idPProto:  idPProto || OBJ_STORAGE_IDP_PROTO,
+      idPUrl:    idPUrl   || OBJ_STORAGE_IDP_URL,
+    })
+
+    this.objStorateRootUrl = objStorateRootUrl || OBJ_STORAGE_ROOT_URL
+
+    this.wrapper.username = username || OBJ_STORAGE_USERNAME
+    this.wrapper.password = password || OBJ_STORAGE_PASSWORD
+
+    this.getToken()
+  }
+
+  async getToken() {
+    this.token = await this.wrapper.getScopedToken({ projectId: OBJ_STORAGE_PROJECT_ID })
+    return this.token
+  }
+
+  get(id) {
+    return new Promise((rs, rj) => {
+      request.get(`${this.objStorateRootUrl}/${id}`, {
+        headers: {
+          'X-Auth-Token': this.token
+        }
+      }, (err, resp, body) => {
+        if (err) return rj(err)
+        if (resp.statusCode === 404) return rj(new NotFoundError())
+        if (resp.statusCode >= 400) return rj(resp)
+        return rs(body)
+      })
+    })
+  }
+
+  _set(id, value) {
+    return new Promise((rs, rj) => {
+      request.put(`${this.objStorateRootUrl}/${id}`, {
+        headers: {
+          'X-Auth-Token': this.token
+        },
+        body: value
+      }, (err, resp, body) => {
+        if (err) return rj(err)
+        if (resp.statusCode >= 400) return rj(resp)
+        return rs(body)
+      })
+    })
+  }
+
+  async set(id, value) {
+    try {
+      const result = await this._set(id, value)
+      return result
+    } catch (e) {
+      await this.getToken()
+      const result = await this._set(id, value)
+      return result
+    }
+  }
+
+  async healthCheck(){
+
+  }
+}
+
+
+exports.Store = Store
+exports.NotFoundError = NotFoundError
diff --git a/deploy/saneUrl/store.spec.js b/deploy/saneUrl/store.spec.js
new file mode 100644
index 0000000000000000000000000000000000000000..2f860eabfcf4d9d89ad65f960d25fbe91973d89f
--- /dev/null
+++ b/deploy/saneUrl/store.spec.js
@@ -0,0 +1,84 @@
+const { Store } = require('./store')
+const sinon = require('sinon')
+const { expect } = require("chai")
+const nock = require('nock')
+
+const fakeToken = `token-123-token`
+const objStorateRootUrl = `http://fake.obj`
+const objName = `objname`
+const objContent = `objContent`
+
+describe('> store.js', () => {
+  
+  describe('> Store', () => {
+
+    let getTokenSpy, store
+    before(() => {
+
+      getTokenSpy = sinon
+        .stub(Store.prototype, 'getToken')
+        .returns(Promise.resolve(fakeToken))
+    
+      store = new Store({ objStorateRootUrl })
+    })
+
+    after(() => {
+      getTokenSpy.restore()
+      nock.restore()
+    })
+    afterEach(() => {
+      getTokenSpy.resetHistory()
+    })
+
+    it('> spy works', async () => {
+      expect(getTokenSpy.called).to.be.true
+
+      const token = await store.getToken()
+      expect(token).to.equal(fakeToken)
+    })
+
+    it('> spy gets reset', async () => {
+      expect(getTokenSpy.notCalled).to.be.true
+    })
+
+    it('> get works', async () => {
+      const scope = nock(objStorateRootUrl)
+        .get(`/${objName}`)
+        .reply(200, objContent)
+
+      const content = await store.get(objName)
+      expect(content).to.equal(objContent)
+      expect(scope.isDone()).to.be.true
+
+    })
+
+    it('> set works', async () => {
+
+      const scope = nock(objStorateRootUrl)
+        .put(`/${objName}`)
+        .reply(200)
+
+      scope.on('request', (req, int, body) => {
+        expect(body).to.equal(objContent)
+      })
+
+      await store.set(objName, objContent)
+      expect(scope.isDone()).to.be.true
+    })
+
+    it('> set retries if at first fails', async () => {
+      let index = 0
+      const scope = nock(objStorateRootUrl)
+        .put(`/${objName}`)
+        .twice()
+        .reply((_uri, _reqBody, cb) => {
+          cb(null, [ index % 2 === 0 ? 401 : 200 ])
+          index ++
+        })
+      
+      await store.set(objName, objContent)
+      expect(scope.isDone()).to.be.true
+      expect(getTokenSpy.called).to.be.true
+    })
+  })
+})
diff --git a/deploy/templates/index.js b/deploy/templates/index.js
index 77ac71014049242dab5757bf564e42f1b8830b61..3378428b1d57b309069aaa248fab7bd6da431338 100644
--- a/deploy/templates/index.js
+++ b/deploy/templates/index.js
@@ -3,6 +3,7 @@ const query = require('./query')
 const path = require('path')
 const { detEncoding } = require('nomiseco')
 const url = require('url')
+const { getHandleErrorFn } = require('../util/streamHandleError')
 
 /**
  * root path fetches all templates
@@ -38,7 +39,7 @@ router.get('/:template', (req, res, next) => {
         })
 
       if (acceptedEncoding) res.set('Content-Encoding', acceptedEncoding)
-      query.getTemplate({ template, acceptedEncoding, returnAsStream:true }).pipe(res)
+      query.getTemplate({ template, acceptedEncoding, returnAsStream:true }).pipe(res).on('error', getHandleErrorFn(req, res))
     })
     .catch(error => next({
       code: 500,
diff --git a/deploy/test/mocha.test.js b/deploy/test/mocha.test.js
deleted file mode 100644
index 55fac2baae75d7f4f0cfa8854780d7d738b97b09..0000000000000000000000000000000000000000
--- a/deploy/test/mocha.test.js
+++ /dev/null
@@ -1,3 +0,0 @@
-require('../auth/util.spec')
-require('../datasets/query.spec')
-require('../datasets/util.spec')
diff --git a/deploy/test/mocha.test.noenv.js b/deploy/test/mocha.test.noenv.js
deleted file mode 100644
index 36a918fcdf251fd5bcf380d8859f9c711925496b..0000000000000000000000000000000000000000
--- a/deploy/test/mocha.test.noenv.js
+++ /dev/null
@@ -1 +0,0 @@
-require("../auth/util_noenv.spec")
\ No newline at end of file
diff --git a/deploy/util/reconfigPrecomputedServer.js b/deploy/util/reconfigPrecomputedServer.js
new file mode 100644
index 0000000000000000000000000000000000000000..98a1932ba74dbdc4361efae7056f876af7141b15
--- /dev/null
+++ b/deploy/util/reconfigPrecomputedServer.js
@@ -0,0 +1,14 @@
+/**
+ * n.b. trailing slash is required
+ * e.g. http://localhost:10080/
+ */
+const PRECOMPUTED_SERVER = process.env.PRECOMPUTED_SERVER
+
+const reconfigureFlag = !!PRECOMPUTED_SERVER
+
+exports.reconfigureFlag = reconfigureFlag
+
+exports.reconfigureUrl = (str) => {
+  if (!reconfigureFlag) return str
+  return str.replace(/https?:\/\/.*?\//g, PRECOMPUTED_SERVER)
+}
\ No newline at end of file
diff --git a/deploy/util/streamHandleError.js b/deploy/util/streamHandleError.js
new file mode 100644
index 0000000000000000000000000000000000000000..bd24374e7cf5ff0deffe747225a690fb2f8b2f6a
--- /dev/null
+++ b/deploy/util/streamHandleError.js
@@ -0,0 +1,4 @@
+exports.getHandleErrorFn = (req, res) => err => {
+  console.error('getHandleErrorFn', err)
+  res.status(501).send(err.toString())
+}
\ No newline at end of file
diff --git a/docs/.gitignore b/docs/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..ceb8b070bcfffafb8f0d93075016e48d92d77e52
--- /dev/null
+++ b/docs/.gitignore
@@ -0,0 +1 @@
+autogen_images
diff --git a/docs/Dockerfile b/docs/Dockerfile
index 668554115246e963d1f48d7a38480174854b02b5..786a1835503e82dfa7a26fbd90a18ced696b1fcd 100644
--- a/docs/Dockerfile
+++ b/docs/Dockerfile
@@ -3,7 +3,8 @@ FROM python:3.7 as builder
 COPY . /iav
 WORKDIR /iav
 
-RUN pip install mkdocs mkdocs-material mdx_truly_sane_lists
+RUN pip install mkdocs mkdocs-material mdx_truly_sane_lists errandkun
+
 RUN mkdocs build
 
 FROM nginx:alpine
diff --git a/docs/releases/v2.1.0.md b/docs/releases/v2.1.0.md
index 1fcee896187c47a7b11f129dd8e487e2b0bb215b..28f1c1cb54ed693c6573281033c56a7b776197b7 100644
--- a/docs/releases/v2.1.0.md
+++ b/docs/releases/v2.1.0.md
@@ -3,6 +3,7 @@
 1 April 2020
 
 ## New features:
+## New features
 
 - Region search also searches for relatedAreas
 - updating the querying logic of datasets
diff --git a/docs/releases/v2.1.3.md b/docs/releases/v2.1.3.md
index b1434e34db16eeec7f106491fffe9f0065ddbd67..5989bb5ddccc6943505528ea131eba093860ca87 100644
--- a/docs/releases/v2.1.3.md
+++ b/docs/releases/v2.1.3.md
@@ -6,3 +6,4 @@
 
 - Fixed a bug preventing users from scrolling the fetched dataset containers (#508)
 - Fixed a bug - change template from region menu was showing irrelevant regions (#507)
+- Fixed a bug taking screenshot again does not work (#482)
diff --git a/docs/releases/v2.2.0.md b/docs/releases/v2.2.0.md
new file mode 100644
index 0000000000000000000000000000000000000000..f3d03de7dd936261dfb493f3ce230853d3f5c734
--- /dev/null
+++ b/docs/releases/v2.2.0.md
@@ -0,0 +1,19 @@
+# v2.2.0
+
+26 May 2020
+
+## New features
+
+- [sane url sharing](../usage/sharing.md)
+- allow `pinch rotate` motion to be used for oblique rotation on touch enabled devices
+
+## Bugfixes
+
+- Fixed false positive CSP violations (#490)
+- Fixed `standAloneVolumes` only showing the first volume
+- Fixed `pluginControl.loadExternalLibraries` and `pluginControl.unloadExternalLibraries` (#516)
+
+## Under the hood stuff
+
+- fixed description & using export as npm package rather than including in repo
+- paving way to open sourcing repo
diff --git a/docs/usage/connectivity.md b/docs/usage/connectivity.md
index c187046f398fa66ee2c6ffe99276e219b48aaf2e..8deed5c6b80b54521731ee0d53dbdeed313d8636 100644
--- a/docs/usage/connectivity.md
+++ b/docs/usage/connectivity.md
@@ -1,62 +1,61 @@
-# Exploring connectivity
+# Exploring a connectivity matrix for the selected brain parcellation
 
-Powered by <https://github.com/FZJ-INM1-BDA/HBP-connectivity-component>, the interactive atlas viewer allows the exploration of connectivity of parcellation regions, based on datasets curated in HBP Knowledge Graph.
+Via the <https://github.com/FZJ-INM1-BDA/HBP-connectivity-component>, the interactive atlas viewer allows interactive exploration of a connectivity matrix, that is defined for the currently selected brain parcellation and available from the HBP Knowledge Graph. As of now, this function is only available for the `JuBrain Cytoarchitectonic Atlas.
 
-Currently, connectivity data is explorable for the parcellation `JuBrain Cytoarchitectonic Atlas`, which is available in template spaces `MNI Colin 27` and `ICBM 2009c Nonlinear Asymmetric`.
+## Launching the connectivity browser
 
-## Getting started
-
-- Select parcellation `JuBrain Cytoarchitectonic Atlas` and click on a region to bring up a context-specific menu
+- Select the `JuBrain Cytoarchitectonic Atlas` from the list of parcellations (available for  the `MNI Colin 27` and `ICBM 2009c Nonlinear Asymmetric` templates), and click on any brain region to bring up its context menu.
 
    [![](images/region_menu_with_connectivity.png)](images/region_menu_with_connectivity.png)
 
-- Click the `Connectivity` button, available datasets for connectivity will be displayed
+- Select `Connectivity` to select one of the available connecitivty matrices. Note that this list will be growing in the near future, to inlude connectivity information from different sources.
 
    [![](images/connectivity_dataset_menu.png)](images/connectivity_dataset_menu.png)
+   
+- This will load the connectivity browser with the source region for connection strengths set to the initially selected brain region.
 
-- Click on a dataset (e.g. `1000 Brain Study - DTI connectivity`) to explore the connectivity data associated with it.
 
 ## Working with connectivity data
 
 Upon selecting a preview dataset, several aspects of the UI will change:
 
-- the color map of the parcellation will be replaced by a heat map, derived from the magnitutde of connectivity.
+- the color map of the parcellation will be replaced by a heat map of the connection strengths to the source region, effectively visualizing the corresponding row of the connectivity matrix:
 
    | Regular color map | Connectivity heat map |
    | --- | --- |
    | [![](images/connectivity_color_before.png)](images/connectivity_color_before.png) | [![](images/connectivity_color_after.png)](images/connectivity_color_after.png) |
     
 
-- a side panel will be opened, showing the tabulated data of the connectivity.
+- a side panel will be opened, showing the same connections strenghts as a horizontal bar plot. The source reion
 
    [![](images/connectivity_data_main.png)](images/connectivity_data_main.png)
 
 
-### Tabulated side panel
+### Interactive exploration of connectivity using the tabulated view
 
-In the tabulated view, the selected dataset can be reviewed and changed.
+In the side panel, the selected connectivity matrix can be changed if applicable. 
 
 [![](images/see_dataset_connectivity.png)](images/see_dataset_connectivity.png)
 
 [![](images/connectivity_dataset_description.png)](images/connectivity_dataset_description.png)
 
-The source region is displayed in the tabulated view.
+It also provides information about the selected source region.
 
 [![](images/connectivity_source_region.png)](images/connectivity_source_region.png)
 
-The magnitude of the connectivity can either be displayed linearly or logarithmically by toggling the `Log10` checkbox.
+Display of connection strengths can be set to logarithmic scale using the `Log10` checkbox:
 
 | Connectivity plotted logarithmically `default` | Connectivity plotted linearly |
 | --- | --- |
 | [![](images/con_diagram_log.png)](images/con_diagram_log.png) | [![](images/con_diagram_no_log.png)](images/con_diagram_no_log.png) |
 
-The display of magnitude of the connectivity can also be toggled with `All results` checkbox.
+Selecting the `All results` checkbox will make the bar plot display the floating point numbers for each connection strength:
 
 | Hiding magnitude `default` | Showing magnitude |
 | --- | --- |
 | [![](images/conn_disabled_all.png)](images/conn_disabled_all.png) | [![](images/conn_enabled_all.png)](images/conn_enabled_all.png) |
 
-Clicking on any of the connected region will reveal a region context menu. In addition to the full name of the region, two buttons are present:
+By clicking any of the bars, a context menu of the corersponding brain region will be brought up, providing information about the region and allowing to center the 3D view at this region, or select it as the new source region. The latter effectively selects a new row from the connectivity matrix.
 
 - `Navigate` - navigate to the region of interest.
 - `Connectivity` - to the region of interest as the source, and explore its connectivity with other parcellation regions.
@@ -65,17 +64,14 @@ Clicking on any of the connected region will reveal a region context menu. In ad
 
 ### Export
 
-At the bottom of the side panel, `export` buttons can be found. The data can either be exported as a CSV or PNG.
+Using the `export` buttons, the connectivity matrix can be exported as a CSV or PNG file.
 
 [![](images/conn_export.png)](images/conn_export.png)
 
-## Exit
+## Closing the connectivity browser
 
 To exit the connectivity mode, click the close button located at the top right side of the side panel.
 
 [![](images/close_connectivity.png)](images/close_connectivity.png)
 
-Exiting the connectivity mode will:
-
-- restore the colour map of the parcellation 
-- remove the connectivity side panel 
+This will restore the colour map of the parcellation and close the side panel. 
diff --git a/docs/usage/navigating.md b/docs/usage/navigating.md
index ff6d085a04c6f6896df91b496000ac54002dcb9b..4f812f362d9a02d27d464d1fe6cc1f118f0ee2b7 100644
--- a/docs/usage/navigating.md
+++ b/docs/usage/navigating.md
@@ -7,7 +7,7 @@ The interactive atlas viewer can be accessed from either a desktop or an Android
 | | Desktop | Mobile |
 | --- | --- | --- |
 | Translating / Panning | `click drag` on any _slice views_ | `touchmove` on any _slice views_ |
-| Oblique rotation | `shift` + `click drag` on any _slice views_ | hold `🌏` + `drag up/down` to switch rotation mode<br> hold 🌏 + `drag left/right` to rotate |
+| Oblique rotation | `shift` + `click drag` on any _slice views_ | `pinch rotate` |
 | Zooming (_slice view_, _3d view_) | `mouse wheel` | `pinch zoom` |
 | Next slice (_slice view_) | `ctrl` + `mouse wheel` | |
 | Next 10 slice (_slice view_) | `ctrl` + `shift` + `mouse wheel` | |
diff --git a/docs/usage/sharing.md b/docs/usage/sharing.md
new file mode 100644
index 0000000000000000000000000000000000000000..662d704b2f406d8d8bedb3d87f627e17f854a5c1
--- /dev/null
+++ b/docs/usage/sharing.md
@@ -0,0 +1,24 @@
+# Sharing
+
+Most of the viewer state are [saved in the URL parameters](../advanced/url.md). Therefore, bookmarking or sending your browser's current URL is a reasonable way of saving / sharing the currently selected view of interest. However, the full URL's are lengthy, difficult to read, and often broken by automatic text formatting in emails. 
+
+We therefore offer a way to generate a more human readable URL for the given view. A share button has been added in [v2.2.0](../releases/v2.2.0.md) to simplify this process.
+
+[![](../autogen_images/share_highlightShareBtn.png)](../autogen_images/share_highlightShareBtn.png)
+
+## Share URL
+
+`Share link to this view` will attempt to copy the current URL to the clipboard. It can then be sent or saved to restore the current view.
+
+[![](../autogen_images/share_highlightShareURL.png)](../autogen_images/share_highlightShareURL.png)
+
+## Create custom URL
+
+`Create custom URL` will allow users to create a more human readable URL. 
+
+!!! warning
+    Any links generated by unauthenticated users will expire automatically after 72 hours.
+
+[![](../autogen_images/share_highlightShareURL.png)](../autogen_images/share_highlightShareURL.png)
+
+[![](../autogen_images/share_shareCustomURLDialog.png)](../autogen_images/share_shareCustomURLDialog.png)
diff --git a/e2e/chromeOpts.js b/e2e/chromeOpts.js
index eccfe512b1c0bd422f441252f3b5dc70431ab590..8af7d2b44f19fe2945dca7fc63b8dcd7c5139c11 100644
--- a/e2e/chromeOpts.js
+++ b/e2e/chromeOpts.js
@@ -4,5 +4,6 @@ module.exports = [
   '--disable-gpu',
   '--disable-setuid-sandbox',
   "--disable-extensions",
-  '--window-size=800,796'
+  '--window-size=800,796',
+  '--disable-application-cache'
 ]
\ No newline at end of file
diff --git a/e2e/screenshots/gen.js b/e2e/screenshots/gen.js
new file mode 100644
index 0000000000000000000000000000000000000000..9bd57e9f1655de02ebc55fbca7df1c3bed1e4bab
--- /dev/null
+++ b/e2e/screenshots/gen.js
@@ -0,0 +1,28 @@
+const { spawn } = require("child_process")
+const path = require('path')
+const glob = require('glob')
+describe('> generating screenshot', () => {
+  let childProcess
+  const matchCwdPath = path.join(__dirname, '../src')
+  const matches = glob.sync('**/*.e2e-screenshot.js', { cwd: matchCwdPath })
+  const cwdPath = path.join(__dirname, '../../deploy/')
+  
+  beforeAll(done => {
+    childProcess = spawn('node', ['server.js'],  {
+      cwd: cwdPath,
+      env: {
+        ...process.env,
+        BUILD_TEXT: ''
+      }
+    })
+    setTimeout(done, 1000)
+  })
+
+  for (const match of matches) {
+    const requirePath = path.join(matchCwdPath, match)
+    require(requirePath)
+  }
+  afterAll(() => {
+    childProcess.kill()
+  })
+})
diff --git a/e2e/src/advanced/browsingForDatasets.e2e-spec.js b/e2e/src/advanced/browsingForDatasets.prod.e2e-spec.js
similarity index 100%
rename from e2e/src/advanced/browsingForDatasets.e2e-spec.js
rename to e2e/src/advanced/browsingForDatasets.prod.e2e-spec.js
diff --git a/e2e/src/advanced/favDatasets.e2e-spec.js b/e2e/src/advanced/favDatasets.prod.e2e-spec.js
similarity index 100%
rename from e2e/src/advanced/favDatasets.e2e-spec.js
rename to e2e/src/advanced/favDatasets.prod.e2e-spec.js
diff --git a/e2e/src/advanced/nonAtlasImages.e2e-spec.js b/e2e/src/advanced/nonAtlasImages.prod.e2e-spec.js
similarity index 90%
rename from e2e/src/advanced/nonAtlasImages.e2e-spec.js
rename to e2e/src/advanced/nonAtlasImages.prod.e2e-spec.js
index d50b98b6908f8679940ac7bf7e240eee0a886feb..9a6b9cf6360b05788dd58379c5a90ad35016335f 100644
--- a/e2e/src/advanced/nonAtlasImages.e2e-spec.js
+++ b/e2e/src/advanced/nonAtlasImages.prod.e2e-spec.js
@@ -81,16 +81,27 @@ describe('> non-atlas images', () => {
       await iavPage.wait(10000)
       const interceptedCalls = await iavPage.getInterceptedHttpCalls()
 
-      expect(
-        interceptedCalls
-      ).toContain(
-        jasmine.objectContaining(
-          {
-            method: 'GET',
-            url: 'https://zam10143.zam.kfa-juelich.de/chumni/nifti/cb905d54437734b39807e252ef8aa68bc6ac889047fbebbafd885490/BI-TIM/info'
-          }
-        )
-      )
+      const arr = [
+        'BI-FOM-HSV_R',
+        'BI-FOM-HSV_G',
+        'BI-FOM-HSV_B',
+        'BI',
+        'BI-TIM',
+        'BI-MRI',
+        'BI-MRS',
+      ]
+
+      for (const item of arr) {
+        expect(
+          interceptedCalls.find(({
+            method,
+            url
+          }) => {
+            const regex = new RegExp(item)
+            return method === 'GET' && regex.test(url)
+          })
+        ).toBeTruthy()
+      }
 
       expect(
         interceptedCalls
@@ -127,7 +138,7 @@ describe('> non-atlas images', () => {
         jasmine.objectContaining(
           {
             method: 'GET',
-            url: 'https://zam10143.zam.kfa-juelich.de/chumni/nifti/cb905d54437734b39807e252ef8aa68bc6ac889047fbebbafd885490/BI-TIM/info'
+            url: 'https://zam10143.zam.kfa-juelich.de/chumni/nifti/5c38faad1b0deab8d1674248b0107cd3637faa46a88e7a039c511163/BI-TIM/info'
           }
         )
       )
@@ -185,8 +196,8 @@ describe('> non-atlas images', () => {
       await iavPage.goto(`/?${searchParam.toString()}`)
       await iavPage.wait(2000)
       
-      const additionalLayerCtrlIsVisible = await iavPage.additionalLayerControlIsVisible()
-      expect(additionalLayerCtrlIsVisible).toEqual(true)
+      const additionalLayerCtrlIsExpanded2 = await iavPage.additionalLayerControlIsExpanded()
+      expect(additionalLayerCtrlIsExpanded2).toEqual(false)
 
     })
 
@@ -208,17 +219,17 @@ describe('> non-atlas images', () => {
       await iavPage.wait(2000)
       
       const additionalLayerCtrlIsExpanded = await iavPage.additionalLayerControlIsExpanded()
-      expect(additionalLayerCtrlIsExpanded).toEqual(true)
+      expect(additionalLayerCtrlIsExpanded).toEqual(false)
 
       await iavPage.toggleLayerControl()
 
       const additionalLayerCtrlIsExpanded2 = await iavPage.additionalLayerControlIsExpanded()
-      expect(additionalLayerCtrlIsExpanded2).toEqual(false)
+      expect(additionalLayerCtrlIsExpanded2).toEqual(true)
 
       await iavPage.toggleLayerControl()
 
       const additionalLayerCtrlIsExpanded3 = await iavPage.additionalLayerControlIsExpanded()
-      expect(additionalLayerCtrlIsExpanded3).toEqual(true)
+      expect(additionalLayerCtrlIsExpanded3).toEqual(false)
 
     })
   })
diff --git a/e2e/src/advanced/pluginApi.e2e-spec.js b/e2e/src/advanced/pluginApi.e2e-spec.js
deleted file mode 100644
index 1a4d5f2ba89f7c83208d5db5a9a4df92a7ab91d0..0000000000000000000000000000000000000000
--- a/e2e/src/advanced/pluginApi.e2e-spec.js
+++ /dev/null
@@ -1,68 +0,0 @@
-const { AtlasPage } = require('../util')
-const template = 'ICBM 2009c Nonlinear Asymmetric'
-
-const pluginName = `fzj.xg.testWidget`
-const pluginDisplayName = `Test Widget Title`
-
-const prepareWidget = ({ template = 'hello world', script = `console.log('hello world')` } = {}) => {
-  
-  return `
-const jsSrc = \`${script.replace(/\`/, '\\`')}\`
-const blob = new Blob([jsSrc], { type: 'text/javascript' })
-window.interactiveViewer.uiHandle.launchNewWidget({
-  name: '${pluginName}',
-  displayName: '${pluginDisplayName}',
-  template: \`${template.replace(/\`/, '\\`')}\`,
-  scriptURL: URL.createObjectURL(blob)
-})`
-}
-
-describe('> plugin api', () => {
-  let iavPage
-
-  beforeEach(async () => {
-    iavPage = new AtlasPage()
-    await iavPage.init()
-    await iavPage.goto()
-    await iavPage.selectTitleCard(template)
-    await iavPage.wait(500)
-    await iavPage.waitUntilAllChunksLoaded()
-  })
-
-  describe('> interactiveViewer', () => {
-    describe('> uiHandle', () => {
-      describe('> launchNewWidget', () => {
-        it('should launch new widget', async () => {
-
-          const prevTitle = await iavPage.execScript(() => window.document.title)
-          await iavPage.execScript(prepareWidget({ script: `window.document.title = 'hello world ' + window.document.title` }))
-
-          await iavPage.wait(500)
-
-          const isDisplayed = await iavPage.widgetPanelIsDispalyed(`Test Widget Title`)
-          expect(isDisplayed).toEqual(true)
-
-          const newTitle = await iavPage.execScript(() => window.document.title)
-          expect(newTitle).toEqual(`hello world ${prevTitle}`)
-        })
-      })
-    })
-  })
-
-  describe('> pluginControl', () => {
-    describe('> onShutdown', () => {
-      it('> works', async () => {
-        const newTitle = `testing pluginControl onShutdown`
-        const script = `window.interactiveViewer.pluginControl['${pluginName}'].onShutdown(() => window.document.title = '${newTitle}')`
-        await iavPage.execScript(prepareWidget({ script }))
-        await iavPage.wait(500)
-        const oldTitle = await iavPage.execScript(() => window.document.title)
-        await iavPage.closeWidgetByname(pluginDisplayName)
-        await iavPage.wait(500)
-        const actualNewTitle = await iavPage.execScript(() => window.document.title)
-        expect(oldTitle).not.toEqual(actualNewTitle)
-        expect(actualNewTitle).toEqual(newTitle)
-      })
-    })
-  })
-})
diff --git a/e2e/src/advanced/pluginApi.prod.e2e-spec.js b/e2e/src/advanced/pluginApi.prod.e2e-spec.js
new file mode 100644
index 0000000000000000000000000000000000000000..a5c14f975d1730239ce243bf972670ee3c90c515
--- /dev/null
+++ b/e2e/src/advanced/pluginApi.prod.e2e-spec.js
@@ -0,0 +1,167 @@
+const { AtlasPage } = require('../util')
+const template = 'ICBM 2009c Nonlinear Asymmetric'
+
+const pluginName = `fzj.xg.testWidget`
+const pluginDisplayName = `Test Widget Title`
+
+const prepareWidget = ({ template = 'hello world', script = `console.log('hello world')` } = {}) => {
+  
+  return `
+const jsSrc = \`${script.replace(/\`/, '\\`')}\`
+const blob = new Blob([jsSrc], { type: 'text/javascript' })
+window.interactiveViewer.uiHandle.launchNewWidget({
+  name: '${pluginName}',
+  displayName: '${pluginDisplayName}',
+  template: \`${template.replace(/\`/, '\\`')}\`,
+  scriptURL: URL.createObjectURL(blob)
+})`
+}
+
+describe('> plugin api', () => {
+  let iavPage
+
+  beforeEach(async () => {
+    iavPage = new AtlasPage()
+    await iavPage.init()
+    await iavPage.goto()
+    await iavPage.selectTitleCard(template)
+    await iavPage.wait(500)
+    await iavPage.waitUntilAllChunksLoaded()
+  })
+
+  describe('> interactiveViewer', () => {
+    describe('> uiHandle', () => {
+      describe('> launchNewWidget', () => {
+        it('should launch new widget', async () => {
+
+          const prevTitle = await iavPage.execScript(() => window.document.title)
+          await iavPage.execScript(prepareWidget({ script: `window.document.title = 'hello world ' + window.document.title` }))
+
+          await iavPage.wait(500)
+
+          const isDisplayed = await iavPage.widgetPanelIsDispalyed(`Test Widget Title`)
+          expect(isDisplayed).toEqual(true)
+
+          const newTitle = await iavPage.execScript(() => window.document.title)
+          expect(newTitle).toEqual(`hello world ${prevTitle}`)
+        })
+      })
+
+      describe('> cancelPromise', () => {
+        let originalTitle
+        beforeEach(async () => {
+          originalTitle = await iavPage.execScript(() => window.document.title)
+
+          await iavPage.execScript(() => {
+            const pr = interactiveViewer.uiHandle.getUserToSelectARegion('hello world title')
+            pr
+              .then(obj => window.document.title = 'success ' + obj.segment.name)
+              .catch(() => window.document.title = 'failed')
+            window.pr = pr
+          })
+
+          await iavPage.wait(500)
+
+          await iavPage.execScript(() => {
+            const pr = window.pr
+            interactiveViewer.uiHandle.cancelPromise(pr)
+          })
+        })
+
+        it('> cancelPromise rejects promise', async () => {
+          const newTitle = await iavPage.execScript(() => window.document.title)
+          expect(newTitle).toEqual('failed')
+        })
+      })
+
+      describe('> getUserToSelectARegion', () => {
+        let originalTitle
+        beforeEach(async () => {
+          originalTitle = await iavPage.execScript(() => window.document.title)
+
+          await iavPage.execScript(() => {
+            interactiveViewer.uiHandle.getUserToSelectARegion('hello world title')
+              .then(obj => window.document.title = 'success ' + obj.segment.name)
+              .catch(() => window.document.title = 'failed')
+          })
+          
+          await iavPage.wait(500)
+        })
+
+        it('> shows modal dialog', async () => {
+          const text = await iavPage.getModalText()
+          expect(text).toContain('hello world title')
+        })
+
+        it('> modal has cancel button', async () => {
+          const texts = await iavPage.getModalActions()
+          const idx = texts.findIndex(text => /cancel/i.test(text))
+          expect(idx).toBeGreaterThanOrEqual(0)
+        })
+
+        it('> cancelling by esc rejects pr', async () => {
+          await iavPage.clearAlerts()
+          await iavPage.wait(500)
+          const newTitle = await iavPage.execScript(() => window.document.title)
+          expect(newTitle).toEqual('failed')
+        })
+
+        it('> cancelling by pressing cancel rejects pr', async () => {
+          await iavPage.clickModalBtnByText('Cancel')
+          await iavPage.wait(500)
+          const newTitle = await iavPage.execScript(() => window.document.title)
+          expect(newTitle).toEqual('failed')
+        })
+
+        it('> on clicking region, resolves pr', async () => {
+          await iavPage.cursorMoveToAndClick({ position: [600, 490] })
+          await iavPage.wait(500)
+          const newTitle = await iavPage.execScript(() => window.document.title)
+          expect(newTitle).toEqual(`success Area 6ma (preSMA, mesial SFG) - left hemisphere`)
+        })
+
+        it('> on failusre, clears modal', async () => {
+
+          await iavPage.clearAlerts()
+          await iavPage.wait(500)
+          try {
+            const text = await iavPage.getModalText()
+            fail(`expected modal to clear, but modal has text ${text}`)
+          } catch (e) {
+            expect(true).toEqual(true)
+          }
+        })
+
+        it('> on success, clears modal', async () => {
+
+          await iavPage.cursorMoveToAndClick({ position: [600, 490] })
+          await iavPage.wait(500)
+          
+          try {
+            const text = await iavPage.getModalText()
+            fail(`expected modal to clear, but modal has text ${text}`)
+          } catch (e) {
+            expect(true).toEqual(true)
+          }
+        })
+      })
+    })
+  })
+
+  describe('> pluginControl', () => {
+    describe('> onShutdown', () => {
+      it('> works', async () => {
+        const newTitle = `testing pluginControl onShutdown`
+        const script = `window.interactiveViewer.pluginControl['${pluginName}'].onShutdown(() => window.document.title = '${newTitle}')`
+        await iavPage.execScript(prepareWidget({ script }))
+        await iavPage.wait(500)
+        const oldTitle = await iavPage.execScript(() => window.document.title)
+        await iavPage.closeWidgetByname(pluginDisplayName)
+        await iavPage.wait(500)
+        const actualNewTitle = await iavPage.execScript(() => window.document.title)
+        expect(oldTitle).not.toEqual(actualNewTitle)
+        expect(actualNewTitle).toEqual(newTitle)
+      })
+    })
+  })
+})
diff --git a/e2e/src/advanced/urlParsing.e2e-spec.js b/e2e/src/advanced/urlParsing.prod.e2e-spec.js
similarity index 100%
rename from e2e/src/advanced/urlParsing.e2e-spec.js
rename to e2e/src/advanced/urlParsing.prod.e2e-spec.js
diff --git a/e2e/src/layout/layout.e2e-spec.js b/e2e/src/layout/layout.prod.e2e-spec.js
similarity index 100%
rename from e2e/src/layout/layout.e2e-spec.js
rename to e2e/src/layout/layout.prod.e2e-spec.js
diff --git a/e2e/src/layout/viewerCtxMenu.prod.e2e-spec.js b/e2e/src/layout/viewerCtxMenu.prod.e2e-spec.js
new file mode 100644
index 0000000000000000000000000000000000000000..71aceb252fb67f1eaa618ba860ab43dd159a018b
--- /dev/null
+++ b/e2e/src/layout/viewerCtxMenu.prod.e2e-spec.js
@@ -0,0 +1,63 @@
+const { AtlasPage } = require('../util')
+const { ARIA_LABELS } = require('../../../common/constants')
+const dict = {
+  "ICBM 2009c Nonlinear Asymmetric": {
+    "JuBrain Cytoarchitectonic Atlas": {
+      tests:[
+        {
+          position: [550, 270],
+          expectedLabelName: 'Fastigial Nucleus (Cerebellum) - right hemisphere',
+        }
+      ]
+    }
+  }
+}
+
+describe('> viewerCtxMenu', () => {
+
+  for (const templateName in dict) {
+    for (const parcellationName in dict[templateName]) {
+      describe(`> on ${templateName} / ${parcellationName}`, () => {
+        beforeAll(async () => {
+          iavPage = new AtlasPage()
+          await iavPage.init()
+          await iavPage.goto()
+          await iavPage.selectTitleTemplateParcellation(templateName, parcellationName)
+          await iavPage.wait(500)
+          await iavPage.waitForAsync()
+        })
+
+        it('> does not appear on init', async () => {
+          const visible = await iavPage.isVisible(`[aria-label="${ARIA_LABELS.CONTEXT_MENU}"]`)
+          expect(visible).toBeFalse()
+        })
+  
+        it('> appears on click', async () => {
+          const { tests } = dict[templateName][parcellationName]
+          const { position } = tests[0]
+          await iavPage.cursorMoveToAndClick({ position })
+          await iavPage.wait(500)
+          const visible = await iavPage.isVisible(`[aria-label="${ARIA_LABELS.CONTEXT_MENU}"]`)
+          expect(visible).toBeTrue()
+        })
+
+        it('> pos does not change when click inside', async () => {
+          const { x: xBefore, y: yBefore, height: hBefore } = await iavPage.isAt(`[aria-label="${ARIA_LABELS.CONTEXT_MENU}"]`)
+          await iavPage.click(`[aria-label="${ARIA_LABELS.SHOW_IN_OTHER_REF_SPACE}"]`)
+          await iavPage.wait(500)
+          const { x: xAfter, y: yAfter, height: hAfter } = await iavPage.isAt(`[aria-label="${ARIA_LABELS.CONTEXT_MENU}"]`)
+          expect(xBefore).toEqual(xAfter)
+          expect(yBefore).toEqual(yAfter)
+          expect(hAfter).toBeGreaterThan(hBefore)
+        })
+
+        it('> disappear again on click of anywhere else', async () => {
+          await iavPage.cursorMoveToAndClick({ position: [10, 10] })
+          await iavPage.wait(500)
+          const visible = await iavPage.isVisible(`[aria-label="${ARIA_LABELS.CONTEXT_MENU}"]`)
+          expect(visible).toBeFalse()
+        })
+      })
+    }
+  }
+})
\ No newline at end of file
diff --git a/e2e/src/navigating/changeTemplate.e2e-spec.js b/e2e/src/navigating/changeTemplate.prod.e2e-spec.js
similarity index 100%
rename from e2e/src/navigating/changeTemplate.e2e-spec.js
rename to e2e/src/navigating/changeTemplate.prod.e2e-spec.js
diff --git a/e2e/src/navigating/mouseOverNehuba.e2e-spec.js b/e2e/src/navigating/mouseOverNehuba.prod.e2e-spec.js
similarity index 100%
rename from e2e/src/navigating/mouseOverNehuba.e2e-spec.js
rename to e2e/src/navigating/mouseOverNehuba.prod.e2e-spec.js
diff --git a/e2e/src/navigating/navigateFromRegion.e2e-spec.js b/e2e/src/navigating/navigateFromRegion.prod.e2e-spec.js
similarity index 84%
rename from e2e/src/navigating/navigateFromRegion.e2e-spec.js
rename to e2e/src/navigating/navigateFromRegion.prod.e2e-spec.js
index d6a1ba4ab0c0e5c0cacf6e2d4c582197b5f6520f..b66aed3440a638c7bfa62bb79907ed71e3402455 100644
--- a/e2e/src/navigating/navigateFromRegion.e2e-spec.js
+++ b/e2e/src/navigating/navigateFromRegion.prod.e2e-spec.js
@@ -1,4 +1,6 @@
-const {AtlasPage} = require('../util')
+const { AtlasPage } = require('../util')
+const { ARIA_LABELS } = require('../../../common/constants')
+const { SHOW_IN_OTHER_REF_SPACE, AVAILABILITY_IN_OTHER_REF_SPACE } = ARIA_LABELS
 
 const TEST_DATA = [
   {
@@ -72,7 +74,7 @@ const getBeforeEachFn = iavPage => ({
   await iavPage.waitUntilAllChunksLoaded()
   await iavPage.cursorMoveToAndClick({ position })
 
-  await iavPage.showOtherTemplateMenu()
+  await iavPage.click(`[aria-label="${SHOW_IN_OTHER_REF_SPACE}"]`)
   await iavPage.wait(500)
 }
 
@@ -104,18 +106,13 @@ describe('> explore same region in different templates', () => {
           describe(`> moving to ${name}`, () => {
             it('> works as expected', async () => {
 
-              const otherTemplates = await iavPage.getAllOtherTemplates()
-              const idx = otherTemplates.findIndex(template => {
-                if (hemisphere) {
-                  if (template.indexOf(hemisphere) < 0) return false
-                }
-                return template.indexOf(name) >= 0
-              })
-      
-              expect(idx).toBeGreaterThanOrEqual(0)
-      
-              await iavPage.clickNthItemAllOtherTemplates(idx)
+              const otherTemplates = await iavPage.getText(`[aria-label="${SHOW_IN_OTHER_REF_SPACE}: ${name}${hemisphere ? (' - ' + hemisphere) : ''}"]`)
+              if (hemisphere) {
+                expect(otherTemplates.indexOf(hemisphere)).toBeGreaterThanOrEqual(0)
+              }
+              expect(otherTemplates.indexOf(name)).toBeGreaterThanOrEqual(0)
       
+              await iavPage.click(`[aria-label="${SHOW_IN_OTHER_REF_SPACE}: ${name}${hemisphere ? (' - ' + hemisphere) : ''}"]`)
               await iavPage.wait(500)
               await iavPage.waitUntilAllChunksLoaded()
               
diff --git a/e2e/src/navigating/originDataset.prod.e2e-spec.js b/e2e/src/navigating/originDataset.prod.e2e-spec.js
new file mode 100644
index 0000000000000000000000000000000000000000..0dbd2282f0031a91db584f90a8085e2953b09719
--- /dev/null
+++ b/e2e/src/navigating/originDataset.prod.e2e-spec.js
@@ -0,0 +1,80 @@
+const { AtlasPage } = require("../util")
+const { ARIA_LABELS } = require('../../../common/constants')
+const { SHOW_CONNECTIVITY_DATA, SHOW_IN_OTHER_REF_SPACE, SHOW_ORIGIN_DATASET } = ARIA_LABELS
+
+const cssSelector = `[aria-label="${SHOW_ORIGIN_DATASET}"]`
+
+const dict = {
+  'ICBM 2009c Nonlinear Asymmetric': {
+    'JuBrain Cytoarchitectonic Atlas': {
+      tests: [
+        {
+          position: [600, 490],
+          expectedLabelName: 'Area 6ma (preSMA, mesial SFG) - left hemisphere',
+        }
+      ]
+    }
+  }
+}
+
+describe('origin dataset pmap', () => {
+  let iavPage
+
+  beforeAll(async () => {
+    iavPage = new AtlasPage()
+    await iavPage.init()
+  })
+
+  for (const templateName in dict) {
+    for (const parcellationName in dict[templateName]) {
+      describe(`testing template: ${templateName}, parcellation name: ${parcellationName}`, () => {
+
+        const {url, tests} = dict[templateName][parcellationName]
+        beforeAll(async () => {
+          if (url) {
+            await iavPage.goto(url)
+          } else {
+            await iavPage.goto()
+            await iavPage.selectTitleTemplateParcellation(templateName, parcellationName)
+          }
+          
+          const tag = await iavPage.getSideNavTag()
+          await tag.click()
+          await iavPage.wait(5000)
+          await iavPage.waitUntilAllChunksLoaded()
+        })
+
+        for (const test of tests) {
+          it('> original pmap btn exists, and on click, show pmap', async () => {
+
+            const { position, expectedLabelName } = test
+            await iavPage.cursorMoveToAndClick({ position })
+
+            await iavPage.click(cssSelector)
+            await iavPage.wait(5000)
+            await iavPage.waitForAsync()
+
+            const additionalLayerControlIsExpanded = await iavPage.additionalLayerControlIsExpanded()
+            expect(additionalLayerControlIsExpanded).toEqual(false)
+            
+            const checked = await iavPage.switchIsChecked(cssSelector)
+            expect(checked).toEqual(true)
+          })
+
+          it('> on second click, dismisses the pmap', async () => {
+
+            await iavPage.click(cssSelector)
+            await iavPage.wait(5000)
+            await iavPage.waitForAsync()
+
+            const additionalLayerControlIsShown = await iavPage.additionalLayerControlIsVisible()
+            expect(additionalLayerControlIsShown).toEqual(false)
+            
+            const checked = await iavPage.switchIsChecked(cssSelector)
+            expect(checked).toEqual(false)
+          })
+        }
+      })
+    }
+  }
+})
\ No newline at end of file
diff --git a/e2e/src/selecting/share.e2e-screenshot.js b/e2e/src/selecting/share.e2e-screenshot.js
new file mode 100644
index 0000000000000000000000000000000000000000..35d8872c4b53002c9053eb4831bd394775ac6e40
--- /dev/null
+++ b/e2e/src/selecting/share.e2e-screenshot.js
@@ -0,0 +1,66 @@
+const { AtlasPage } = require('../util')
+const { ARIA_LABELS } = require('../../../common/constants')
+const fs = require('fs')
+const path = require('path')
+
+const outputDir = path.join(__dirname, '../../../docs/autogen_images')
+const exists = fs.existsSync(outputDir)
+if (!exists) fs.mkdirSync(outputDir)
+
+describe('> share', () => {
+  let iavPage
+  beforeAll(async () => {
+    iavPage = new AtlasPage()
+    await iavPage.init()
+    await iavPage.goto()
+    await iavPage.wait(1000)
+    await iavPage.selectTitleTemplateParcellation('Big Brain (Histology)', 'Grey/White matter')
+    await iavPage.wait(1000)
+    await iavPage.waitUntilAllChunksLoaded()
+  })
+
+  afterEach(async () => {
+    await iavPage.clearAlerts()
+  })
+
+  it('> generating highlight share btn', async () => {
+    const b64 = await iavPage.takeScreenshot(`[aria-label="${ARIA_LABELS.SHARE_BTN}"]`)
+
+    const outputPath = path.join(outputDir, 'share_highlightShareBtn.png')
+    fs.writeFileSync(outputPath, b64, 'base64')
+  })
+
+  it('> generating highlight shareUrl btn', async () => {
+    await iavPage.click(`[aria-label="${ARIA_LABELS.SHARE_BTN}"]`)
+    await iavPage.wait(1000)
+
+    const b64 = await iavPage.takeScreenshot(`[aria-label="${ARIA_LABELS.SHARE_COPY_URL_CLIPBOARD}"]`)
+
+    const outputPath = path.join(outputDir, 'share_highlightShareURL.png')
+    fs.writeFileSync(outputPath, b64, 'base64')
+  })
+
+  it('> generating highlight custom URL', async () => {
+
+    await iavPage.click(`[aria-label="${ARIA_LABELS.SHARE_BTN}"]`)
+    await iavPage.wait(1000)
+
+    const b64 = await iavPage.takeScreenshot(`[aria-label="${ARIA_LABELS.SHARE_CUSTOM_URL}"]`)
+
+    const outputPath = path.join(outputDir, 'share_highlightShareCustomURL.png')
+    fs.writeFileSync(outputPath, b64, 'base64')
+  })
+
+  it('> generating custom URL dialog', async () => {
+
+    await iavPage.click(`[aria-label="${ARIA_LABELS.SHARE_BTN}"]`)
+    await iavPage.wait(1000)
+    await iavPage.click(`[aria-label="${ARIA_LABELS.SHARE_CUSTOM_URL}"]`)
+    await iavPage.wait(1000)
+
+    const b64 = await iavPage.takeScreenshot(`[aria-label="${ARIA_LABELS.SHARE_CUSTOM_URL_DIALOG}"]`)
+
+    const outputPath = path.join(outputDir, 'share_shareCustomURLDialog.png')
+    fs.writeFileSync(outputPath, b64, 'base64')
+  })
+})
diff --git a/e2e/src/selecting/template.e2e-spec.js b/e2e/src/selecting/template.prod.e2e-spec.js
similarity index 100%
rename from e2e/src/selecting/template.e2e-spec.js
rename to e2e/src/selecting/template.prod.e2e-spec.js
diff --git a/e2e/src/util.js b/e2e/src/util.js
index 452ade043817a5e42805a28f88b7ad0b604ee2e4..134ca978f603c656f3b11210ea8984e2615d1219 100644
--- a/e2e/src/util.js
+++ b/e2e/src/util.js
@@ -5,6 +5,7 @@ const USE_SELENIUM = !!process.env.SELENIUM_ADDRESS
 if (ATLAS_URL.length === 0) throw new Error(`ATLAS_URL must either be left unset or defined.`)
 if (ATLAS_URL[ATLAS_URL.length - 1] === '/') throw new Error(`ATLAS_URL should not trail with a slash: ${ATLAS_URL}`)
 const { By, WebDriver, Key } = require('selenium-webdriver')
+const CITRUS_LIGHT_URL = `https://unpkg.com/citruslight@0.1.0/citruslight.js`
 
 function getActualUrl(url) {
   return /^http\:\/\//.test(url) ? url : `${ATLAS_URL}/${url.replace(/^\//, '')}`
@@ -48,6 +49,85 @@ class WdBase{
     return this._browser.driver
   }
 
+  // without image header
+  // output as b64 png
+  async takeScreenshot(cssSelector){
+    
+    if(cssSelector) {
+      await this._browser.executeAsyncScript(async () => {
+        const cb = arguments[arguments.length - 1]
+        const moduleUrl = arguments[0]
+        const cssSelector = arguments[1]
+
+        const el = document.querySelector(cssSelector)
+        if (!el) throw new Error(`css selector not fetching anything`)
+        import(moduleUrl)
+          .then(async m => {
+            m.citruslight(el)
+            cb()
+          })
+      }, CITRUS_LIGHT_URL, cssSelector)
+    }
+    
+    await this.wait(1000)
+    const result = await this._browser.takeScreenshot()
+
+    if (cssSelector) {
+      await this._browser.executeAsyncScript(async () => {
+        const cb = arguments[arguments.length - 1]
+        const moduleUrl = arguments[0]
+        const cssSelector = arguments[1]
+
+        const el = document.querySelector(cssSelector)
+        if (!el) throw new Error(`css selector not fetching anything`)
+        import(moduleUrl)
+          .then(async m => {
+            m.clearAll()
+            cb()
+          })
+      }, CITRUS_LIGHT_URL, cssSelector)
+    }
+    
+    await this.wait(1000)
+    return result
+  }
+
+  async switchIsChecked(cssSelector){
+    if (!cssSelector) throw new Error(`switchChecked method requies css selector`)
+    const checked = await this._browser
+      .findElement( By.css(cssSelector) )
+      .getAttribute('aria-checked')
+    return checked === 'true'
+  }
+
+  async click(cssSelector){
+    if (!cssSelector) throw new Error(`click method needs to define a css selector`)
+    await this._browser.findElement( By.css(cssSelector) ).click()
+  }
+
+  async getText(cssSelector){
+    if (!cssSelector) throw new Error(`getText needs to define css selector`)
+    const el = await this._browser.findElement( By.css(cssSelector) )
+    
+    const text = await el.getText()
+    return text
+  }
+
+  async isVisible(cssSelector) {
+
+    if (!cssSelector) throw new Error(`getText needs to define css selector`)
+    const el = await this._browser.findElement( By.css(cssSelector) )
+    const isDisplayed = await el.isDisplayed()
+
+    return isDisplayed
+  }
+
+  async isAt(cssSelector){
+    if (!cssSelector) throw new Error(`getText needs to define css selector`)
+    const { x, y, width, height } = await this._browser.findElement( By.css(cssSelector) ).getRect()
+    return { x, y, width, height }
+  }
+
   historyBack() {
     return this._browser.navigate().back()
   }
@@ -303,9 +383,7 @@ class WdLayoutPage extends WdBase{
   }
 
   _getModalBtns(){
-    return this._getModal()
-      .findElement( By.tagName('mat-card-actions') )
-      .findElements( By.tagName('button') )
+    return this._getModal().findElements( By.tagName('button') )
   }
 
   async getModalText(){
@@ -521,37 +599,6 @@ class WdLayoutPage extends WdBase{
     else await menuItems[index].click()
   }
 
-  // other templates
-  async showOtherTemplateMenu(){
-    await this._driver
-      .findElement( By.css('[aria-label="Show availability in other reference spaces"]') )
-      .click()
-  }
-
-  _getOtherTemplateMenu(){
-    return this._driver
-      .findElement( By.css('[aria-label="Availability in other reference spaces"]') )
-  }
-
-  _getAllOtherTemplates(){
-    return this._getOtherTemplateMenu().findElements( By.css('[mat-menu-item]') )
-  }
-
-  async getAllOtherTemplates(){
-    const els = await this._getAllOtherTemplates()
-    const returnArr = []
-    for (const el of els) {
-      returnArr.push(await _getTextFromWebElement(el))
-    }
-    return returnArr
-  }
-
-  async clickNthItemAllOtherTemplates(index){
-    const arr = await this._getAllOtherTemplates()
-    if (!arr[index]) throw new Error(`index out of bound: trying to access ${index} from arr with length ${arr.length}`)
-    await arr[index].click()
-  }
-
   _getFavDatasetIcon(){
     return this._driver
       .findElement( By.css('[aria-label="Show pinned datasets"]') )
diff --git a/functions/datasets/datasets.js b/functions/datasets/datasets.js
new file mode 100644
index 0000000000000000000000000000000000000000..2827756dca5a7914a4ec9298236fba790b45a7c0
--- /dev/null
+++ b/functions/datasets/datasets.js
@@ -0,0 +1,35 @@
+const CACHED_DATASET_URL = process.env.CACHED_DATASET_URL
+exports.handler = (ev, ctx, cb) => {
+  const {
+    path,
+    httpMethod,
+    headers,
+    queryStringParameters,
+    body,
+    isBase64Encoded,
+  } = ev
+
+
+  const re = /datasets\/\/?templateNameParcellationName\/(.+)\/(.*?)$/.exec(path)
+  if (!re) {
+    return cb(null, { status: 401 })
+  }
+  
+  const [ _, templateName, parcellationName ] = re
+  if (CACHED_DATASET_URL) {
+    cb(null, {
+      statusCode: 302,
+      headers: {
+        'Location': CACHED_DATASET_URL
+      }
+    })
+  } else {
+    return cb(null, {
+      statusCode: 200,
+      body: '[]',
+      headers: {
+        'content-type': 'application/json'
+      }
+    })
+  }
+}
diff --git a/functions/nehubaConfig/nehubaConfig.js b/functions/nehubaConfig/nehubaConfig.js
new file mode 100644
index 0000000000000000000000000000000000000000..cfb8a7416e054ae7013c688f57b2c3fb4d578554
--- /dev/null
+++ b/functions/nehubaConfig/nehubaConfig.js
@@ -0,0 +1,38 @@
+const fs = require('fs')
+const { reconfigureUrl } = require('./reconfigPrecomputedServer')
+exports.handler = (ev, ctx, cb) => {
+  const {
+    path,
+    httpMethod,
+    headers,
+    queryStringParameters,
+    body,
+    isBase64Encoded,
+  } = ev
+
+
+  const re = /nehubaConfig\/(.+)$/.exec(path)
+  if (!re) {
+    return cb(null, {
+      status: 401,
+      body: `config name is required`
+    })
+  }
+
+  const configName = re[1]
+  fs.readFile(`./json/${configName}.json`, 'utf-8', (err, data) => {
+    if (err) {
+      return cb(null, {
+        status: 404,
+        body: `config ${configName} does not exist, ${err.toString()}`
+      })
+    }
+    return cb(null, {
+      status: 200,
+      body: reconfigureUrl(data),
+      headers: {
+        'Content-type': 'application/json'
+      }
+    })
+  })
+}
\ No newline at end of file
diff --git a/functions/plugins/plugins.js b/functions/plugins/plugins.js
new file mode 100644
index 0000000000000000000000000000000000000000..d7a005987b4e9312878454f6946a5f6d97f1c543
--- /dev/null
+++ b/functions/plugins/plugins.js
@@ -0,0 +1,9 @@
+exports.handler = (ev, ctx, cb) => {
+  cb(null, {
+    status: 200,
+    body: '[]',
+    headers: {
+      'Content-type': 'application/json'
+    }
+  })
+}
diff --git a/functions/templates/templates.js b/functions/templates/templates.js
new file mode 100644
index 0000000000000000000000000000000000000000..c6548d85315fcb37ee6e99b29b0c559dd42a7c02
--- /dev/null
+++ b/functions/templates/templates.js
@@ -0,0 +1,53 @@
+const fs = require('fs')
+
+exports.handler = (ev, ctx, cb) => {
+  
+  const {
+    path,
+    httpMethod,
+    headers,
+    queryStringParameters,
+    body,
+    isBase64Encoded,
+  } = ev
+
+  const templates = [
+    // 'infant',
+    // 'templates/bigbrain',
+    'templates/colin',
+    'templates/MNI152',
+    // 'templates/waxholmRatV2_0',
+    // 'templates/allenMouse'
+  ]
+
+  const resp = templates
+
+  const re = /templates\/(.+)$/.exec(path)
+
+  if (re) {
+    const templateName = re[1]
+    fs.readFile(`./json/${templateName}.json`, 'utf-8', (err, data) => {
+      if (err) {
+        return cb(null, {
+          status: 500,
+          body: err.toString()
+        })
+      }
+      return cb(null, {
+        status: 200,
+        body: data,
+        headers: {
+          'Content-type': 'application/json'
+        }
+      })
+    })
+  } else {
+    cb(null, {
+      status: 200,
+      body: JSON.stringify(resp),
+      headers: {
+        'Content-type': 'application/json'
+      }
+    })
+  }
+}
\ No newline at end of file
diff --git a/mkdocs.yml b/mkdocs.yml
index 15b7b28d9767ccfc45bdaf6e19014bacc0ec79d1..e2436413086040713a7cc5eef21856c5a5d2ae8b 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -14,6 +14,16 @@ markdown_extensions:
   - footnotes
   - mdx_truly_sane_lists
 
+plugins:
+  - search
+  # - errandkun:
+  #     extract_path: docs/autogen_images
+  #     external_resources:
+  #     - type: github
+  #       owner: fzj-inm1-bda
+  #       repo: interactive-viewer
+  #       workflow_name: e2e
+
 pages:
   - Home: 'index.md'
   - System requirements: 'requirements.md'
@@ -23,12 +33,14 @@ pages:
     - Searching: 'usage/search.md'
     - Exploring connectivity: 'usage/connectivity.md'
     - Miscellaneous: 'usage/misc.md'
+    - Sharing: 'usage/sharing.md'
   - Advanced usage:
     - Keyboard shortcuts: 'advanced/keyboard.md'
     - URL parsing: 'advanced/url.md'
     - Fetching datasets: 'advanced/datasets.md'
     - Display non-atlas volumes: 'advanced/otherVolumes.md'
   - Release notes:
+    - v2.2.0: 'releases/v2.2.0.md'
     - v2.1.3: 'releases/v2.1.3.md'
     - v2.1.2: 'releases/v2.1.2.md'
     - v2.1.1: 'releases/v2.1.1.md'
diff --git a/netlify.toml b/netlify.toml
new file mode 100644
index 0000000000000000000000000000000000000000..a13f3209ddc97124cb12ca7c9a811beaad48d3dd
--- /dev/null
+++ b/netlify.toml
@@ -0,0 +1,7 @@
+# toml netfliy: https://docs.netlify.com/configure-builds/file-based-configuration/#sample-file
+
+[build]
+  publish="dist/aot/"
+  command="cp deploy/util/* functions/nehubaConfig/ && cp -R src/res/ext functions/templates/json && cp -R src/res/ext functions/nehubaConfig/json && npm run build-aot"
+  functions="functions"
+  environment={ BACKEND_URL=".netlify/functions/" }
\ No newline at end of file
diff --git a/package.json b/package.json
index 6332a0cce1b6e06ed950246bc04893cd1b9d8b3c..ef40f78208f32fab295f7455702fd23fc074888e 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
-  "name": "interactiveviewer",
-  "version": "0.0.2",
-  "description": "",
+  "name": "interactive-viewer",
+  "version": "2.2.0",
+  "description": "HBP interactive atlas viewer. Integrating KG query, dataset previews & more. Based on humanbrainproject/nehuba & google/neuroglancer. Built with angular.io",
   "scripts": {
     "dev-server-export": "webpack-dev-server --config webpack.export.js",
     "build-export": "webpack --config webpack.export.js",
@@ -20,15 +20,14 @@
     "wd": "webdriver-manager"
   },
   "keywords": [],
-  "author": "",
-  "license": "TO BE DECIDED",
+  "author": "FZJ-INM1-BDA <inm1-bda@fz-juelich.de>",
+  "license": "apache-2.0",
   "devDependencies": {
     "@angular/animations": "^9.0.0",
     "@angular/cdk": "^9.0.0",
-    "@angular/cdk-experimental": "^7.3.7",
     "@angular/common": "^9.0.0",
     "@angular/compiler": "^9.0.0",
-    "@angular/compiler-cli": "^9.0.0",
+    "@angular/compiler-cli": "^9.1.4",
     "@angular/core": "^9.0.0",
     "@angular/elements": "^9.0.0",
     "@angular/forms": "^9.0.0",
@@ -36,24 +35,20 @@
     "@angular/material": "^9.0.0",
     "@angular/platform-browser": "^9.0.0",
     "@angular/platform-browser-dynamic": "^9.0.0",
-    "@angular/router": "^9.0.0",
     "@material/dialog": "^4.0.0",
-    "@ngrx/effects": "^7.4.0",
-    "@ngrx/store": "^7.4.0",
     "@ngtools/webpack": "^9.0.1",
-    "@types/jasmine": "^3.3.12",
-    "@types/node": "^12.0.0",
+    "@types/jasmine": "^3.5.0",
     "@types/webpack-env": "^1.13.6",
     "@typescript-eslint/eslint-plugin": "^2.12.0",
     "@typescript-eslint/parser": "^2.12.0",
     "angular2-template-loader": "^0.6.2",
-    "bootstrap": "^4.4.1",
     "codelyzer": "^5.0.1",
     "core-js": "^3.0.1",
     "css-loader": "^3.2.0",
     "eslint": "^6.8.0",
     "eslint-plugin-html": "^6.0.0",
     "file-loader": "^1.1.11",
+    "glob": "^7.1.6",
     "hammerjs": "^2.0.8",
     "html-webpack-plugin": "^3.2.0",
     "html2canvas": "^1.0.0-rc.1",
@@ -70,13 +65,14 @@
     "karma-webpack": "^3.0.0",
     "lodash.merge": "^4.6.2",
     "mini-css-extract-plugin": "^0.8.0",
-    "node-sass": "^4.12.0",
+    "node-sass": "^4.14.1",
     "protractor": "^6.0.0",
     "raw-loader": "^0.5.1",
     "reflect-metadata": "^0.1.12",
     "rxjs": "6.5.4",
     "sass-loader": "^7.2.0",
     "showdown": "^1.9.1",
+    "terser-webpack-plugin": "^3.0.1",
     "ts-loader": "^4.3.0",
     "ts-node": "^8.1.0",
     "typescript": "~3.7.5",
@@ -84,11 +80,15 @@
     "webpack": "^4.41.2",
     "webpack-cli": "^3.3.2",
     "webpack-closure-compiler": "^2.1.6",
-    "webpack-dev-server": "^3.1.4",
-    "webpack-merge": "^4.1.2",
-    "zone.js": "^0.10.2"
+    "webpack-dev-server": "^3.10.3",
+    "webpack-merge": "^4.1.2"
   },
   "dependencies": {
-    "hbp-connectivity-component": "^0.1.0"
+    "@ngrx/effects": "^9.1.1",
+    "@ngrx/store": "^9.1.1",
+    "@types/node": "12.12.39",
+    "export-nehuba": "0.0.2",
+    "hbp-connectivity-component": "^0.1.0",
+    "zone.js": "^0.10.2"
   }
 }
diff --git a/src/atlasViewer/atlasViewer.apiService.service.spec.ts b/src/atlasViewer/atlasViewer.apiService.service.spec.ts
index e1164b83f9064702177f8763def8feeffdab47db..a2c77a18d54841ba51a0fbf8e752763317f972a5 100644
--- a/src/atlasViewer/atlasViewer.apiService.service.spec.ts
+++ b/src/atlasViewer/atlasViewer.apiService.service.spec.ts
@@ -1,60 +1,429 @@
-import { } from 'jasmine'
-import { AtlasViewerAPIServices } from "src/atlasViewer/atlasViewer.apiService.service";
-import { async, TestBed } from "@angular/core/testing";
-import { provideMockActions } from "@ngrx/effects/testing";
+import { AtlasViewerAPIServices, overrideNehubaClickFactory, CANCELLABLE_DIALOG } from "src/atlasViewer/atlasViewer.apiService.service";
+import { async, TestBed, fakeAsync, tick } from "@angular/core/testing";
 import { provideMockStore } from "@ngrx/store/testing";
 import { defaultRootState } from "src/services/stateStore.service";
-import { Observable, of } from "rxjs";
-import { Action } from "@ngrx/store";
 import { AngularMaterialModule } from "src/ui/sharedModules/angularMaterial.module";
 import { HttpClientModule } from '@angular/common/http';
 import { WidgetModule } from './widgetUnit/widget.module';
-import { PluginModule } from './pluginUnit/plugin.module';
-const actions$: Observable<Action> = of({ type: 'TEST' })
-
+import { HttpClientTestingModule, HttpTestingController } from "@angular/common/http/testing";
+import { PluginServices } from "./pluginUnit";
 
 describe('atlasViewer.apiService.service.ts', () => {
-  describe('getUserToSelectARegion', () => {
+
+  describe('AtlasViewerAPIServices', () => {
+
+    const cancelTokenSpy = jasmine.createSpy('cancelToken')
+    const cancellableDialogSpy = jasmine.createSpy('openCallableDialog').and.returnValue(cancelTokenSpy)
+
+    afterEach(() => {
+      cancelTokenSpy.calls.reset()
+      cancellableDialogSpy.calls.reset()
+
+      const ctrl = TestBed.inject(HttpTestingController)
+      ctrl.verify()
+    })
 
     beforeEach(async(() => {
       TestBed.configureTestingModule({
         imports: [
           AngularMaterialModule,
-          HttpClientModule,
+          HttpClientTestingModule,
           WidgetModule,
-          PluginModule,
         ],
         providers: [
           AtlasViewerAPIServices,
-          provideMockActions(() => actions$),
-          provideMockStore({ initialState: defaultRootState })
+          provideMockStore({ initialState: defaultRootState }),
+          {
+            provide: CANCELLABLE_DIALOG,
+            useValue: cancellableDialogSpy
+          },
+          {
+            provide: PluginServices,
+            useValue: {}
+          }
         ]
       }).compileComponents()
-    }))
+    }))  
+
+    it('service exists', () => {
+      const service = TestBed.inject(AtlasViewerAPIServices)
+      expect(service).not.toBeNull()
+    })
+
+    describe('uiHandle', () => {
 
-    it('should return value on resolve', async () => {
-      const regionToSend = 'test-region'
-      let sentData: any
-      const apiService = TestBed.get(AtlasViewerAPIServices)
-      const callApi = apiService.interactiveViewer.uiHandle.getUserToSelectARegion('selecting Region mode message')
-      apiService.getUserToSelectARegionResolve(regionToSend)
-      await callApi.then(r => {
-        sentData = r
+      describe('getUserToSelectARegion', () => {
+
+        it('on init, expect getUserToSelectRegion to be length 0', () => {
+          const service = TestBed.inject(AtlasViewerAPIServices)
+          expect(service.getUserToSelectRegion.length).toEqual(0)
+        })
+        it('calling getUserToSelectARegion() populates getUserToSelectRegion', () => {
+          const service = TestBed.inject(AtlasViewerAPIServices)
+
+          const pr = service.interactiveViewer.uiHandle.getUserToSelectARegion('hello world')
+          
+          expect(service.getUserToSelectRegion.length).toEqual(1)
+          const { promise, message, rs, rj } = service.getUserToSelectRegion[0]
+          expect(promise).toEqual(pr)
+          expect(message).toEqual('hello world')
+          
+          expect(rs).not.toBeUndefined()
+          expect(rs).not.toBeNull()
+
+          expect(rj).not.toBeUndefined()
+          expect(rj).not.toBeNull()
+        })
       })
-      expect(sentData).toEqual(regionToSend)
-    })
-
-    it('pluginRegionSelectionEnabled should false after resolve', async () => {
-      const { uiState } = defaultRootState
-      const regionToSend = 'test-region'
-      let sentData: any
-      const apiService = TestBed.get(AtlasViewerAPIServices)
-      const callApi = apiService.interactiveViewer.uiHandle.getUserToSelectARegion('selecting Region mode message')
-      apiService.getUserToSelectARegionResolve(regionToSend)
-      await callApi.then(r => {
-        sentData = r
+
+      describe('cancelPromise', () => {
+        it('calling cancelPromise removes pr from getUsertoSelectRegion', done => {
+
+          const service = TestBed.inject(AtlasViewerAPIServices)
+          const pr = service.interactiveViewer.uiHandle.getUserToSelectARegion('test')
+          pr.catch(e => {
+            expect(e.userInitiated).toEqual(false)
+            expect(service.getUserToSelectRegion.length).toEqual(0)
+            done()
+          })
+          service.interactiveViewer.uiHandle.cancelPromise(pr)
+        })
+
+        it('alling cancelPromise on non existing promise, throws ', () => {
+
+          const service = TestBed.inject(AtlasViewerAPIServices)
+          const pr = service.interactiveViewer.uiHandle.getUserToSelectARegion('test')
+          service.interactiveViewer.uiHandle.cancelPromise(pr)
+          expect(() => {
+            service.interactiveViewer.uiHandle.cancelPromise(pr)
+          }).toThrow()
+        })
       })
-      expect(uiState.pluginRegionSelectionEnabled).toBe(false)
+
+      describe('getUserToSelectARegion, cancelPromise and userCancel', () => {
+        it('if token is provided, on getUserToSelectRegionUI$ next should follow by call to injected function', () => {
+          const service = TestBed.inject(AtlasViewerAPIServices)
+          
+          const rsSpy = jasmine.createSpy('rs') 
+          const rjSpy = jasmine.createSpy('rj')
+          const mockObj = {
+            message: 'test',
+            promise: new Promise((rs, rj) => {}),
+            rs: rsSpy,
+            rj: rjSpy,
+          }
+          service.getUserToSelectRegionUI$.next([ mockObj ])
+          
+
+          expect(cancellableDialogSpy).toHaveBeenCalled()
+          
+          const arg = cancellableDialogSpy.calls.mostRecent().args
+          expect(arg[0]).toEqual('test')
+          expect(arg[1].userCancelCallback).toBeTruthy()
+        })
+
+        it('if multiple regionUIs are provided, only the last one is used', () => {
+          const service = TestBed.inject(AtlasViewerAPIServices)
+          
+          const rsSpy = jasmine.createSpy('rs') 
+          const rjSpy = jasmine.createSpy('rj')
+          const mockObj1 = {
+            message: 'test1',
+            promise: new Promise((rs, rj) => {}),
+            rs: rsSpy,
+            rj: rjSpy,
+          }
+          const mockObj2 = {
+            message: 'test2',
+            promise: new Promise((rs, rj) => {}),
+            rs: rsSpy,
+            rj: rjSpy,
+          }
+          service.getUserToSelectRegionUI$.next([ mockObj1, mockObj2 ])
+          
+          expect(cancellableDialogSpy).toHaveBeenCalled()
+          
+          const arg = cancellableDialogSpy.calls.mostRecent().args
+          expect(arg[0]).toEqual('test2')
+          expect(arg[1].userCancelCallback).toBeTruthy()
+        })
+
+        describe('calling userCacellationCb', () => {
+
+          it('correct usage => in removeBasedOnPr called, rj with userini as true', fakeAsync(() => {
+            const service = TestBed.inject(AtlasViewerAPIServices)
+            
+            const rsSpy = jasmine.createSpy('rs') 
+            const rjSpy = jasmine.createSpy('rj')
+            const promise = new Promise((rs, rj) => {})
+            const mockObj = {
+              message: 'test',
+              promise,
+              rs: rsSpy,
+              rj: rjSpy,
+            }
+
+            const removeBaseOnPr = spyOn(service, 'removeBasedOnPr').and.returnValue(null)
+
+            service.getUserToSelectRegionUI$.next([ mockObj ])
+            const arg = cancellableDialogSpy.calls.mostRecent().args
+            const cb = arg[1].userCancelCallback
+            cb()
+            tick(100)
+            expect(rjSpy).toHaveBeenCalledWith({ userInitiated: true })
+            expect(removeBaseOnPr).toHaveBeenCalledWith(promise, { userInitiated: true })
+            
+          }))
+
+          it('incorrect usage (resolve) => removebasedonpr, rj not called', fakeAsync(() => {
+
+            const service = TestBed.inject(AtlasViewerAPIServices)
+            
+            const dummyObj = {
+              hello:'world'
+            }
+
+            const rsSpy = jasmine.createSpy('rs') 
+            const rjSpy = jasmine.createSpy('rj')
+            const promise = Promise.resolve(dummyObj)
+            const mockObj = {
+              message: 'test',
+              promise,
+              rs: rsSpy,
+              rj: rjSpy,
+            }
+
+            const removeBaseOnPr = spyOn(service, 'removeBasedOnPr').and.returnValue(null)
+
+            service.getUserToSelectRegionUI$.next([ mockObj ])
+            const arg = cancellableDialogSpy.calls.mostRecent().args
+            const cb = arg[1].userCancelCallback
+            cb()
+            tick(100)
+            expect(rjSpy).not.toHaveBeenCalled()
+            expect(removeBaseOnPr).not.toHaveBeenCalled()
+            
+          }))
+
+          it('incorrect usage (reject) => removebasedonpr, rj not called', fakeAsync(() => {
+
+            const service = TestBed.inject(AtlasViewerAPIServices)
+            
+            const dummyObj = {
+              hello:'world'
+            }
+
+            const rsSpy = jasmine.createSpy('rs') 
+            const rjSpy = jasmine.createSpy('rj')
+            const promise = Promise.reject(dummyObj)
+            const mockObj = {
+              message: 'test',
+              promise,
+              rs: rsSpy,
+              rj: rjSpy,
+            }
+
+            const removeBaseOnPr = spyOn(service, 'removeBasedOnPr').and.returnValue(null)
+
+            service.getUserToSelectRegionUI$.next([ mockObj ])
+            const arg = cancellableDialogSpy.calls.mostRecent().args
+            const cb = arg[1].userCancelCallback
+            cb()
+            tick(100)
+            expect(rjSpy).not.toHaveBeenCalled()
+            expect(removeBaseOnPr).not.toHaveBeenCalled()
+            
+          }))
+        })
+      })
+    })
+  })
+
+
+  describe('overrideNehubaClickFactory', () => {
+
+    const OVERRIDE_NEHUBA_TOKEN = 'OVERRIDE_NEHUBA_TOKEN'
+    const MOCK_GET_MOUSEOVER_SEGMENTS_TOKEN = 'MOCK_GET_MOUSEOVER_SEGMENTS_TOKEN'
+
+    let mockGetMouseOverSegments = []
+    
+    afterEach(() => {
+      mockGetMouseOverSegments = []
+    })
+
+    beforeEach(async(() => {
+      TestBed.configureTestingModule({
+        imports: [
+          AngularMaterialModule,
+          HttpClientModule,
+          WidgetModule,
+        ],
+        providers: [
+          {
+            provide: OVERRIDE_NEHUBA_TOKEN,
+            useFactory: overrideNehubaClickFactory,
+            deps: [
+              AtlasViewerAPIServices,
+              MOCK_GET_MOUSEOVER_SEGMENTS_TOKEN,
+            ]
+          },
+          {
+            provide: MOCK_GET_MOUSEOVER_SEGMENTS_TOKEN,
+            useValue: () => {
+              return mockGetMouseOverSegments
+            }
+          },
+          {
+            provide: PluginServices,
+            useValue: {}
+          },
+          AtlasViewerAPIServices,
+          provideMockStore({ initialState: defaultRootState }),
+        ]
+      }).compileComponents()
+    }))
+
+    it('can obtain override fn', () => {
+      const fn = TestBed.inject(OVERRIDE_NEHUBA_TOKEN as any)
+      expect(fn).not.toBeNull()
+    })
+
+    it('by default, next fn will be called', () => {
+      const fn = TestBed.inject(OVERRIDE_NEHUBA_TOKEN as any) as (next: () => void) => void
+      const nextSpy = jasmine.createSpy('next')
+      fn(nextSpy)
+      expect(nextSpy).toHaveBeenCalled()
+    })
+
+    it('if both apiService.getUserToSelectRegion.length > 0 and mouseoverSegment.length >0, then next will not be called, but rs will be', () => {
+      const fn = TestBed.inject(OVERRIDE_NEHUBA_TOKEN as any) as (next: () => void) => void
+      const apiService = TestBed.inject(AtlasViewerAPIServices)
+
+      const rsSpy = jasmine.createSpy('rs') 
+      const rjSpy = jasmine.createSpy('rj')
+      apiService.getUserToSelectRegion = [
+        {
+          message: 'test',
+          promise: null,
+          rs: rsSpy,
+          rj: rjSpy,
+        }
+      ]
+
+      const mockSegment = {
+        layer: {
+          name: 'apple'
+        },
+        segment: {
+          name: 'bananas'
+        }
+      }
+      mockGetMouseOverSegments = [ mockSegment ]
+      
+      const nextSpy = jasmine.createSpy('next')
+      fn(nextSpy)
+
+      expect(nextSpy).not.toHaveBeenCalled()
+      expect(rsSpy).toHaveBeenCalledWith(mockSegment)
+    })
+  
+    it('if apiService.getUserToSelectRegion.length === 0, and mouseoversegment.length > 0 calls next', () => {
+      const fn = TestBed.inject(OVERRIDE_NEHUBA_TOKEN as any) as (next: () => void) => void
+
+      const mockSegment = {
+        layer: {
+          name: 'apple'
+        },
+        segment: {
+          name: 'bananas'
+        }
+      }
+      mockGetMouseOverSegments = [ mockSegment ]
+      
+      const nextSpy = jasmine.createSpy('next')
+      fn(nextSpy)
+
+      expect(nextSpy).toHaveBeenCalled()
+    })
+
+    it('if apiService.getUserToSelectRegion.length > 0, but mouseoversegment.length ===0, will not call next, will not rs, will not call rj', () => {
+      const fn = TestBed.inject(OVERRIDE_NEHUBA_TOKEN as any) as (next: () => void) => void
+      const apiService = TestBed.inject(AtlasViewerAPIServices)
+
+      const rsSpy = jasmine.createSpy('rs') 
+      const rjSpy = jasmine.createSpy('rj')
+      apiService.getUserToSelectRegion = [
+        {
+          message: 'test',
+          promise: null,
+          rs: rsSpy,
+          rj: rjSpy,
+        }
+      ]
+      
+      const nextSpy = jasmine.createSpy('next')
+      fn(nextSpy)
+
+      expect(rsSpy).not.toHaveBeenCalled()
+      expect(nextSpy).toHaveBeenCalled()
+      expect(rjSpy).not.toHaveBeenCalled()
+    })
+    it('if muliple getUserToSelectRegion handler exists, it resolves in a FIFO manner', () => {
+      const fn = TestBed.inject(OVERRIDE_NEHUBA_TOKEN as any) as (next: () => void) => void
+      const apiService = TestBed.inject(AtlasViewerAPIServices)
+
+      const rsSpy1 = jasmine.createSpy('rs1') 
+      const rjSpy1 = jasmine.createSpy('rj1')
+
+      const rsSpy2 = jasmine.createSpy('rs2') 
+      const rjSpy2 = jasmine.createSpy('rj2')
+      apiService.getUserToSelectRegion = [
+        {
+          message: 'test1',
+          promise: null,
+          rs: rsSpy1,
+          rj: rjSpy1,
+        },
+        {
+          message: 'test2',
+          promise: null,
+          rs: rsSpy2,
+          rj: rjSpy2,
+        }
+      ]
+      
+      const mockSegment = {
+        layer: {
+          name: 'apple'
+        },
+        segment: {
+          name: 'bananas'
+        }
+      }
+
+      mockGetMouseOverSegments = [ mockSegment ]
+
+      const nextSpy1 = jasmine.createSpy('next1')
+      fn(nextSpy1)
+
+      expect(rsSpy2).toHaveBeenCalledWith(mockSegment)
+      expect(rjSpy2).not.toHaveBeenCalled()
+
+      expect(nextSpy1).not.toHaveBeenCalled()
+      expect(rsSpy1).not.toHaveBeenCalled()
+      expect(rjSpy1).not.toHaveBeenCalled()
+
+      const nextSpy2 = jasmine.createSpy('next2')
+      fn(nextSpy2)
+
+      expect(nextSpy2).not.toHaveBeenCalled()
+      expect(rsSpy1).toHaveBeenCalledWith(mockSegment)
+      expect(rjSpy1).not.toHaveBeenCalled()
+
+      const nextSpy3 = jasmine.createSpy('next3')
+      fn(nextSpy3)
+
+      expect(nextSpy3).toHaveBeenCalled()
     })
   })
-})
\ No newline at end of file
+})
diff --git a/src/atlasViewer/atlasViewer.apiService.service.ts b/src/atlasViewer/atlasViewer.apiService.service.ts
index b88de47aff1dfd79bff2e3df1d4b7dc1eb0f243f..9ed9a0eb49aa44531aa32dffad236c05fc81d91a 100644
--- a/src/atlasViewer/atlasViewer.apiService.service.ts
+++ b/src/atlasViewer/atlasViewer.apiService.service.ts
@@ -1,10 +1,10 @@
-import {Injectable, NgZone} from "@angular/core";
+/* eslint-disable @typescript-eslint/no-empty-function */
+import {Injectable, NgZone, Optional, Inject, OnDestroy} from "@angular/core";
 import { select, Store } from "@ngrx/store";
-import { Observable } from "rxjs";
-import { distinctUntilChanged, map, filter, startWith } from "rxjs/operators";
+import { Observable, Subject, Subscription, from, race, of, interval } from "rxjs";
+import { distinctUntilChanged, map, filter, startWith, take, switchMap, catchError, mapTo, tap } from "rxjs/operators";
 import { DialogService } from "src/services/dialogService.service";
 import {
-  DISABLE_PLUGIN_REGION_SELECTION,
   getLabelIndexMap,
   getMultiNgIdsRegionsLabelIndexMap,
   IavRootStoreInterface,
@@ -13,15 +13,29 @@ import {
 import { ModalHandler } from "../util/pluginHandlerClasses/modalHandler";
 import { ToastHandler } from "../util/pluginHandlerClasses/toastHandler";
 import { IPluginManifest, PluginServices } from "./pluginUnit";
-import { ENABLE_PLUGIN_REGION_SELECTION } from "src/services/state/uiState.store";
 
 declare let window
 
+interface IRejectUserInput{
+  userInitiated: boolean
+  reason?: string
+}
+
+interface IGetUserSelectRegionPr{
+  message: string
+  promise: Promise<any>
+  rs: (region: any) => void
+  rj: (reject: IRejectUserInput) => void
+}
+
+export const CANCELLABLE_DIALOG = 'CANCELLABLE_DIALOG'
+export const GET_TOAST_HANDLER_TOKEN = 'GET_TOAST_HANDLER_TOKEN'
+
 @Injectable({
   providedIn : 'root',
 })
 
-export class AtlasViewerAPIServices {
+export class AtlasViewerAPIServices implements OnDestroy{
 
   private loadedTemplates$: Observable<any>
   private selectParcellation$: Observable<any>
@@ -29,15 +43,80 @@ export class AtlasViewerAPIServices {
 
   public loadedLibraries: Map<string, {counter: number, src: HTMLElement|null}> = new Map()
 
-  public getUserToSelectARegionResolve: any
-  public rejectUserSelectionMode: any
+  public removeBasedOnPr = (pr: Promise<any>, {userInitiated = false} = {}) => {
+
+    const idx = this.getUserToSelectRegion.findIndex(({ promise }) => promise === pr)
+    if (idx >=0) {
+      const { rj } = this.getUserToSelectRegion.splice(idx, 1)[0]
+      this.getUserToSelectRegionUI$.next([...this.getUserToSelectRegion])
+      this.zone.run(() => {  })
+      rj({ userInitiated })
+    }
+    else throw new Error(`This promise has already been fulfilled.`)
+
+  }
+
+  private dismissDialog: Function
+  public getUserToSelectRegion: IGetUserSelectRegionPr[] = []
+  public getUserToSelectRegionUI$: Subject<IGetUserSelectRegionPr[]> = new Subject()
+
+  public getUserRegionSelectHandler: () => IGetUserSelectRegionPr = () => {
+    if (this.getUserToSelectRegion.length > 0) {
+      const handler =  this.getUserToSelectRegion.pop()
+      this.getUserToSelectRegionUI$.next([...this.getUserToSelectRegion])
+      return handler
+    } 
+    else return null
+  }
+
+  private s: Subscription[] = []
 
   constructor(
     private store: Store<IavRootStoreInterface>,
     private dialogService: DialogService,
     private zone: NgZone,
     private pluginService: PluginServices,
+    @Optional() @Inject(CANCELLABLE_DIALOG) openCancellableDialog: (message: string, options: any) => () => void,
+    @Optional() @Inject(GET_TOAST_HANDLER_TOKEN) private getToastHandler: Function,
   ) {
+    if (openCancellableDialog) {
+      this.s.push(
+        this.getUserToSelectRegionUI$.pipe(
+          distinctUntilChanged(),
+          switchMap(arr => {
+            if (this.dismissDialog) {
+              this.dismissDialog()
+              this.dismissDialog = null
+            }
+            
+            if (arr.length === 0) return of(null)
+
+            const last = arr[arr.length - 1]
+            const { message, promise } = last
+            return race(
+              from(new Promise(resolve => {
+                this.dismissDialog = openCancellableDialog(message, {
+                  userCancelCallback: () => {
+                    resolve(last)
+                  },
+                  ariaLabel: message
+                })
+              })),
+              from(promise).pipe(
+                catchError(() => of(null)),
+                mapTo(null),
+              )
+            )
+          })
+        ).subscribe(obj => {
+          if (obj) {
+            const { promise, rj } = obj
+            rj({ userInitiated: true })
+            this.removeBasedOnPr(promise, { userInitiated: true })
+          }
+        })
+      )
+    }
 
     this.loadedTemplates$ = this.store.pipe(
       select('viewerState'),
@@ -118,7 +197,8 @@ export class AtlasViewerAPIServices {
 
         /* to be overwritten by atlasViewer.component.ts */
         getToastHandler : () => {
-          throw new Error('getToast Handler not overwritten by atlasViewer.component.ts')
+          if (this.getToastHandler) return this.getToastHandler()
+          else throw new Error('getToast Handler not overwritten by atlasViewer.component.ts')
         },
 
         /**
@@ -136,29 +216,33 @@ export class AtlasViewerAPIServices {
         getUserInput: config => this.dialogService.getUserInput(config) ,
         getUserConfirmation: config => this.dialogService.getUserConfirm(config),
 
-        getUserToSelectARegion: (selectingMessage) => new Promise((resolve, reject) => {
-          this.zone.run(() => {
-            this.store.dispatch({
-              type: ENABLE_PLUGIN_REGION_SELECTION,
-              payload: selectingMessage
-            })
-
-            this.getUserToSelectARegionResolve = resolve
-            this.rejectUserSelectionMode = reject
+        getUserToSelectARegion: message => {
+          const obj = {
+            message,
+            promise: null,
+            rs: null,
+            rj: null
+          }
+          const pr = new Promise((rs, rj) => {
+            obj.rs = rs
+            obj.rj = rj
           })
-        }),
 
-        // ToDo Method should be able to cancel any pending promise.
-        cancelPromise: (pr) => {
+          obj.promise = pr
+
+          this.getUserToSelectRegion.push(obj)
+          this.getUserToSelectRegionUI$.next([...this.getUserToSelectRegion])
           this.zone.run(() => {
-            if (pr === this.interactiveViewer.uiHandle.getUserToSelectARegion) {
-              if (this.rejectUserSelectionMode) this.rejectUserSelectionMode()
-              this.store.dispatch({type: DISABLE_PLUGIN_REGION_SELECTION})
-            }
 
           })
-        }
+          return pr
+        },
+
+        cancelPromise: pr => {
+          this.removeBasedOnPr(pr)
 
+          this.zone.run(() => {  })
+        }
       },
       pluginControl: new Proxy({}, {
         get: (_, prop) => {
@@ -183,6 +267,12 @@ export class AtlasViewerAPIServices {
       this.interactiveViewer.metadata.layersRegionLabelIndexMap = getMultiNgIdsRegionsLabelIndexMap(parcellation)
     })
   }
+
+  ngOnDestroy(){
+    while(this.s.length > 0){
+      this.s.pop().unsubscribe()
+    }
+  }
 }
 
 export interface IInteractiveViewerInterface {
@@ -267,3 +357,16 @@ export interface IUserLandmark {
   id: string /* probably use the it to track and remove user landmarks */
   highlight: boolean
 }
+
+export const overrideNehubaClickFactory = (apiService: AtlasViewerAPIServices, getMouseoverSegments: () => any [] ) => {
+  return (next: () => void) => {
+    const moSegments = getMouseoverSegments()
+    if (!!moSegments && Array.isArray(moSegments) && moSegments.length > 0) {
+      const { rs } = apiService.getUserRegionSelectHandler() || {}
+      if (!!rs) {
+        return rs(moSegments[0])
+      }
+    }
+    next()
+  }
+}
diff --git a/src/atlasViewer/atlasViewer.component.ts b/src/atlasViewer/atlasViewer.component.ts
index 94466205b5dd250b62717fc61b70e797fa7a478f..315e5d2ae8d837a339611d2021462ee5724c7fb0 100644
--- a/src/atlasViewer/atlasViewer.component.ts
+++ b/src/atlasViewer/atlasViewer.component.ts
@@ -7,24 +7,20 @@ import {
   Renderer2,
   TemplateRef,
   ViewChild,
+  ElementRef,
+  Inject,
+  Optional,
 } from "@angular/core";
-import { ActionsSubject, select, Store } from "@ngrx/store";
-import {combineLatest, interval, merge, Observable, of, Subscription} from "rxjs";
-import {
-  concatMap,
-  delay,
-  distinctUntilChanged,
-  filter,
-  map,
-  withLatestFrom,
-} from "rxjs/operators";
+import { Store, select, ActionsSubject } from "@ngrx/store";
+import { Observable, Subscription, combineLatest, interval, merge, of, timer, fromEvent } from "rxjs";
+import { map, filter, distinctUntilChanged, delay, withLatestFrom, switchMapTo, take, startWith } from "rxjs/operators";
+
 import { LayoutMainSide } from "../layouts/mainside/mainside.component";
 import {
   IavRootStoreInterface,
   isDefined,
   safeFilter,
 } from "../services/stateStore.service";
-import { AtlasViewerAPIServices } from "./atlasViewer.apiService.service";
 import { AtlasViewerConstantsServices, UNSUPPORTED_INTERVAL, UNSUPPORTED_PREVIEW } from "./atlasViewer.constantService.service";
 import { WidgetServices } from "./widgetUnit/widgetService.service";
 
@@ -35,12 +31,18 @@ import {
   OPEN_SIDE_PANEL,
 } from "src/services/state/uiState.store";
 import { FixedMouseContextualContainerDirective } from "src/util/directives/FixedMouseContextualContainerDirective.directive";
-import { getViewer, isSame } from "src/util/fn";
+import { isSame } from "src/util/fn";
 import { NehubaContainer } from "../ui/nehubaContainer/nehubaContainer.component";
 import { colorAnimation } from "./atlasViewer.animation"
 import { MouseHoverDirective } from "src/util/directives/mouseOver.directive";
 import {MatSnackBar, MatSnackBarRef} from "@angular/material/snack-bar";
 import {MatDialog, MatDialogRef} from "@angular/material/dialog";
+import { ARIA_LABELS } from 'common/constants'
+
+export const NEHUBA_CLICK_OVERRIDE = 'NEHUBA_CLICK_OVERRIDE'
+
+import { MIN_REQ_EXPLAINER } from 'src/util/constants'
+import { SlServiceService } from "src/spotlight/sl-service.service";
 
 /**
  * TODO
@@ -62,12 +64,11 @@ const compareFn = (it, item) => it.name === item.name
 
 export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
 
+  public CONTEXT_MENU_ARIA_LABEL = ARIA_LABELS.CONTEXT_MENU
   public compareFn = compareFn
 
   @ViewChild('cookieAgreementComponent', {read: TemplateRef}) public cookieAgreementComponent: TemplateRef<any>
 
-  private persistentStateNotifierMatDialogRef: MatDialogRef<any>
-  @ViewChild('persistentStateNotifierTemplate', {read: TemplateRef}) public persistentStateNotifierTemplate: TemplateRef<any>
   @ViewChild('kgToS', {read: TemplateRef}) public kgTosComponent: TemplateRef<any>
   @ViewChild(LayoutMainSide) public layoutMainSide: LayoutMainSide
 
@@ -76,6 +77,8 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
   @ViewChild(FixedMouseContextualContainerDirective) public rClContextualMenu: FixedMouseContextualContainerDirective
   @ViewChild(MouseHoverDirective) private mouseOverNehuba: MouseHoverDirective
 
+  @ViewChild('idleOverlay', {read: TemplateRef}) idelTmpl: TemplateRef<any>
+
   /**
    * required for styling of all child components
    */
@@ -103,15 +106,6 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
 
   private subscriptions: Subscription[] = []
 
-  /* handlers for nglayer */
-  /**
-   * TODO make untangle nglayernames and its dependency on ng
-   * TODO deprecated
-   */
-  public ngLayerNames$: Observable<any>
-  public ngLayers: INgLayerInterface[]
-  private disposeHandler: any
-
   public unsupportedPreviewIdx: number = 0
   public unsupportedPreviews: any[] = UNSUPPORTED_PREVIEW
 
@@ -119,23 +113,20 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
 
   public onhoverSegmentsForFixed$: Observable<string[]>
 
-  private pluginRegionSelectionEnabled$: Observable<boolean>
-  private pluginRegionSelectionEnabled: boolean = false
-  public persistentStateNotifierMessage$: Observable<string>
-
-  private hoveringRegions = []
-  public presentDatasetDialogRef: MatDialogRef<any>
+  public MIN_REQ_EXPLAINER = MIN_REQ_EXPLAINER
 
   constructor(
     private store: Store<IavRootStoreInterface>,
     private widgetServices: WidgetServices,
     private constantsService: AtlasViewerConstantsServices,
-    public apiService: AtlasViewerAPIServices,
     private matDialog: MatDialog,
     private dispatcher$: ActionsSubject,
     private rd: Renderer2,
     public localFileService: LocalFileService,
-    private snackbar: MatSnackBar
+    private snackbar: MatSnackBar,
+    private el: ElementRef,
+    @Optional() @Inject(NEHUBA_CLICK_OVERRIDE) private nehubaClickOverride: Function,
+    private slService: SlServiceService
   ) {
 
     this.snackbarMessage$ = this.store.pipe(
@@ -143,28 +134,6 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
       select("snackbarMessage"),
     )
 
-    this.pluginRegionSelectionEnabled$ = this.store.pipe(
-      select('uiState'),
-      select("pluginRegionSelectionEnabled"),
-      distinctUntilChanged(),
-    )
-    this.persistentStateNotifierMessage$ = this.store.pipe(
-      select('uiState'),
-      select("persistentStateNotifierMessage"),
-      distinctUntilChanged(),
-    )
-
-    /**
-     * TODO deprecated
-     */
-    this.ngLayerNames$ = this.store.pipe(
-      select('viewerState'),
-      filter(state => isDefined(state) && isDefined(state.templateSelected)),
-      distinctUntilChanged((o, n) => o.templateSelected.name === n.templateSelected.name),
-      map(state => Object.keys(state.templateSelected.nehubaConfig.dataset.initialNgState.layers)),
-      delay(0),
-    )
-
     this.sidePanelView$ = this.store.pipe(
       select('uiState'),
       filter(state => isDefined(state)),
@@ -204,9 +173,9 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
     // TODO deprecate
     this.dedicatedView$ = this.store.pipe(
       select('viewerState'),
-      filter(state => isDefined(state) && typeof state.dedicatedView !== 'undefined'),
-      map(state => state.dedicatedView),
+      select('dedicatedView'),
       distinctUntilChanged(),
+      map(v => v[v.length -1])
     )
 
     // TODO temporary hack. even though the front octant is hidden, it seems if a mesh is present, hover will select the said mesh
@@ -245,19 +214,16 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
 
     )
 
-    this.subscriptions.push(
-      this.onhoverSegments$.subscribe(hr => {
-        this.hoveringRegions = hr
-      })
-    )
+    const error = this.el.nativeElement.getAttribute('data-error')
 
-    this.subscriptions.push(
-      this.pluginRegionSelectionEnabled$.subscribe(bool => this.pluginRegionSelectionEnabled = bool)
-    )
+    if (error) {
+      this.snackbar.open(error, 'Dismiss', { duration: 5000 })
+      this.el.nativeElement.removeAttribute('data-error')
+    }
   }
 
   private selectedParcellation$: Observable<any>
-  private selectedParcellation: any
+  public selectedParcellation: any
 
   private cookieDialogRef: MatDialogRef<any>
   private kgTosDialogRef: MatDialogRef<any>
@@ -265,6 +231,29 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
   public ngOnInit() {
     this.meetsRequirement = this.meetsRequirements()
 
+    if (KIOSK_MODE) {
+
+      this.subscriptions.push(
+        merge(
+          fromEvent(window.document, 'mouseup'),
+          this.slService.onClick
+        ).pipe(
+          startWith(true),
+          switchMapTo(timer(1000 * 5 * 60).pipe(
+            take(1)
+          ))
+        ).subscribe(() => {
+          this.slService.showBackdrop(this.idelTmpl)
+        })
+      )
+  
+      this.subscriptions.push(
+        this.slService.onClick.subscribe(() => {
+          this.slService.hideBackdrop()
+        })  
+      )
+    }
+
     if (!this.meetsRequirement) {
       merge(
         of(-1),
@@ -305,20 +294,6 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
       }),
     )
 
-    /**
-     * TODO deprecated
-     */
-    this.subscriptions.push(
-      this.ngLayerNames$.pipe(
-        concatMap(data => this.constantsService.loadExportNehubaPromise.then(data)),
-      ).subscribe(() => {
-        this.ngLayersChangeHandler()
-        const viewer = getViewer()
-        this.disposeHandler = viewer.layerManager.layersChanged.add(() => this.ngLayersChangeHandler())
-        viewer.registerDisposer(this.disposeHandler)
-      }),
-    )
-
     this.subscriptions.push(
       this.newViewer$.subscribe(() => {
         this.widgetServices.clearAllWidgets()
@@ -336,15 +311,6 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
         this.rd.setAttribute(document.body, 'darktheme', flag.toString())
       }),
     )
-
-    this.subscriptions.push(
-      this.persistentStateNotifierMessage$.subscribe(msg => {
-        if (msg) this.persistentStateNotifierMatDialogRef = this.matDialog.open(this.persistentStateNotifierTemplate, { hasBackdrop: false, position: { top: '5px'} })
-        else {
-          if (this.persistentStateNotifierMatDialogRef) this.persistentStateNotifierMatDialogRef.close()
-        }
-      })
-    )
   }
 
   public ngAfterViewInit() {
@@ -406,24 +372,29 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
     )
   }
 
-  public mouseDownNehuba(_event) {
-    this.rClContextualMenu.hide()
-  }
+  public mouseClickDocument(event: MouseEvent) {
+
+    const dismissRClCtxtMenu = this.rClContextualMenu.isShown
 
-  public mouseClickNehuba(event) {
+    const next = () => {
 
-    if (!this.rClContextualMenu) { return }
-    this.rClContextualMenu.mousePos = [
-      event.clientX,
-      event.clientY,
-    ]
+      if (!this.rClContextualMenu) { return }
 
-    // TODO what if user is hovering a landmark?
-    if (!this.pluginRegionSelectionEnabled) {
-      this.rClContextualMenu.show()
-    } else {
-      if (this.hoveringRegions) this.apiService.getUserToSelectARegionResolve(this.hoveringRegions)
+      if (dismissRClCtxtMenu) {
+        if (!this.rClContextualMenu.el.nativeElement.contains(event.target)) {
+          this.rClContextualMenu.hide()
+        }
+      } else {
+        this.rClContextualMenu.mousePos = [
+          event.clientX,
+          event.clientY,
+        ]
+        this.rClContextualMenu.show()
+      } 
     }
+
+    this.nehubaClickOverride(next)
+
   }
 
   public toggleSideNavMenu(opened) {
@@ -458,21 +429,6 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
     return true
   }
 
-  /**
-   * TODO deprecated
-   */
-  public ngLayersChangeHandler() {
-    const viewer = getViewer()
-    this.ngLayers = (viewer.layerManager.managedLayers as any[])
-      // .filter(obj => obj.sourceUrl && /precomputed|nifti/.test(obj.sourceUrl))
-      .map(obj => ({
-        name : obj.name,
-        type : obj.initialSpecification.type,
-        source : obj.sourceUrl,
-        visible : obj.visible,
-      }) as INgLayerInterface)
-  }
-
   public kgTosClickedOk() {
     if (this.kgTosDialogRef) { this.kgTosDialogRef.close() }
     this.store.dispatch({
diff --git a/src/atlasViewer/atlasViewer.constantService.service.ts b/src/atlasViewer/atlasViewer.constantService.service.ts
index 56057d3be8df33a05ce589edb85a9a54b1b5cb27..30cde5aded6877e7df1624f37333c1e17135d61b 100644
--- a/src/atlasViewer/atlasViewer.constantService.service.ts
+++ b/src/atlasViewer/atlasViewer.constantService.service.ts
@@ -24,21 +24,9 @@ export class AtlasViewerConstantsServices implements OnDestroy {
   public darktheme$: Observable<boolean>
 
   public useMobileUI$: Observable<boolean>
-  public loadExportNehubaPromise: Promise<boolean>
-
-  public ngLandmarkLayerName = 'spatial landmark layer'
-  public ngUserLandmarkLayerName = 'user landmark layer'
 
   public citationToastDuration = 7e3
 
-  /**
-   * optimized for nehubaConfig.layout.useNehubaPerspective.fixedZoomPerspectiveSlices
-   *  sliceZoom
-   *  sliceViewportWidth
-   *  sliceViewportHeight
-   */
-  public nehubaLandmarkConstant = 1e-8
-
   /**
    * Timeout can be longer, since configs are lazy loaded.
    */
@@ -180,12 +168,6 @@ export class AtlasViewerConstantsServices implements OnDestroy {
     pointHitRadius : 0,
   }
 
-  public minReqExplaner = `
-  - Interactive atlas viewer requires **webgl2.0**, and the \`EXT_color_buffer_float\` extension enabled.
-  - You can check browsers' support of webgl2.0 by visiting <https://caniuse.com/#feat=webgl2>
-  - Unfortunately, Safari and iOS devices currently do not support **webgl2.0**: <https://webkit.org/status/#specification-webgl-2>
-  `
-
   public minReqMD = `
 # Hmm... it seems like we hit a snag
 It seems your browser has trouble loading interactive atlas viewer.
@@ -356,13 +338,6 @@ Send us an email: <a target = "_blank" href = "mailto:${this.supportEmailAddress
   public dissmissUserLayerSnackbarMessage: string = this.dissmissUserLayerSnackbarMessageDesktop
 }
 
-const parseURLToElement = (url: string): HTMLElement => {
-  const el = document.createElement('script')
-  el.setAttribute('crossorigin', 'true')
-  el.src = url
-  return el
-}
-
 export const UNSUPPORTED_PREVIEW = [{
   text: 'Preview of Colin 27 and JuBrain Cytoarchitectonic',
   previewSrc: './res/image/1.png',
@@ -376,16 +351,6 @@ export const UNSUPPORTED_PREVIEW = [{
 
 export const UNSUPPORTED_INTERVAL = 7000
 
-export const SUPPORT_LIBRARY_MAP: Map<string, HTMLElement> = new Map([
-  ['jquery@3', parseURLToElement('https://code.jquery.com/jquery-3.3.1.min.js')],
-  ['jquery@2', parseURLToElement('https://code.jquery.com/jquery-2.2.4.min.js')],
-  ['webcomponentsLite@1.1.0', parseURLToElement('https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.1.0/webcomponents-lite.js')],
-  ['react@16', parseURLToElement('https://unpkg.com/react@16/umd/react.development.js')],
-  ['reactdom@16', parseURLToElement('https://unpkg.com/react-dom@16/umd/react-dom.development.js')],
-  ['vue@2.5.16', parseURLToElement('https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js')],
-  ['preact@8.4.2', parseURLToElement('https://cdn.jsdelivr.net/npm/preact@8.4.2/dist/preact.min.js')],
-  ['d3@5.7.0', parseURLToElement('https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js')],
-])
 
 /**
  * First attempt at encoding int (e.g. selected region, navigation location) from number (loc info density) to b64 (higher info density)
diff --git a/src/atlasViewer/atlasViewer.style.css b/src/atlasViewer/atlasViewer.style.css
index bb25a9c67fab26f050a29f7533f3333ac5b23f00..4add13a9b03d29fdfb50d376224d0b2ba1421372 100644
--- a/src/atlasViewer/atlasViewer.style.css
+++ b/src/atlasViewer/atlasViewer.style.css
@@ -73,3 +73,8 @@ region-menu
 {
   display:inline-block;
 }
+
+.floating-container
+{
+  max-width: 350px;
+}
\ No newline at end of file
diff --git a/src/atlasViewer/atlasViewer.template.html b/src/atlasViewer/atlasViewer.template.html
index 9bc7caaae3e33df0a16685b5d4cb6edb4ab4ffe8..34ccefe5fd1a9a177df5d4fb05e18888e4d98703 100644
--- a/src/atlasViewer/atlasViewer.template.html
+++ b/src/atlasViewer/atlasViewer.template.html
@@ -41,15 +41,24 @@
 <!-- atlas template -->
 <ng-template #viewerBody>
   <div class="atlas-container" (drag-drop)="localFileService.handleFileDrop($event)">
+    <!-- prevent default is required so that user do not zoom in on UI or scroll on mobile UI -->
     <ui-nehuba-container
-      #uiNehubaContainer
-      iav-mouse-hover 
+      (touchmove)="$event.preventDefault()"
+      iav-viewer-touch-interface
+      [iav-viewer-touch-interface-v-panels]="uiNehubaContainer.viewPanels"
+      [iav-viewer-touch-interface-vp-to-data]="uiNehubaContainer.nehubaViewer?.viewportToDatas"
+      [iav-viewer-touch-interface-ngviewer]="uiNehubaContainer.nehubaViewer?.nehubaViewer?.ngviewer"
+      [iav-viewer-touch-interface-nehuba-config]="uiNehubaContainer.selectedTemplate?.nehubaConfig"
+      #iavNehubaViewerTouch="iavNehubaViewerTouch"
+
+      #uiNehubaContainer="uiNehubaContainer"
+      iav-mouse-hover
       #iavMouseHoverEl="iavMouseHover"
       [currentOnHoverObs$]="iavMouseHoverEl.currentOnHoverObs$"
       [currentOnHover]="iavMouseHoverEl.currentOnHoverObs$ | async"
       iav-captureClickListenerDirective
-      (iav-captureClickListenerDirective-onMousedown)="mouseDownNehuba($event)"
-      (iav-captureClickListenerDirective-onClick)="mouseClickNehuba($event)">
+      [iav-captureClickListenerDirective-captureDocument]="true"
+      (iav-captureClickListenerDirective-onClick)="mouseClickDocument($event)">
     </ui-nehuba-container>
 
     <div class="z-index-10 position-absolute pe-none w-100 h-100">
@@ -89,6 +98,7 @@
 
           </button>
 
+          <!-- visible status card when mat drawer is closed -->
           <mat-card
             *ngIf="!sideNavDrawer.opened"
             (click)="toggleSideNavMenu(false)"
@@ -109,8 +119,8 @@
 
     <div class="d-flex flex-row justify-content-end z-index-10 position-absolute pe-none w-100 h-100">
       <signin-banner
-          signinWrapper
-          [parcellationIsSelected]="selectedParcellation? true : false">
+        signinWrapper
+        [parcellationIsSelected]="!!selectedParcellation">
       </signin-banner>
     </div>
 
@@ -126,14 +136,14 @@
 
       <div floatingMouseContextualContainerDirective>
 
-        <div *ngIf="!ismobile && !presentDatasetDialogRef"
+        <div *ngIf="!ismobile"
           class="d-inline-block"
           iav-mouse-hover
           #iavMouseHoverContextualBlock="iavMouseHover"
           contextualBlock>
 
           <ng-container
-            *ngFor="let labelText of iavMouseHoverContextualBlock.currentOnHoverObs$ | async | mouseOverTextPipe : selectedParcellation">
+            *ngFor="let labelText of iavMouseHoverContextualBlock.currentOnHoverObs$ | async | mouseOverTextPipe">
 
             <mat-list dense>
 
@@ -155,7 +165,9 @@
         <!-- TODO Potentially implementing plugin contextual info -->
       </div>
 
-      <div fixedMouseContextualContainerDirective
+      <div class="floating-container"
+        [attr.aria-label]="CONTEXT_MENU_ARIA_LABEL"
+        fixedMouseContextualContainerDirective
         #fixedContainer="iavFixedMouseCtxContainer">
 
         <!-- on click segment menu -->
@@ -168,9 +180,7 @@
                 class="pe-all"
                 [region]="onHoverRegion"
                 [isSelected]="selectedRegions$ | async | includes : onHoverRegion : compareFn"
-                [hasConnectivity]="selectedParcellation
-                  && selectedParcellation.hasAdditionalViewMode
-                  && selectedParcellation.hasAdditionalViewMode.includes('connectivity')"
+                [hasConnectivity]="selectedParcellation?.hasAdditionalViewMode?.includes('connectivity')"
                 (closeRegionMenu)="rClContextualMenu.hide()">
               </region-menu>
             </div>
@@ -215,7 +225,7 @@
         </p>
         <div class="col-6 d-inline-block text-left">
           <readmore-component [collapsedHeight]="0">
-            <markdown-dom [markdown]="constantsService.minReqExplaner">
+            <markdown-dom [markdown]="MIN_REQ_EXPLAINER">
 
             </markdown-dom>
           </readmore-component>
@@ -241,7 +251,6 @@
   <logo-container></logo-container>
 </ng-template>
 
-<ng-template #persistentStateNotifierTemplate>
-  {{persistentStateNotifierMessage$ | async}}
+<ng-template #idleOverlay>
+  <tryme-component></tryme-component>
 </ng-template>
-
diff --git a/src/atlasViewer/pluginUnit/atlasViewer.pluginService.service.ts b/src/atlasViewer/pluginUnit/atlasViewer.pluginService.service.ts
index 756444017aa5bb9d1b178d21e24a13c54fd1c207..aeecdfb1d35ccb00794f7e31c324e2c7362d279e 100644
--- a/src/atlasViewer/pluginUnit/atlasViewer.pluginService.service.ts
+++ b/src/atlasViewer/pluginUnit/atlasViewer.pluginService.service.ts
@@ -1,18 +1,25 @@
 import { HttpClient } from '@angular/common/http'
-import { ComponentFactory, ComponentFactoryResolver, Injectable, ViewContainerRef } from "@angular/core";
+import { ComponentFactory, ComponentFactoryResolver, Injectable, ViewContainerRef, Inject } from "@angular/core";
 import { PLUGINSTORE_ACTION_TYPES } from "src/services/state/pluginState.store";
 import { IavRootStoreInterface, isDefined } from 'src/services/stateStore.service'
 import { PluginUnit } from "./pluginUnit.component";
 import { WidgetServices } from "../widgetUnit/widgetService.service";
 import { select, Store } from "@ngrx/store";
-import { BehaviorSubject, merge, Observable, of } from "rxjs";
-import { filter, map, shareReplay } from "rxjs/operators";
+import { BehaviorSubject, merge, Observable, of, zip } from "rxjs";
+import { filter, map, shareReplay, switchMap, catchError } from "rxjs/operators";
 import { LoggingService } from 'src/logging';
 import { PluginHandler } from 'src/util/pluginHandler';
-import { AtlasViewerConstantsServices } from "../atlasViewer.constantService.service";
 import { WidgetUnit } from "../widgetUnit/widgetUnit.component";
-
-import './plugin_styles.css'
+import { APPEND_SCRIPT_TOKEN, REMOVE_SCRIPT_TOKEN, BACKENDURL, getHttpHeader } from 'src/util/constants';
+import { PluginFactoryDirective } from './pluginFactory.directive';
+
+export const registerPluginFactoryDirectiveFactory = (pSer: PluginServices) => {
+  return (pFactoryDirective: PluginFactoryDirective) => {
+    pSer.loadExternalLibraries = pFactoryDirective.loadExternalLibraries.bind(pFactoryDirective)
+    pSer.unloadExternalLibraries = pFactoryDirective.unloadExternalLibraries.bind(pFactoryDirective)
+    pSer.pluginViewContainerRef = pFactoryDirective.viewContainerRef
+  }
+}
 
 @Injectable({
   providedIn : 'root',
@@ -27,8 +34,7 @@ export class PluginServices {
 
   public fetchedPluginManifests: IPluginManifest[] = []
   public pluginViewContainerRef: ViewContainerRef
-  public appendSrc: (script: HTMLElement) => void
-  public removeSrc: (script: HTMLElement) => void
+
   private pluginUnitFactory: ComponentFactory<PluginUnit>
   public minimisedPlugins$: Observable<Set<string>>
 
@@ -38,12 +44,13 @@ export class PluginServices {
   public fetch: (url: string, httpOption?: any) => Promise<any> = (url, httpOption = {}) => this.http.get(url, httpOption).toPromise()
 
   constructor(
-    private constantService: AtlasViewerConstantsServices,
     private widgetService: WidgetServices,
     private cfr: ComponentFactoryResolver,
     private store: Store<IavRootStoreInterface>,
     private http: HttpClient,
     private log: LoggingService,
+    @Inject(APPEND_SCRIPT_TOKEN) private appendSrc: (src: string) => Promise<HTMLScriptElement>,
+    @Inject(REMOVE_SCRIPT_TOKEN) private removeSrc: (src: HTMLScriptElement) => void,
   ) {
 
     // TODO implement
@@ -58,46 +65,36 @@ export class PluginServices {
     /**
      * TODO convert to rxjs streams, instead of Promise.all
      */
-    const promiseFetchedPluginManifests: Promise<IPluginManifest[]> = new Promise((resolve, reject) => {
-      Promise.all([
-        // TODO convert to use this.fetch
-        PLUGINDEV
-          ? fetch(PLUGINDEV, this.constantService.getFetchOption()).then(res => res.json())
-          : Promise.resolve([]),
-        new Promise(rs => {
-          fetch(`${this.constantService.backendUrl}plugins`, this.constantService.getFetchOption())
-            .then(res => res.json())
-            .then(arr => Promise.all(
-              arr.map(url => new Promise(rs2 =>
-                /**
-                 * instead of failing all promises when fetching manifests, only fail those that fails to fetch
-                 */
-                fetch(url, this.constantService.getFetchOption()).then(res => res.json()).then(rs2).catch(e => (this.log.log('fetching manifest error', e), rs2(null)))),
-              ),
-            ))
-            .then(manifests => rs(
-              manifests.filter(m => !!m),
-            ))
-            .catch(e => {
-              this.constantService.catchError(e)
-              rs([])
-            })
-        }),
-        Promise.all(
-          BUNDLEDPLUGINS
-            .filter(v => typeof v === 'string')
-            .map(v => fetch(`res/plugin_examples/${v}/manifest.json`, this.constantService.getFetchOption()).then(res => res.json())),
+
+    const pluginUrl = `${BACKENDURL.replace(/\/$/,'')}/plugins`
+    const streamFetchedManifests$ = this.http.get(pluginUrl,{
+      responseType: 'json',
+      headers: getHttpHeader(),
+    }).pipe(
+      switchMap((arr: string[]) => {
+        return zip(
+          ...arr.map(url => this.http.get(url, {
+            responseType: 'json',
+            headers: getHttpHeader()
+          }).pipe(
+            catchError((err, caught) => of(null))
+          ))
+        ).pipe(
+          map(arr => arr.filter(v => !!v))
         )
-          .then(arr => arr.reduce((acc, curr) => acc.concat(curr) , [])),
-      ])
-        .then(arr => resolve( [].concat(arr[0]).concat(arr[1]) ))
-        .catch(reject)
-    })
+      })
+    )
 
-    promiseFetchedPluginManifests
-      .then(arr =>
-        this.fetchedPluginManifests = arr)
-      .catch(this.log.error)
+    streamFetchedManifests$.subscribe(
+      arr => {
+        this.fetchedPluginManifests = arr
+        this.log.log(this.fetchedPluginManifests)
+      },
+      this.log.error,
+      () => {
+        this.log.log(`fetching end`)
+      }
+    )
 
     this.minimisedPlugins$ = merge(
       of(new Set()),
@@ -193,7 +190,7 @@ export class PluginServices {
     this.addPluginToIsLaunchingSet(plugin.name)
 
     return this.readyPlugin(plugin)
-      .then(() => {
+      .then(async () => {
         const pluginUnit = this.pluginViewContainerRef.createComponent( this.pluginUnitFactory )
         /* TODO in v0.2, I used:
 
@@ -242,11 +239,8 @@ export class PluginServices {
           shutdownCB.push(cb)
         }
 
-        const script = document.createElement('script')
-        script.src = plugin.scriptURL
-
-        this.appendSrc(script)
-        handler.onShutdown(() => this.removeSrc(script))
+        const scriptEl = await this.appendSrc(plugin.scriptURL)
+        handler.onShutdown(() => this.removeSrc(scriptEl))
 
         const template = document.createElement('div')
         template.insertAdjacentHTML('afterbegin', plugin.template)
diff --git a/src/atlasViewer/pluginUnit/plugin.module.ts b/src/atlasViewer/pluginUnit/plugin.module.ts
index 88198bfe685c2613faee04332ae417ffd6e9ee1c..12763521faa0539bdf7eb38d7b275eba8263dcb7 100644
--- a/src/atlasViewer/pluginUnit/plugin.module.ts
+++ b/src/atlasViewer/pluginUnit/plugin.module.ts
@@ -1,8 +1,10 @@
 import { NgModule } from "@angular/core";
 import { PluginUnit } from "./pluginUnit.component";
-import { PluginServices } from "./atlasViewer.pluginService.service";
-import { PluginFactoryDirective } from "./pluginFactory.directive";
+import { PluginServices, registerPluginFactoryDirectiveFactory } from "./atlasViewer.pluginService.service";
+import { PluginFactoryDirective, REGISTER_PLUGIN_FACTORY_DIRECTIVE } from "./pluginFactory.directive";
 import { LoggingModule } from "src/logging";
+import { APPEND_SCRIPT_TOKEN, appendScriptFactory, REMOVE_SCRIPT_TOKEN, removeScriptFactory } from "src/util/constants";
+import { DOCUMENT } from "@angular/common";
 
 @NgModule({
   imports:[
@@ -20,7 +22,22 @@ import { LoggingModule } from "src/logging";
     PluginFactoryDirective
   ],
   providers: [
-    PluginServices
+    PluginServices,
+    {
+      provide: REGISTER_PLUGIN_FACTORY_DIRECTIVE,
+      useFactory: registerPluginFactoryDirectiveFactory,
+      deps: [ PluginServices ]
+    },
+    {
+      provide: APPEND_SCRIPT_TOKEN,
+      useFactory: appendScriptFactory,
+      deps: [ DOCUMENT ]
+    },
+    {
+      provide: REMOVE_SCRIPT_TOKEN,
+      useFactory: removeScriptFactory,
+      deps: [ DOCUMENT ]
+    },
   ]
 })
 
diff --git a/src/atlasViewer/pluginUnit/pluginFactory.directive.spec.ts b/src/atlasViewer/pluginUnit/pluginFactory.directive.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..29d723d972543473d647354c82dd829dfaa4dda3
--- /dev/null
+++ b/src/atlasViewer/pluginUnit/pluginFactory.directive.spec.ts
@@ -0,0 +1,133 @@
+import { async, TestBed } from "@angular/core/testing"
+import { PluginFactoryDirective, REGISTER_PLUGIN_FACTORY_DIRECTIVE } from "./pluginFactory.directive"
+import { Component, ViewChild } from "@angular/core"
+import { APPEND_SCRIPT_TOKEN, REMOVE_SCRIPT_TOKEN } from "src/util/constants"
+import { By } from "@angular/platform-browser"
+
+@Component({
+  template: '<div></div>'
+})
+class TestCmp{
+
+  @ViewChild(PluginFactoryDirective) pfd: PluginFactoryDirective
+}
+
+const dummyObj1 = {}
+const dummyObj2 = {}
+const appendSrcSpy = jasmine.createSpy('appendSrc').and.returnValues(
+  Promise.resolve(dummyObj1),
+  Promise.resolve(dummyObj2)
+)
+const removeSrcSpy = jasmine.createSpy('removeScript')
+const registerSpy = jasmine.createSpy('registerSpy')
+
+describe(`> pluginFactory.directive.ts`, () => {
+  describe(`> PluginFactoryDirective`, () => {
+
+    beforeEach(async(() => {
+      TestBed.configureTestingModule({
+        declarations: [
+          PluginFactoryDirective,
+          TestCmp
+        ],
+        providers: [
+          {
+            provide: APPEND_SCRIPT_TOKEN,
+            useValue: appendSrcSpy
+          },
+          {
+            provide: REMOVE_SCRIPT_TOKEN,
+            useValue: removeSrcSpy
+          },
+          {
+            provide: REGISTER_PLUGIN_FACTORY_DIRECTIVE,
+            useValue: registerSpy
+          }
+        ]
+      }).overrideComponent(TestCmp, {
+        set: {
+          template: `<div pluginFactoryDirective></div>`
+        }
+      }).compileComponents()
+    }))
+
+    afterEach(() => {
+      appendSrcSpy.calls.reset()
+      removeSrcSpy.calls.reset()
+      registerSpy.calls.reset()
+    })
+
+    it('> creates directive', () => {
+      const fixture = TestBed.createComponent(TestCmp)
+      fixture.detectChanges()
+
+      const queriedDirective = fixture.debugElement.query( By.directive(PluginFactoryDirective) )
+      expect(queriedDirective).toBeTruthy()
+    })
+
+    it('> register spy is called', () => {
+      
+      const fixture = TestBed.createComponent(TestCmp)
+      fixture.detectChanges()
+      expect(registerSpy).toHaveBeenCalledWith(fixture.componentInstance.pfd)
+    })
+
+    describe('> loading external libraries', () => {
+      it('> load once, call append script', async () => {
+        const fixture = TestBed.createComponent(TestCmp)
+        fixture.detectChanges()
+        const pfd = fixture.componentInstance.pfd
+        await pfd.loadExternalLibraries(['vue@2.5.16'])
+        expect(appendSrcSpy).toHaveBeenCalledWith('https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js')
+        expect(appendSrcSpy).toHaveBeenCalledTimes(1)
+      })
+
+      it('> load twice, called append script once', async () => {
+        const fixture = TestBed.createComponent(TestCmp)
+        fixture.detectChanges()
+        const pfd = fixture.componentInstance.pfd
+        await pfd.loadExternalLibraries(['vue@2.5.16'])
+        await pfd.loadExternalLibraries(['vue@2.5.16'])
+        expect(appendSrcSpy).toHaveBeenCalledWith('https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js')
+        expect(appendSrcSpy).toHaveBeenCalledTimes(1)
+      })
+
+      it('> load unload, call remove script once', async () => {
+        
+        const fixture = TestBed.createComponent(TestCmp)
+        fixture.detectChanges()
+        const pfd = fixture.componentInstance.pfd
+        await pfd.loadExternalLibraries(['vue@2.5.16'])
+        pfd.unloadExternalLibraries(['vue@2.5.16'])
+        expect(removeSrcSpy).toHaveBeenCalledTimes(1)
+      })
+
+      it('> load twice, unload, does not call remove', async () => {
+
+        const fixture = TestBed.createComponent(TestCmp)
+        fixture.detectChanges()
+        const pfd = fixture.componentInstance.pfd
+        await pfd.loadExternalLibraries(['vue@2.5.16'])
+        await pfd.loadExternalLibraries(['vue@2.5.16'])
+        pfd.unloadExternalLibraries(['vue@2.5.16'])
+        expect(removeSrcSpy).not.toHaveBeenCalled()
+      })
+
+      it('> load, unload, load, call append script twice', async () => {
+        
+        const fixture = TestBed.createComponent(TestCmp)
+        fixture.detectChanges()
+        const pfd = fixture.componentInstance.pfd
+        await pfd.loadExternalLibraries(['vue@2.5.16'])
+        pfd.unloadExternalLibraries(['vue@2.5.16'])
+
+        appendSrcSpy.calls.reset()
+        expect(appendSrcSpy).not.toHaveBeenCalled()
+
+        await pfd.loadExternalLibraries(['vue@2.5.16'])
+        pfd.unloadExternalLibraries(['vue@2.5.16'])
+        expect(appendSrcSpy).toHaveBeenCalledTimes(1)
+      })
+    })
+  })
+})
\ No newline at end of file
diff --git a/src/atlasViewer/pluginUnit/pluginFactory.directive.ts b/src/atlasViewer/pluginUnit/pluginFactory.directive.ts
index 65081f45eb78a0506b9997b171975f7026c31cb1..fbc76ac7bf830258620539a0301a4cac71778713 100644
--- a/src/atlasViewer/pluginUnit/pluginFactory.directive.ts
+++ b/src/atlasViewer/pluginUnit/pluginFactory.directive.ts
@@ -1,7 +1,44 @@
-import { Directive, Renderer2, ViewContainerRef } from "@angular/core";
-import { SUPPORT_LIBRARY_MAP } from "src/atlasViewer/atlasViewer.constantService.service";
-import { PluginServices } from "./atlasViewer.pluginService.service";
-import { LoggingService } from "src/logging";
+import { Directive, ViewContainerRef, Inject, Optional } from "@angular/core";
+import { APPEND_SCRIPT_TOKEN, REMOVE_SCRIPT_TOKEN } from "src/util/constants";
+
+export const SUPPORT_LIBRARY_MAP: Map<string, Map<string, string>> = new Map([
+  ['jquery', new Map<string, string>([
+    ['3', 'https://code.jquery.com/jquery-3.3.1.min.js'],
+    ['2', 'https://code.jquery.com/jquery-2.2.4.min.js']
+  ])],
+  ['webcomponentsLite', new Map([
+    ['1.1.0', 'https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.1.0/webcomponents-lite.js']
+  ])],
+  ['react', new Map([
+    ['16', 'https://unpkg.com/react@16/umd/react.development.js']
+  ])],
+  ['reactdom', new Map([
+    ['16', 'https://unpkg.com/react-dom@16/umd/react-dom.development.js']
+  ])],
+  ['vue', new Map([
+    ['2.5.16', 'https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js']
+  ])],
+  ['preact', new Map([
+    ['8.4.2', 'https://cdn.jsdelivr.net/npm/preact@8.4.2/dist/preact.min.js']
+  ])],
+  ['d3', new Map([
+    ['5.7.0', 'https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js']
+  ])],
+])
+
+export const parseLibrary = (libVer: string) => {
+  const re = /^([a-zA-Z0-9]+)@([0-9.]+)$/.exec(libVer)
+  if (!re) throw new Error(`${libVer} cannot be parsed properly`)
+  const lib = re[1]
+  const ver = re[2]
+  const libMap = SUPPORT_LIBRARY_MAP.get(lib) 
+  if (!libMap) throw new Error(`${lib} not supported. Only supported libraries are ${Array.from(SUPPORT_LIBRARY_MAP.keys())}`)
+  const src = libMap.get(ver)
+  if (!src) throw new Error(`${lib} version ${ver} not supported. Only supports ${Array.from(libMap.keys())}`)
+  return src
+}
+
+export const REGISTER_PLUGIN_FACTORY_DIRECTIVE = `REGISTER_PLUGIN_FACTORY_DIRECTIVE`
 
 @Directive({
   selector: '[pluginFactoryDirective]',
@@ -9,72 +46,53 @@ import { LoggingService } from "src/logging";
 
 export class PluginFactoryDirective {
   constructor(
-    pluginService: PluginServices,
-    viewContainerRef: ViewContainerRef,
-    private rd2: Renderer2,
-    private log: LoggingService,
+    public viewContainerRef: ViewContainerRef,
+    @Optional() @Inject(REGISTER_PLUGIN_FACTORY_DIRECTIVE) registerPluginFactoryDirective: (directive: PluginFactoryDirective) => void,
+    @Inject(APPEND_SCRIPT_TOKEN) private appendScript: (src: string) => Promise<HTMLScriptElement>,
+    @Inject(REMOVE_SCRIPT_TOKEN) private removeScript: (srcEl: HTMLScriptElement) => void,
   ) {
-    pluginService.loadExternalLibraries = this.loadExternalLibraries.bind(this)
-    pluginService.unloadExternalLibraries = this.unloadExternalLibraries.bind(this)
-    pluginService.pluginViewContainerRef = viewContainerRef
-    pluginService.appendSrc = (src: HTMLElement) => rd2.appendChild(document.head, src)
-    pluginService.removeSrc = (src: HTMLElement) => rd2.removeChild(document.head, src)
+    if (registerPluginFactoryDirective) {
+      registerPluginFactoryDirective(this)
+    }
   }
 
-  private loadedLibraries: Map<string, {counter: number, src: HTMLElement|null}> = new Map()
+  private loadedLibraries: Map<string, {counter: number, srcEl: HTMLScriptElement|null}> = new Map()
   
-  loadExternalLibraries(libraries: string[]) {
-    const srcHTMLElement = libraries.map(libraryName => ({
-      name: libraryName,
-      srcEl: SUPPORT_LIBRARY_MAP.get(libraryName),
-    }))
+  async loadExternalLibraries(libraries: string[]) {
+    const libsToBeLoaded = libraries.map(libName => {
+      return {
+        libName,
+        libSrc: parseLibrary(libName),
+      }
+    })
 
-    const rejected = srcHTMLElement.filter(scriptObj => scriptObj.srcEl === null)
-    if (rejected.length > 0) {
-      return Promise.reject(`Some library names cannot be recognised. No libraries were loaded: ${rejected.map(srcObj => srcObj.name).join(', ')}`)
-    }
+    for (const libToBeLoaded of libsToBeLoaded) {
+  
+      const { libSrc, libName } = libToBeLoaded
 
-    return Promise.all(srcHTMLElement.map(scriptObj => new Promise((rs, rj) => {
-      /**
-       * if browser already support customElements, do not append polyfill
-       */
-      if ('customElements' in window && scriptObj.name === 'webcomponentsLite') {
-        return rs()
-      }
-      const existingEntry = this.loadedLibraries.get(scriptObj.name)
-      if (existingEntry) {
-        this.loadedLibraries.set(scriptObj.name, { counter: existingEntry.counter + 1, src: existingEntry.src })
-        rs()
-      } else {
-        const srcEl = scriptObj.srcEl
-        srcEl.onload = () => rs()
-        srcEl.onerror = (e: any) => rj(e)
-        this.rd2.appendChild(document.head, srcEl)
-        this.loadedLibraries.set(scriptObj.name, { counter: 1, src: srcEl })
+      // if browser natively support custom element, do not append polyfill
+      if ('customElements' in window && /^webcomponentsLite@/.test(libName)) continue
+
+      let srcEl
+      const { counter, srcEl: srcElOld } = this.loadedLibraries.get(libName) || { counter: 0 }
+      if (counter === 0) {
+
+        // slight performance penalty not loading external libraries in parallel, but this should be an edge case any way
+        srcEl = await this.appendScript(libSrc)
       }
-    })))
+      this.loadedLibraries.set(libName, { counter: counter + 1, srcEl: srcEl || srcElOld })
+    }
   }
 
   unloadExternalLibraries(libraries: string[]) {
-    libraries
-      .filter((stringname) => SUPPORT_LIBRARY_MAP.get(stringname) !== null)
-      .forEach(libname => {
-        const ledger = this.loadedLibraries.get(libname)
-        if (!ledger) {
-          this.log.warn('unload external libraries error. cannot find ledger entry...', libname, this.loadedLibraries)
-          return
-        }
-        if (ledger.src === null) {
-          this.log.log('webcomponents is native supported. no library needs to be unloaded')
-          return
-        }
-
-        if (ledger.counter - 1 == 0) {
-          this.rd2.removeChild(document.head, ledger.src)
-          this.loadedLibraries.delete(libname)
-        } else {
-          this.loadedLibraries.set(libname, { counter: ledger.counter - 1, src: ledger.src })
-        }
-      })
+    for (const lib of libraries) {
+      const { counter, srcEl } = this.loadedLibraries.get(lib) || { counter: 0 }
+      if (counter > 1) {
+        this.loadedLibraries.set(lib, { counter: counter - 1, srcEl })
+      } else {
+        this.loadedLibraries.set(lib, { counter: 0, srcEl: null })
+        this.removeScript(srcEl)
+      }
+    }
   }
 }
diff --git a/src/auth/auth.directive.ts b/src/auth/auth.directive.ts
new file mode 100644
index 0000000000000000000000000000000000000000..982a57b3d0a82945c38079b5bcd21dde0ff2cfc7
--- /dev/null
+++ b/src/auth/auth.directive.ts
@@ -0,0 +1,18 @@
+import { Directive } from "@angular/core";
+import { Observable } from "rxjs";
+import { IUser, AuthService } from './auth.service'
+
+@Directive({
+  selector: '[iav-auth-authState]',
+  exportAs: 'iavAuthAuthState'
+})
+
+export class AuthStateDdirective{
+  public user$: Observable<IUser>
+
+  constructor(
+    private authService: AuthService,
+  ){
+    this.user$ = this.authService.user$
+  }
+}
diff --git a/src/auth/auth.module.ts b/src/auth/auth.module.ts
new file mode 100644
index 0000000000000000000000000000000000000000..bbd75a8416c27588a1f92ec6fbabc3258ad1ef2f
--- /dev/null
+++ b/src/auth/auth.module.ts
@@ -0,0 +1,26 @@
+import { NgModule } from "@angular/core";
+import { SigninModal } from "./signinModal/signinModal.component";
+import { CommonModule } from "@angular/common";
+import { AngularMaterialModule } from "src/ui/sharedModules/angularMaterial.module";
+import { AuthService } from "./auth.service";
+import { AuthStateDdirective } from "./auth.directive";
+
+@NgModule({
+  imports: [
+    CommonModule,
+    AngularMaterialModule,
+  ],
+  declarations: [
+    SigninModal,
+    AuthStateDdirective,
+  ],
+  exports: [
+    SigninModal,
+    AuthStateDdirective,
+  ],
+  providers: [
+    AuthService,
+  ]
+})
+
+export class AuthModule{}
diff --git a/src/services/auth.service.ts b/src/auth/auth.service.ts
similarity index 95%
rename from src/services/auth.service.ts
rename to src/auth/auth.service.ts
index fdec1e6ef5ec008b4d4bb01f8a3897ff4c482934..12720ca923e6bd1399deeaecdd8475f5ef9c400e 100644
--- a/src/services/auth.service.ts
+++ b/src/auth/auth.service.ts
@@ -1,7 +1,7 @@
 import { HttpClient } from "@angular/common/http";
 import { Injectable, OnDestroy } from "@angular/core";
 import { Observable, of, Subscription } from "rxjs";
-import { catchError, shareReplay } from "rxjs/operators";
+import { catchError, shareReplay, mapTo } from "rxjs/operators";
 
 const IV_REDIRECT_TOKEN = `IV_REDIRECT_TOKEN`
 
diff --git a/src/auth/index.ts b/src/auth/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..25b4f9e47d6ff10ed8656f58c437b8cd2f901b9c
--- /dev/null
+++ b/src/auth/index.ts
@@ -0,0 +1,2 @@
+export { AuthModule } from './auth.module'
+export { AuthService } from './auth.service'
\ No newline at end of file
diff --git a/src/ui/signinModal/signinModal.component.ts b/src/auth/signinModal/signinModal.component.ts
similarity index 88%
rename from src/ui/signinModal/signinModal.component.ts
rename to src/auth/signinModal/signinModal.component.ts
index c05a1e81efe659e49d9ee8e74f5dcea77cfbe9e1..5cb7ba7424b2c6eab2e93ef40aeaf750fac97c25 100644
--- a/src/ui/signinModal/signinModal.component.ts
+++ b/src/auth/signinModal/signinModal.component.ts
@@ -1,5 +1,5 @@
 import { Component } from "@angular/core";
-import { AuthService, IAuthMethod, IUser } from "src/services/auth.service";
+import { AuthService, IAuthMethod, IUser } from "../auth.service";
 
 @Component({
   selector: 'signin-modal',
diff --git a/src/ui/signinModal/signinModal.style.css b/src/auth/signinModal/signinModal.style.css
similarity index 100%
rename from src/ui/signinModal/signinModal.style.css
rename to src/auth/signinModal/signinModal.style.css
diff --git a/src/ui/signinModal/signinModal.template.html b/src/auth/signinModal/signinModal.template.html
similarity index 100%
rename from src/ui/signinModal/signinModal.template.html
rename to src/auth/signinModal/signinModal.template.html
diff --git a/src/components/components.module.ts b/src/components/components.module.ts
index c16f932a5fd11f5e613bbef20b1fdd54f65f8090..f6cdb091c4c747339f237e97f00a4d5c72985ae7 100644
--- a/src/components/components.module.ts
+++ b/src/components/components.module.ts
@@ -31,6 +31,7 @@ import { SleightOfHand } from './sleightOfHand/soh.component';
 import { TimerComponent } from './timer/timer.component';
 import { TreeComponent } from './tree/tree.component';
 import { TreeBaseDirective } from './tree/treeBase.directive';
+import { IAVVerticalButton } from './vButton/vButton.component';
 
 @NgModule({
   imports : [
@@ -56,6 +57,7 @@ import { TreeBaseDirective } from './tree/treeBase.directive';
     SleightOfHand,
     DialogComponent,
     ConfirmDialogComponent,
+    IAVVerticalButton,
 
     /* directive */
     HoverableBlockDirective,
@@ -88,6 +90,7 @@ import { TreeBaseDirective } from './tree/treeBase.directive';
     SleightOfHand,
     DialogComponent,
     ConfirmDialogComponent,
+    IAVVerticalButton,
 
     SearchResultPaginationPipe,
     TreeSearchPipe,
diff --git a/src/components/fabSpeedDial/fabSpeedDial.module.ts b/src/components/fabSpeedDial/fabSpeedDial.module.ts
new file mode 100644
index 0000000000000000000000000000000000000000..4800d906fd216aea4518d40f7a77eaebda5e5944
--- /dev/null
+++ b/src/components/fabSpeedDial/fabSpeedDial.module.ts
@@ -0,0 +1,23 @@
+import { NgModule } from "@angular/core";
+import { FabSpeedDialChild } from "./fabSpeedDialChild.directive";
+import { FabSpeedDialContainer } from "./fabSpeedDialContainer.directive";
+import { FabSpeedDialTrigger } from "./fabSpeedDialTrigger.directive";
+import { CommonModule } from "@angular/common";
+
+@NgModule({
+  imports: [
+    CommonModule
+  ],
+  declarations: [
+    FabSpeedDialChild,
+    FabSpeedDialContainer,
+    FabSpeedDialTrigger
+  ],
+  exports: [
+    FabSpeedDialChild,
+    FabSpeedDialContainer,
+    FabSpeedDialTrigger
+  ]
+})
+
+export class FabSpeedDialModule{}
diff --git a/src/components/fabSpeedDial/fabSpeedDial.service.spec.ts b/src/components/fabSpeedDial/fabSpeedDial.service.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e040ccd4b161ac0478f73f40efddd9dfc72a7e37
--- /dev/null
+++ b/src/components/fabSpeedDial/fabSpeedDial.service.spec.ts
@@ -0,0 +1,35 @@
+import { FabSpeedDialService } from './fabSpeedDial.service'
+
+describe('FabSpeedDialService', () => {
+  let service: FabSpeedDialService
+  let openStateNextSpy: jasmine.Spy
+
+  beforeEach(() => {
+    service = new FabSpeedDialService()
+    openStateNextSpy = spyOn(service.openState$, 'next').and.callThrough()
+  })
+
+  it('can be instantiated', () => {
+    expect(service).not.toBeNull()
+  })
+
+  it('toggle calls openState$.next', () => {
+    const isOpen = service.isOpen
+    service.toggle()
+    expect(openStateNextSpy).toHaveBeenCalledWith(!isOpen)
+    expect(service.isOpen).toEqual(!isOpen)
+  })
+
+  it('close calls openState$.next', () => {
+    service.close()
+    expect(openStateNextSpy).toHaveBeenCalledWith(false)
+    expect(service.isOpen).toEqual(false)
+  })
+
+  it('open calls openState$.next', () => {
+    service.open()
+    expect(openStateNextSpy).toHaveBeenCalledWith(true)
+    expect(service.isOpen).toEqual(true)
+  })
+  
+})
\ No newline at end of file
diff --git a/src/components/fabSpeedDial/fabSpeedDial.service.ts b/src/components/fabSpeedDial/fabSpeedDial.service.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6c7d8b69c54dd35a441c26cbb3ca5fb3dbb2809d
--- /dev/null
+++ b/src/components/fabSpeedDial/fabSpeedDial.service.ts
@@ -0,0 +1,43 @@
+import { Injectable, OnDestroy } from "@angular/core";
+import { BehaviorSubject, Subscription } from "rxjs";
+
+export enum SCALE_ORIGIN {
+  LEFT = 'left',
+  RIGHT = 'right',
+  TOP = 'top',
+  BOTTOM = 'bottom',
+  CENTER = 'center',
+}
+
+@Injectable()
+export class FabSpeedDialService implements OnDestroy{
+  public openState$ = new BehaviorSubject(false)
+  public scaleOrigin$: BehaviorSubject<SCALE_ORIGIN> = new BehaviorSubject(SCALE_ORIGIN.CENTER)
+  private s: Subscription[] = []
+
+  public isOpen: boolean = false
+
+  constructor(){
+    this.s.push(
+      this.openState$.subscribe(flag => this.isOpen = flag)
+    )
+  }
+
+  ngOnDestroy(){
+    while(this.s.length > 0) {
+      this.s.pop().unsubscribe()
+    }
+  }
+
+  toggle(){
+    this.openState$.next(!this.isOpen)
+  }
+
+  close(){
+    this.openState$.next(false)
+  }
+
+  open(){
+    this.openState$.next(true)
+  }
+}
\ No newline at end of file
diff --git a/src/components/fabSpeedDial/fabSpeedDialChild.directive.spec.ts b/src/components/fabSpeedDial/fabSpeedDialChild.directive.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..093476555c601f25c4471d853a99b64ad617ba2e
--- /dev/null
+++ b/src/components/fabSpeedDial/fabSpeedDialChild.directive.spec.ts
@@ -0,0 +1,103 @@
+import { Component } from "@angular/core";
+import { TestBed, fakeAsync } from "@angular/core/testing";
+import { CommonModule } from "@angular/common";
+import { By } from "@angular/platform-browser";
+import { FabSpeedDialService } from "./fabSpeedDial.service";
+import { FabSpeedDialChild } from "./fabSpeedDialChild.directive";
+import { of, BehaviorSubject } from "rxjs";
+
+@Component({
+  template: ''
+})
+
+class TestCmp{}
+
+describe('FabSpeedDialTrigger', () => {
+
+  let openState$: BehaviorSubject<boolean>
+  beforeEach(() => {
+    openState$ = new BehaviorSubject(false)
+    const fabServiceFactory = () => {
+      
+      return {
+        openState$,
+        scaleOrigin$: of('center')
+      }
+    }
+
+    TestBed.configureTestingModule({
+      imports: [
+        CommonModule
+      ],
+      declarations: [
+        FabSpeedDialChild,
+        TestCmp,
+      ],
+      providers: [
+        {
+          provide: FabSpeedDialService,
+          useFactory: fabServiceFactory
+        }
+      ]
+    })
+  })
+
+  it('should instantiate directive', () => {
+
+    TestBed.overrideComponent(TestCmp, {
+      set: {
+        template: `
+          <div iav-fab-speed-dial-child>
+            Test
+          </div>
+        `
+      }
+    }).compileComponents()
+
+    const fixture = TestBed.createComponent(TestCmp)
+    const directive = fixture.debugElement.query( By.directive( FabSpeedDialChild ) )
+    expect(directive).not.toBeNull()
+  })
+
+  it('oninit, should be closed', fakeAsync(() => {
+    TestBed.overrideComponent(TestCmp, {
+      set: {
+        template: `
+          <div iav-fab-speed-dial-child>
+            Test
+          </div>
+        `
+      }
+    }).compileComponents()
+
+    const fixture = TestBed.createComponent(TestCmp)
+    fixture.detectChanges()
+
+    const directive = fixture.debugElement.query( By.directive( FabSpeedDialChild ) )
+    expect(directive.nativeElement.style.transform).toEqual(`scale(0)`)
+  }))
+
+
+  it('should open/close on openState$ change', fakeAsync(() => {
+    TestBed.overrideComponent(TestCmp, {
+      set: {
+        template: `
+          <div iav-fab-speed-dial-child>
+            Test
+          </div>
+        `
+      }
+    }).compileComponents()
+
+    const fixture = TestBed.createComponent(TestCmp)
+    fixture.detectChanges()
+
+    const directive = fixture.debugElement.query( By.directive( FabSpeedDialChild ) )
+    
+    openState$.next(true)
+    fixture.detectChanges()
+    
+    expect(directive.nativeElement.style.transform).toEqual(`scale(1)`)
+
+  }))
+})
\ No newline at end of file
diff --git a/src/components/fabSpeedDial/fabSpeedDialChild.directive.ts b/src/components/fabSpeedDial/fabSpeedDialChild.directive.ts
new file mode 100644
index 0000000000000000000000000000000000000000..9ca95ba4cab4422c08f9d0c948c58fd82ff4e681
--- /dev/null
+++ b/src/components/fabSpeedDial/fabSpeedDialChild.directive.ts
@@ -0,0 +1,55 @@
+import { Directive, Input, HostBinding, OnDestroy } from "@angular/core";
+import { Subscription } from "rxjs";
+import { FabSpeedDialService } from "./fabSpeedDial.service";
+
+const NORMAL = 150
+const MAX_CHANGE = 70
+const INDEX_FACTOR = 5
+
+@Directive({
+  selector: '[iav-fab-speed-dial-child]',
+  exportAs: 'iavFabSpeedDialChild'
+})
+
+export class FabSpeedDialChild implements OnDestroy{
+
+  private s: Subscription[] = []
+
+  constructor(private fabService: FabSpeedDialService){
+    this.s.push(
+      this.fabService.openState$.subscribe(flag => {
+        this.quickDialOpening(flag)
+      }),
+      this.fabService.scaleOrigin$.subscribe(origin => {
+        this.transformOrigin = origin
+      })
+    )
+  }
+  ngOnDestroy(){
+    while(this.s.length > 0) {
+      this.s.pop().unsubscribe()
+    }
+  }
+  
+  @Input('iav-fab-speed-dial-child-index')
+  public index: number = 0
+
+  quickDialOpening(flag){
+    const _index = Number(this.index)
+    const delta = Math.atan(_index * INDEX_FACTOR) / (Math.PI / 2) * MAX_CHANGE
+    this.transitionDelay = flag ? `${delta}ms` : `${MAX_CHANGE - delta}ms`
+    this.transformProp = `scale(${flag ? 1 : 0})`
+  }
+
+  @HostBinding('style.transitionDelay')
+  transitionDelay = '0'
+
+  @HostBinding('style.transition')
+  transitionProp = `all ${NORMAL}ms linear`
+
+  @HostBinding('style.transform')
+  transformProp = `scale(0)`
+
+  @HostBinding('style.transformOrigin')
+  transformOrigin = 'center'
+}
diff --git a/src/components/fabSpeedDial/fabSpeedDialContainer.directive.spec.ts b/src/components/fabSpeedDial/fabSpeedDialContainer.directive.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e370a18b7d28c1fb0843b8610accec1bc60808d4
--- /dev/null
+++ b/src/components/fabSpeedDial/fabSpeedDialContainer.directive.spec.ts
@@ -0,0 +1,162 @@
+import { Component } from "@angular/core";
+import { TestBed } from "@angular/core/testing";
+import { FabSpeedDialContainer } from "./fabSpeedDialContainer.directive";
+import { FabSpeedDialService, SCALE_ORIGIN } from "./fabSpeedDial.service";
+import { BehaviorSubject } from "rxjs";
+import { By } from "@angular/platform-browser";
+
+@Component({
+  template: ``
+})
+
+class TestCmp{
+  public origin = 'center'
+}
+
+const dummyServiceFactory = () => {
+  return {
+    toggle: jasmine.createSpy('toggle'),
+    close: jasmine.createSpy('close'),
+    open: jasmine.createSpy('open'),
+    scaleOrigin$: new BehaviorSubject('center'),
+    openState$: new BehaviorSubject(false)
+  }
+}
+
+describe('FabSpeedDialContainer', () => {
+  beforeEach(() => {
+    TestBed.configureTestingModule({
+      imports: [ ],
+      declarations: [
+        TestCmp,
+        FabSpeedDialContainer,
+      ],
+      providers: [
+        {
+          provide:FabSpeedDialService,
+          useFactory: dummyServiceFactory,
+        }
+      ]
+    }).overrideDirective(FabSpeedDialContainer, {
+
+      /**
+       * normally, FabSpeedDialContainer provides its own FabSpeedDialService
+       * in tests, override, and provide on a module level
+       */
+      set: {
+        providers: [],
+      }
+    }).overrideComponent(TestCmp, {
+      set: {
+        template: `
+        <div iav-fab-speed-dial-container
+          [iav-fab-speed-dial-scale-origin]="origin">
+        </div>
+        `
+      }
+    })
+  })
+
+  it('should be able to instantiate', () => {
+    TestBed.compileComponents()
+
+    const fixture = TestBed.createComponent(TestCmp)
+    const directive = fixture.debugElement.query( By.directive(FabSpeedDialContainer) )
+    expect(directive).not.toBeNull()
+  })
+
+  it('directive methods should call spy methods', () => {
+
+    TestBed.compileComponents()
+
+    const fixture = TestBed.createComponent(TestCmp)
+    const directive = fixture.debugElement.query( By.directive(FabSpeedDialContainer) )
+    const directiveInstance = directive.injector.get(FabSpeedDialContainer)
+    
+    const serviceInstance = TestBed.inject(FabSpeedDialService)
+
+    directiveInstance.toggle()
+    expect(serviceInstance.toggle).toHaveBeenCalled()
+
+    directiveInstance.close()
+    expect(serviceInstance.close).toHaveBeenCalled()
+    
+    directiveInstance.open()
+    expect(serviceInstance.open).toHaveBeenCalled()
+  })
+
+  it('on change, if valid, expect next to be called', () => {
+    TestBed.compileComponents()
+
+    const fixture = TestBed.createComponent(TestCmp)
+    const dummyService = TestBed.inject(FabSpeedDialService)
+
+    const scaleOriginNextSpy = spyOn(dummyService.scaleOrigin$, 'next').and.callThrough()
+    fixture.componentInstance.origin = 'right'
+    fixture.detectChanges()
+    expect(scaleOriginNextSpy).toHaveBeenCalledWith(SCALE_ORIGIN.RIGHT)
+  })
+
+  it('on change, if invalid, expect next to not be called', () => {
+
+    TestBed.compileComponents()
+
+    const fixture = TestBed.createComponent(TestCmp)
+    const dummyService = TestBed.inject(FabSpeedDialService)
+    
+    const scaleOriginNextSpy = spyOn(dummyService.scaleOrigin$, 'next').and.callThrough()
+    fixture.componentInstance.origin = 'bananas'
+    fixture.detectChanges()
+    expect(scaleOriginNextSpy).not.toHaveBeenCalled()
+  })
+
+  it('on openstate change, prop isOpen is set', () => {
+
+    TestBed.compileComponents()
+
+    const fixture = TestBed.createComponent(TestCmp)
+    const directive = fixture.debugElement.query( By.directive(FabSpeedDialContainer) )
+    const directiveInstance = directive.injector.get(FabSpeedDialContainer)
+    
+    const serviceInstance = TestBed.inject(FabSpeedDialService)
+
+    serviceInstance.openState$.next(true)
+    expect(directiveInstance.isOpen).toEqual(true)
+  })
+
+  it('on openstate change, openStatechanged emits', () => {
+
+    TestBed.compileComponents()
+
+    const fixture = TestBed.createComponent(TestCmp)
+    const directive = fixture.debugElement.query( By.directive(FabSpeedDialContainer) )
+    const directiveInstance = directive.injector.get(FabSpeedDialContainer)
+    
+    const serviceInstance = TestBed.inject(FabSpeedDialService)
+
+    const openStateChangedSpy = spyOn(directiveInstance.openStateChanged, 'emit').and.callThrough()
+
+    serviceInstance.openState$.next(true)
+
+    expect(openStateChangedSpy).toHaveBeenCalledWith(true)
+  })
+
+  it('on openstate change with same value, openStateChanged does not emit', () => {
+
+    TestBed.compileComponents()
+
+    const fixture = TestBed.createComponent(TestCmp)
+    const directive = fixture.debugElement.query( By.directive(FabSpeedDialContainer) )
+    const directiveInstance = directive.injector.get(FabSpeedDialContainer)
+    
+    const serviceInstance = TestBed.inject(FabSpeedDialService)
+
+    serviceInstance.openState$.next(true)
+
+    const openStateChangedSpy = spyOn(directiveInstance.openStateChanged, 'emit').and.callThrough()
+
+    serviceInstance.openState$.next(true)
+
+    expect(openStateChangedSpy).not.toHaveBeenCalled()
+  })
+})
\ No newline at end of file
diff --git a/src/components/fabSpeedDial/fabSpeedDialContainer.directive.ts b/src/components/fabSpeedDial/fabSpeedDialContainer.directive.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6a92ee873c1cee9c1e14f598da6f5f6ca0d08b37
--- /dev/null
+++ b/src/components/fabSpeedDial/fabSpeedDialContainer.directive.ts
@@ -0,0 +1,68 @@
+import { Directive, OnDestroy, Output, EventEmitter, Input, OnChanges, SimpleChanges, HostListener, ElementRef } from "@angular/core";
+import { FabSpeedDialService } from "./fabSpeedDial.service";
+import { Subscription } from "rxjs";
+import { SCALE_ORIGIN } from './fabSpeedDial.service'
+import { distinctUntilChanged } from "rxjs/operators";
+
+@Directive({
+  selector: '[iav-fab-speed-dial-container]',
+  exportAs: 'iavFabSpeedDialContainer',
+  providers: [
+    FabSpeedDialService
+  ]
+})
+
+export class FabSpeedDialContainer implements OnDestroy, OnChanges{
+
+  private s: Subscription[] = []
+  
+  public isOpen = false
+
+  @Input('iav-fab-speed-dial-scale-origin')
+  scaleOrigin = 'center'
+
+  private validOriginValues = Object.keys(SCALE_ORIGIN).map(key => SCALE_ORIGIN[key])
+
+  @Output()
+  openStateChanged: EventEmitter<boolean> =  new EventEmitter()
+
+  constructor(
+    private fabSDService: FabSpeedDialService,
+  ){
+
+    this.s.push(
+      this.fabSDService.openState$.pipe(
+        distinctUntilChanged()
+      ).subscribe(flag => {
+        this.isOpen = flag
+        this.openStateChanged.emit(this.isOpen)
+      })
+    )
+  }
+
+  ngOnChanges(changes: SimpleChanges) {
+    if (this.validOriginValues.includes(changes.scaleOrigin.currentValue)) {
+      this.fabSDService.scaleOrigin$.next(
+        changes.scaleOrigin.currentValue
+      )
+    }
+  }
+
+  ngOnDestroy(){
+    while(this.s.length > 0){
+      this.s.pop().unsubscribe()
+    }
+  }
+
+  toggle(){
+    this.fabSDService.toggle()
+  }
+
+  close(){
+    this.fabSDService.close()
+  }
+
+  open(){
+    this.fabSDService.open()
+  }
+}
diff --git a/src/components/fabSpeedDial/fabSpeedDialTrigger.directive.spec.ts b/src/components/fabSpeedDial/fabSpeedDialTrigger.directive.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..572ba8f4a88a3fe570b9ee58bd2ceacf14490b44
--- /dev/null
+++ b/src/components/fabSpeedDial/fabSpeedDialTrigger.directive.spec.ts
@@ -0,0 +1,73 @@
+import { Component } from "@angular/core";
+import { TestBed } from "@angular/core/testing";
+import { CommonModule } from "@angular/common";
+import { FabSpeedDialTrigger } from "./fabSpeedDialTrigger.directive";
+import { By } from "@angular/platform-browser";
+import { FabSpeedDialService } from "./fabSpeedDial.service";
+
+
+@Component({
+  template: ''
+})
+
+class TestCmp{}
+
+const mockFabService = {
+  toggle: jasmine.createSpy('toggle')
+}
+
+describe('FabSpeedDialTrigger', () => {
+
+  beforeEach(() => {
+    TestBed.configureTestingModule({
+      imports: [
+        CommonModule
+      ],
+      declarations: [
+        FabSpeedDialTrigger,
+        TestCmp,
+      ],
+      providers: [
+        {
+          provide: FabSpeedDialService,
+          useValue: mockFabService,
+        }
+      ]
+    })
+  })
+
+  it('should instantiate directive', () => {
+    TestBed.overrideComponent(TestCmp, {
+      set: {
+        template: `
+          <div iav-fab-speed-dial-trigger>
+            Test
+          </div>
+        `
+      }
+    }).compileComponents()
+
+    const fixture = TestBed.createComponent(TestCmp)
+    const directive = fixture.debugElement.query( By.directive( FabSpeedDialTrigger ) )
+    expect(directive).not.toBeNull()
+  })
+
+  it('onclick, should call toggle', () => {
+    TestBed.overrideComponent(TestCmp, {
+      set: {
+        template: `
+          <div iav-fab-speed-dial-trigger>
+            Test
+          </div>
+        `
+      }
+    }).compileComponents()
+
+    const fixture = TestBed.createComponent(TestCmp)
+    const directive = fixture.debugElement.query( By.directive( FabSpeedDialTrigger ) )
+    
+    directive.nativeElement.click()
+
+    expect(mockFabService.toggle).toHaveBeenCalled()
+  })
+})
\ No newline at end of file
diff --git a/src/components/fabSpeedDial/fabSpeedDialTrigger.directive.ts b/src/components/fabSpeedDial/fabSpeedDialTrigger.directive.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e7e51fc1c780da4a71f7202dbfc83753ec106e83
--- /dev/null
+++ b/src/components/fabSpeedDial/fabSpeedDialTrigger.directive.ts
@@ -0,0 +1,17 @@
+import { Directive, HostListener } from "@angular/core";
+import { FabSpeedDialService } from "./fabSpeedDial.service";
+
+@Directive({
+  selector: '[iav-fab-speed-dial-trigger]',
+  exportAs: 'iavFabSpeedDialTrigger'
+})
+
+export class FabSpeedDialTrigger{
+
+  constructor(private fabService: FabSpeedDialService ){}
+
+  @HostListener('click')
+  triggerClicked(){
+    this.fabService.toggle()
+  }
+}
diff --git a/src/components/fabSpeedDial/index.ts b/src/components/fabSpeedDial/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..7ef7972478b4669d36793f9c3d66e8a98c3209ba
--- /dev/null
+++ b/src/components/fabSpeedDial/index.ts
@@ -0,0 +1,4 @@
+export { FabSpeedDialModule } from './fabSpeedDial.module'
+export { FabSpeedDialChild } from './fabSpeedDialChild.directive'
+export { FabSpeedDialContainer } from './fabSpeedDialContainer.directive'
+export { FabSpeedDialTrigger } from './fabSpeedDialTrigger.directive'
diff --git a/src/components/vButton/vButton.component.ts b/src/components/vButton/vButton.component.ts
new file mode 100644
index 0000000000000000000000000000000000000000..63eda444bf09774fe0c3e3ffc25cd77fe5fbf4ac
--- /dev/null
+++ b/src/components/vButton/vButton.component.ts
@@ -0,0 +1,18 @@
+import { Component, Input, ChangeDetectionStrategy } from "@angular/core";
+
+@Component({
+  selector: 'iav-v-button',
+  templateUrl: './vButton.template.html',
+  styleUrls: [
+    './vButton.style.css'
+  ],
+  exportAs: 'iavVButton',
+  changeDetection: ChangeDetectionStrategy.OnPush
+})
+
+export class IAVVerticalButton{
+  @Input() color: 'default' | 'primary' | 'accent' | 'warng' = 'default'
+  get class(){
+    return `d-flex flex-column align-items-center iv-custom-comp ${this.color} h-100`
+  }
+}
\ No newline at end of file
diff --git a/src/components/vButton/vButton.style.css b/src/components/vButton/vButton.style.css
new file mode 100644
index 0000000000000000000000000000000000000000..d5201cbe5c5f91688b3806cb048875c090a516c0
--- /dev/null
+++ b/src/components/vButton/vButton.style.css
@@ -0,0 +1,28 @@
+:host
+{
+  padding: 1rem 2rem;
+  /* background-color:rgba(128,128,128,0.3) */
+}
+
+:host:hover
+{
+  cursor: pointer;
+}
+
+.icon-container
+{
+  flex-basis: 2.5rem;
+}
+
+.text-container
+{
+  flex-basis: 0;
+  overflow: visible;
+  text-align: center;
+}
+
+.footer-container
+{
+  flex-basis: 0rem;
+  margin-bottom: -1rem;
+}
\ No newline at end of file
diff --git a/src/components/vButton/vButton.template.html b/src/components/vButton/vButton.template.html
new file mode 100644
index 0000000000000000000000000000000000000000..539d1b897e89d6f0d972c7aff567853cc3268963
--- /dev/null
+++ b/src/components/vButton/vButton.template.html
@@ -0,0 +1,14 @@
+<div [class]="class">
+  <div class="icon-container flex-grow-0 flex-shrink-0">
+    <ng-content select="[iav-v-button-icon]">
+    </ng-content>
+  </div>
+  <div class="text-container flex-grow-1 flex-shrink-1">
+    <ng-content select="[iav-v-button-text]">
+    </ng-content>
+  </div>
+  <div class="footer-container flex-grow-0 flex-shrink-0">
+    <ng-content select="[iav-v-button-footer]">
+    </ng-content>
+  </div>
+</div>
\ No newline at end of file
diff --git a/src/index.html b/src/index.html
index 2500eebdf7cb839aa1f52a22ae1e661590851f72..498849604f08e081d10541a3ecf8fb1d3ae344be 100644
--- a/src/index.html
+++ b/src/index.html
@@ -8,7 +8,6 @@
   <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
   <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
   <link rel="stylesheet" href="extra_styles.css">
-  <link rel="stylesheet" href="plugin_styles.css">
   <link rel="stylesheet" href="theme.css">
   <link rel="stylesheet" href="version.css">
   
@@ -36,45 +35,13 @@
 </head>
 <body>
   <atlas-viewer>
-    <h1 class="text-center">
+    <h1 class="text-center" id="iav-inner">
       <span class="homeAnimationDots loadingAnimationDots">&bull;</span>
       <span class="homeAnimationDots loadingAnimationDots">&bull;</span>
       <span class="homeAnimationDots loadingAnimationDots">&bull;</span>
     </h1>
   </atlas-viewer>
-
-  <!-- inline script escaped by sha256 -->
-  <script>
-    /**
-    * Catching Safari 10 bug:
-    * 
-    * https://bugs.webkit.org/show_bug.cgi?id=171041
-    * 
-    */
-
-    (function(){
-      try{
-        eval('(()=>{\
-                let e = e => {\
-                  console.log(e);\
-                  for(let e of [1,2,3]){\
-                    console.log(e);\
-                  }\
-                }\
-            })()')
-      } catch (e) {
-        console.log(e)
-        const warning = 'Your browser cannot display the interactive viewer. Please use either Chrome >= 56 and/or Firefox >= 51'
-        console.log(warning)
-        const warningEl = document.createElement('h4')
-        warningEl.innerHTML = warning
-        const el = document.getElementsByTagName('atlas-viewer')
-        if(el.length > 0){
-          document.body.removeChild(el[0])
-        }
-        document.body.appendChild(warningEl)
-      }
-    })()
-  </script>
+  <script src="catchSyntaxError.js"></script>
+  <script src="syntaxError.js"></script>
 </body>
 </html>
diff --git a/src/main-common.ts b/src/main-common.ts
index 06e9222bef12cbabfaeeee0df0b43df0d106abb1..0ee0604988782cb519e4c9995e8d9ed80b831af7 100644
--- a/src/main-common.ts
+++ b/src/main-common.ts
@@ -3,6 +3,15 @@ import '!!file-loader?context=third_party&name=vanilla.html!third_party/vanilla.
 import '!!file-loader?context=third_party&name=vanilla_styles.css!third_party/styles.css'
 import '!!file-loader?context=third_party&name=vanilla_nehuba.js!third_party/vanilla_nehuba.js'
 
+/**
+* Catching Safari 10 bug:
+* 
+* https://bugs.webkit.org/show_bug.cgi?id=171041
+* 
+*/
+import '!!file-loader?context=third_party&name=catchSyntaxError.js!third_party/catchSyntaxError.js'
+import '!!file-loader?context=third_party&name=syntaxError.js!third_party/syntaxError.js'
+
 import 'zone.js'
 import { enableProdMode } from '@angular/core';
 
diff --git a/src/main.module.ts b/src/main.module.ts
index 074035bbab9c77552bf863f17d8ba547f40b723c..bd5bf01a7014bee9f0efe98f8c17d401a734f755 100644
--- a/src/main.module.ts
+++ b/src/main.module.ts
@@ -1,26 +1,25 @@
 import { DragDropModule } from '@angular/cdk/drag-drop'
-import { CommonModule } from "@angular/common";
+import { CommonModule, DOCUMENT } from "@angular/common";
 import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from "@angular/core";
 import { FormsModule } from "@angular/forms";
-import { StoreModule } from "@ngrx/store";
+import { StoreModule, Store } from "@ngrx/store";
 import { AngularMaterialModule } from 'src/ui/sharedModules/angularMaterial.module'
-import { AtlasViewer } from "./atlasViewer/atlasViewer.component";
+import { AtlasViewer, NEHUBA_CLICK_OVERRIDE } from "./atlasViewer/atlasViewer.component";
 import { ComponentsModule } from "./components/components.module";
 import { LayoutModule } from "./layouts/layout.module";
-import { dataStore, ngViewerState, pluginState, uiState, userConfigState, UserConfigStateUseEffect, viewerConfigState, viewerState } from "./services/stateStore.service";
+import { dataStore, ngViewerState, pluginState, uiState, userConfigState, UserConfigStateUseEffect, viewerConfigState, viewerState, IavRootStoreInterface } from "./services/stateStore.service";
 import { UIModule } from "./ui/ui.module";
 import { GetNamePipe } from "./util/pipes/getName.pipe";
 import { GetNamesPipe } from "./util/pipes/getNames.pipe";
 
 import { HttpClientModule } from "@angular/common/http";
 import { EffectsModule } from "@ngrx/effects";
-import { AtlasViewerAPIServices } from "./atlasViewer/atlasViewer.apiService.service";
+import { AtlasViewerAPIServices, overrideNehubaClickFactory, CANCELLABLE_DIALOG, GET_TOAST_HANDLER_TOKEN } from "./atlasViewer/atlasViewer.apiService.service";
 import { AtlasWorkerService } from "./atlasViewer/atlasViewer.workerService.service";
 import { ModalUnit } from "./atlasViewer/modalUnit/modalUnit.component";
 import { TransformOnhoverSegmentPipe } from "./atlasViewer/onhoverSegment.pipe";
 import { ConfirmDialogComponent } from "./components/confirmDialog/confirmDialog.component";
 import { DialogComponent } from "./components/dialog/dialog.component";
-import { AuthService } from "./services/auth.service";
 import { DialogService } from "./services/dialogService.service";
 import { UseEffects } from "./services/effect/effect";
 import { LocalFileService } from "./services/localFile.service";
@@ -37,8 +36,10 @@ import { FloatingContainerDirective } from "./util/directives/floatingContainer.
 import { FloatingMouseContextualContainerDirective } from "./util/directives/floatingMouseContextualContainer.directive";
 import { NewViewerDisctinctViewToLayer } from "./util/pipes/newViewerDistinctViewToLayer.pipe";
 import { UtilModule } from "./util/util.module";
+import { SpotLightModule } from 'src/spotlight/spot-light.module'
+import { TryMeComponent } from "./ui/tryme/tryme.component";
 
-import { UiStateUseEffect } from "src/services/state/uiState.store";
+import { UiStateUseEffect, getMouseoverSegmentsFactory, GET_MOUSEOVER_SEGMENTS_TOKEN } from "src/services/state/uiState.store";
 import { AtlasViewerHistoryUseEffect } from "./atlasViewer/atlasViewer.history.service";
 import { PluginServiceUseEffect } from './services/effect/pluginUseEffect';
 import { TemplateCoordinatesTransformation } from "src/services/templateCoordinatesTransformation.service";
@@ -46,12 +47,13 @@ import { NewTemplateUseEffect } from './services/effect/newTemplate.effect';
 import { WidgetModule } from './atlasViewer/widgetUnit/widget.module';
 import { PluginModule } from './atlasViewer/pluginUnit/plugin.module';
 import { LoggingModule } from './logging/logging.module';
+import { ShareModule } from './share';
+import { AuthService } from './auth'
 
 import 'hammerjs'
 import 'src/res/css/extra_styles.css'
 import 'src/res/css/version.css'
 import 'src/theme.scss'
-import { ShareModule } from './share';
 
 @NgModule({
   imports : [
@@ -69,6 +71,8 @@ import { ShareModule } from './share';
     LoggingModule,
     ShareModule,
 
+    SpotLightModule,
+    
     EffectsModule.forRoot([
       DataBrowserUseEffect,
       UseEffects,
@@ -95,6 +99,7 @@ import { ShareModule } from './share';
   declarations : [
     AtlasViewer,
     ModalUnit,
+    TryMeComponent,
 
     /* directives */
     DockedContainerDirective,
@@ -121,6 +126,65 @@ import { ShareModule } from './share';
     DialogService,
     UIService,
     TemplateCoordinatesTransformation,
+    {
+      provide: NEHUBA_CLICK_OVERRIDE,
+      useFactory: overrideNehubaClickFactory,
+      deps: [
+        AtlasViewerAPIServices,
+        GET_MOUSEOVER_SEGMENTS_TOKEN
+      ]
+    },
+    {
+      provide: GET_MOUSEOVER_SEGMENTS_TOKEN,
+      useFactory: getMouseoverSegmentsFactory,
+      deps: [ Store ]
+    },
+    {
+      provide: GET_TOAST_HANDLER_TOKEN,
+      useFactory: (uiService: UIService) => {
+        return () => uiService.getToastHandler()
+      },
+      deps: [ UIService ]
+    },
+    {
+      provide: CANCELLABLE_DIALOG,
+      useFactory: (uiService: UIService) => {
+        return (message, option) => {
+          const actionBtn = {
+            type: 'mat-stroked-button',
+            color: 'default',
+            dismiss: true,
+            text: 'Cancel',
+            ariaLabel: 'Cancel'
+          }
+          const data = {
+            content: message,
+            config: {
+              sameLine: true
+            },
+            actions: [ actionBtn ]
+          }
+          const { userCancelCallback, ariaLabel } = option
+          const dialogRef = uiService.showDialog(data, {
+            hasBackdrop: false,
+            position: { top: '5px'},
+            ariaLabel
+          })
+
+          dialogRef.afterClosed().subscribe(closeReason => {
+            if (closeReason && closeReason.programmatic) return
+            if (closeReason && closeReason === actionBtn) return userCancelCallback()
+            if (!closeReason) return userCancelCallback()
+          })
+
+          return () => {
+            dialogRef.close({ userInitiated: false, programmatic: true })
+          }
+        } 
+      },
+      deps: [ UIService ]
+    },
+
 
     /**
      * TODO
diff --git a/src/plugin_examples/plugin_api.md b/src/plugin_examples/plugin_api.md
index f8172c2f0d5e225f4f8ff4d0bfad771cbdc34cb4..f2860cdee059fda4503534d222a99f41b6146112 100644
--- a/src/plugin_examples/plugin_api.md
+++ b/src/plugin_examples/plugin_api.md
@@ -165,9 +165,60 @@ window.interactiveViewer
     "message":"Message to be seen by the user." // default: ""
   }
   ```
-  - *getUserToSelectARegion(string)* Used to turn on region selection mode (in this mode, region menu will not displayed on click). Expects message to display on top off viewer while selection mode is active. Returns a Promise, resolves when user clicks on parcellation region, resolve body is desired region(s) array, rejects when user cancels region selection mode. 
-  - *cancelPromise(promise)* Used to reject promises in "uiHandle". Expects listed promises to reject:
-    - getUserToSelectARegion
+  - *getUserToSelectARegion(message)* returns a `Promise`
+
+    _input_
+    
+    | input | type | desc |
+    | --- | --- | --- |
+    | message | `string` | human readable message displayed to the user | 
+
+    _returns_
+
+    `Promise`, resolves to return `RegionSelectedByUser`, rejects with error object `{ userInitiated: boolean }`
+    
+    Requests user to select a parcellation region, displaying the message. Resolving to the region selected by the user. Rejects if either user cancels by pressing `Esc` or `Cancel`, or by developer calling `cancelPromise`
+  
+  - *cancelPromise(promise)* returns `void`
+  
+    _input_ 
+    
+    | input | type | desc |
+    | --- | --- | --- |
+    | promise | `Promise` | Reference to the __exact__ promise returned by `uiHnandle` methods |
+    
+    Cancel the request to select a parcellation region.
+
+    _usage example_
+
+    ```javascript
+
+    (() => {
+      const pr = interactive.uiHandle.getUserToSelectARegion(`webJuGEx would like you to select a region`)
+
+      pr.then(region => {  })
+        .catch(console.warn)
+
+      /*
+       * do NOT do 
+       * 
+       * const pr = interactive.uiHandle.getUserToSelectARegion(`webJuGEx would like you to select a region`)
+       *   .then(region => {  })
+       *   -catch(console.warn)
+       * 
+       * the promise passed to `cancelPromise` must be the exact promise returned.
+       * by chaining then/catch, a new reference is returned
+       */
+
+      setTimeout(() => {
+        try {
+          interactive.uiHandle.cancelPromise(pr)
+        } catch (e) {
+          // if the promise has been fulfilled (by resolving or user cancel), cancelPromise will throw
+        }
+      }, 5000)
+    })()
+    ```
   
 - pluginControl
 
diff --git a/src/res/.gitignore b/src/res/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..a6c7c2852d068ff1fef480ac369459598a62f82e
--- /dev/null
+++ b/src/res/.gitignore
@@ -0,0 +1 @@
+*.js
diff --git a/src/res/appendPOIsToAllen.js b/src/res/appendPOIsToAllen.js
deleted file mode 100644
index e8eade05a52140435303a06ca0d3bd151bf27f88..0000000000000000000000000000000000000000
--- a/src/res/appendPOIsToAllen.js
+++ /dev/null
@@ -1,110 +0,0 @@
-const fs = require('fs')
-
-const readFile = (path) => new Promise((rs,rj) => {
-  fs.readFile(path, 'utf-8', (err, data) => {
-    if(err){
-      rj(err)
-    }else{
-      try{
-        const json = JSON.parse(data)
-        rs(json)
-      }catch(e){
-        rj(e)
-      }
-    }
-  })
-})
-
-const findInNewRoot = (id, json) => {
-  return json.id === id
-    ? json
-    : json.children
-      ? json.find(child => findInNewRoot(child))
-      : null
-}
-
-Promise.all(['./raw/ABACenters.json','./raw/allenMouse.json'].map(readFile))
-  .then(jsons => {
-    const newJson = jsons[0]
-    const oldJson = jsons[1]
-    const newABRoot = newJson.msg[0]
-    const oldArr = oldJson.parcellations[0].regions
-
-    const mapNew = new Map()
-
-    const traverseNewJson = (json) => {
-      const {children, ...rest} = json
-      mapNew.set(json.id, rest)
-
-      if(children && children.constructor === Array && children.length > 0){
-        children.forEach(traverseNewJson)
-      }
-    }
-
-    traverseNewJson(newABRoot)
-
-    /* TODO 1/2 voxel shift? */
-    const allenMouseXYZTransform = [-5737500,-6637500,-4037500]
-    const transformPOI = (yzx) => {
-      const xyz = [yzx[2],yzx[0],yzx[1]]
-      const xyzNm = xyz.map(v => v*1e3)
-      const xyzTransformed = [0,1,2].map(idx => (allenMouseXYZTransform[idx] + xyzNm[idx]) * -1)
-      return xyzTransformed
-    }
-
-    const noCentersNames = []
-
-    const parseOldJson = (json) => {
-      if(!json.ontologyMetadata){
-        console.log('ontology metadata field is missing',json.name)
-        return json
-      }
-
-      if(typeof json.ontologyMetadata.id === 'undefined'){
-        console.log('atlas id field is missing',json.name)
-        return json
-      }
-
-      const newObj = mapNew.get(json.ontologyMetadata.id)
-      if(!newObj){
-        console.log('could not find the id in the map',json.name)
-        return json
-      }
-
-      mapNew.delete(json.ontologyMetadata.id)
-
-      if(!newObj.centers){
-        noCentersNames.push(newObj.name)
-        return Object.assign({}, json, {
-          children : json.children.map(parseOldJson)
-        })
-      }
-
-      return Object.assign({}, json, {
-        POIs : newObj.centers.map(transformPOI),
-        ontologyMetadata: Object.assign({}, json.ontologyMetadata, {centers :newObj.centers }),
-        children : json.children.map(parseOldJson)
-      })
-    }
-    const newArr = oldArr.map(json => Object.assign({}, parseOldJson(json)))
-
-    const newJson2 = Object.assign({}, oldJson)
-    newJson2.parcellations[0].regions = newArr
-    fs.writeFile('./raw/allenMouseNew.json', JSON.stringify(newJson2), 'utf-8', (err) => {
-      if(err) throw err
-      else console.log('writing finished')
-    })
-
-    fs.writeFile('./raw/allenMouseNewNoCenters.txt', noCentersNames.join('\n'), 'utf-8', (err) => {
-      if(err) throw err
-      else console.log('writing error finished')
-    })
-
-    fs.writeFile('./raw/allenMouseNewUnused.txt', Array.from(mapNew.values()).map(v => v.name).join('\n'), 'utf-8', (err) => {
-      if(err) throw err
-      else console.log('writing unused finished')
-    })
-    
-
-  })
-  .catch(console.err)
diff --git a/src/res/cvtLyon.js b/src/res/cvtLyon.js
deleted file mode 100644
index 073d04bca2c38e6bb48d2f436f1ef00d0da386c4..0000000000000000000000000000000000000000
--- a/src/res/cvtLyon.js
+++ /dev/null
@@ -1,23 +0,0 @@
-const fs = require('fs')
-fs.readFile(
-  './ext/***REMOVED***.json', 
-  // './ext/***REMOVED***.json', 
-  'utf-8', (err, data) => {
-  const json = JSON.parse(data)
-  const newFile = json.map(item => {
-    return {
-      name: item.name.replace('DESj', 'item2'),
-      // name: item.name.replace('BATg', 'item1'),
-      templateSpace: item.templateSpace,
-      geometry: item.geometry
-    }
-  })
-
-  fs.writeFile(
-    './raw/exportForOliver/item2.json', 
-    // './raw/exportForOliver/item1.json', 
-    JSON.stringify(newFile), 'utf-8', err => {
-    if (err) throw err
-    console.log('done')
-  })
-})
\ No newline at end of file
diff --git a/src/res/cvtPtsToSpatial.js b/src/res/cvtPtsToSpatial.js
deleted file mode 100644
index 903a1b8dba05c0fdf5f53c016651a1fd12de75b0..0000000000000000000000000000000000000000
--- a/src/res/cvtPtsToSpatial.js
+++ /dev/null
@@ -1,82 +0,0 @@
-const fs = require('fs')
-
-const filenames = [
-  '**removed**.pts',
-  '**removed**.pts'
-]
-
-const descContactPts = 'This spatial point represent a contact point in an electrode. Brain activity was recorded while the subject conduct several tasks.'
-const descVISU_f50f150 = 'This is a description of subject performing task VISU, with frequency range f50f150'
-const descVISU_f8f24 = 'This is a description of subject performing task VISU, with frequency range f8f24'
-const descLEC1_f50f150 = 'This is a description of subject performing task LEC1, with frequency range f50f150'
-const descLEC1_f8f24 = 'This is a description of subject performing task LEC1, with frequency range f8f24'
-
-filenames.map(filename => {
-  fs.readFile(`./raw/${filename}`, 'utf-8', (err, data) => {
-    if(err) throw err
-    const filteredLines = data.split('\n').filter(line => /^[a-zA-Z]p?[0-9]/.test(line))
-
-    const newLines = filteredLines.map(line => {
-      const [name, x, y, z, ...rest] = line.split('\t')
-      return {
-        type : 'iEEG Recording Site',
-        name : filename.replace('_MNI.pts', '').concat(`_${name.replace(/^.p/g,(s) => s.slice(0,1).concat('\''))}`),
-        templateSpace : 'MNI 152 ICBM 2009c Nonlinear Asymmetric',
-        geometry : {
-          type : 'point',
-          space : 'real',
-          position : [
-            Number(x),
-            Number(y),
-            Number(z)
-          ],
-        },
-        properties : {
-          description : descContactPts,
-          publications : []
-        },
-        files : [{
-          filename : 'VISU/VISU_f50f150',
-          name : 'VISU_f50f150',
-          mimetype : 'application/hibop',
-          url : 'http://about:blank',
-          properties : {
-            description: descVISU_f50f150,
-            publications : []
-          }
-        },{
-          filename : 'VISU/VISU_f8f24',
-          name : 'VISU f8f24',
-          mimetype : 'application/hibop',
-          url : 'http://about:blank',
-          properties : {
-            description: descVISU_f8f24,
-            publications : []
-          }
-        },{
-          filename : 'LEC1/LEC1_f50f150',
-          name : 'LEC1_f50f150',
-          mimetype : 'application/hibop',
-          url : 'http://about:blank',
-          properties : {
-            description: descLEC1_f50f150,
-            publications : []
-          }
-        },{
-          filename : 'LEC1/LEC1_f8f24',
-          name : 'LEC1_f8f24',
-          mimetype : 'application/hibop',
-          url : 'http://about:blank',
-          properties : {
-            description: descLEC1_f8f24,
-            publications : []
-          }
-        }]
-      }
-    })
-    
-    fs.writeFile(`./raw/${filename.replace('_MNI.pts', '.json')}`, JSON.stringify(newLines), 'utf-8', (err) => {
-      if(err) throw err
-    })
-  })
-})
\ No newline at end of file
diff --git a/src/res/cvtSwm.js b/src/res/cvtSwm.js
deleted file mode 100644
index a68ffa7687442f4da48502b11a0f6be74bf8c2c2..0000000000000000000000000000000000000000
--- a/src/res/cvtSwm.js
+++ /dev/null
@@ -1,20 +0,0 @@
-const fs = require('fs')
-
-const arrayExpander = (arr)=>arr.reduce((acc,curr)=>
-  acc.concat(
-    curr.constructor === Array ?
-      arrayExpander(curr) :
-      curr
-  )
-,[])
-
-fs.readFile('./ext/swmAggregatedData.json','utf-8',(err,data)=>{
-  if(err) throw err
-  const arr = JSON.parse(data)
-  const newarr = arrayExpander(arr)
-
-  fs.writeFile('./ext/swmAggregatedData2.json',JSON.stringify(newarr),'utf-8',(err)=>{
-    if(err) throw err
-    console.log('done')
-  })
-})
\ No newline at end of file
diff --git a/src/res/ext/MNI152.json b/src/res/ext/MNI152.json
index 679909551745b1a7170ceecd416154fa0d96a960..1d7876bee0c9e0d46989e1cd52f37df23e64e3a0 100644
--- a/src/res/ext/MNI152.json
+++ b/src/res/ext/MNI152.json
@@ -157,6 +157,13 @@
                                 -17620275,
                                 -2290378,
                                 -12609966
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "791a14c8-b899-414f-b237-27574a4cce7e",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Ch 4 (Basal Forebrain) [v4.2, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -173,6 +180,13 @@
                                 15978528,
                                 -1288344,
                                 -12582822
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "791a14c8-b899-414f-b237-27574a4cce7e",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Ch 4 (Basal Forebrain) [v4.2, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -285,7 +299,14 @@
                               ],
                               "labelIndex": 187,
                               "ngId": "jubrain mni152 v18 left",
-                              "children": []
+                              "children": [],
+                              "originDatasets": [
+                                {
+                                  "kgId": "fa4cab6a-1cec-4cec-b481-90aa0cc7d96c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "LB (Amygdala) [v6.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
+                              ]
                             },
                             {
                               "name": "LB (Amygdala) - right hemisphere",
@@ -296,7 +317,14 @@
                               ],
                               "ngId": "jubrain mni152 v18 right",
                               "labelIndex": 187,
-                              "children": []
+                              "children": [],
+                              "originDatasets": [
+                                {
+                                  "kgId": "fa4cab6a-1cec-4cec-b481-90aa0cc7d96c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "LB (Amygdala) [v6.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
+                              ]
                             }
                           ],
                           "fullId": {
@@ -337,7 +365,14 @@
                               ],
                               "labelIndex": 22,
                               "ngId": "jubrain mni152 v18 left",
-                              "children": []
+                              "children": [],
+                              "originDatasets": [
+                                {
+                                  "kgId": "21ed6af0-5c39-4153-a3b8-8983530436ac",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "CM (Amygdala) [v6.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
+                              ]
                             },
                             {
                               "name": "CM (Amygdala) - right hemisphere",
@@ -348,7 +383,14 @@
                               ],
                               "ngId": "jubrain mni152 v18 right",
                               "labelIndex": 22,
-                              "children": []
+                              "children": [],
+                              "originDatasets": [
+                                {
+                                  "kgId": "21ed6af0-5c39-4153-a3b8-8983530436ac",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "CM (Amygdala) [v6.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
+                              ]
                             }
                           ],
                           "fullId": {
@@ -380,7 +422,14 @@
                               ],
                               "labelIndex": 186,
                               "ngId": "jubrain mni152 v18 left",
-                              "children": []
+                              "children": [],
+                              "originDatasets": [
+                                {
+                                  "kgId": "37a6a7d9-5252-4605-a792-6fefe2fde816",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "SF (Amygdala) [v6.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
+                              ]
                             },
                             {
                               "name": "SF (Amygdala) - right hemisphere",
@@ -391,7 +440,14 @@
                               ],
                               "ngId": "jubrain mni152 v18 right",
                               "labelIndex": 186,
-                              "children": []
+                              "children": [],
+                              "originDatasets": [
+                                {
+                                  "kgId": "37a6a7d9-5252-4605-a792-6fefe2fde816",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "SF (Amygdala) [v6.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
+                              ]
                             }
                           ],
                           "fullId": {
@@ -437,6 +493,13 @@
                                 -19722222,
                                 -8722222,
                                 -16222222
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1ea87428-a211-439f-b258-40fa3e3363c9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "MF (Amygdala) [v6.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -453,6 +516,13 @@
                                 19157143,
                                 -6585714,
                                 -15985714
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1ea87428-a211-439f-b258-40fa3e3363c9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "MF (Amygdala) [v6.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -490,6 +560,13 @@
                                 -24442675,
                                 -12143312,
                                 -15697452
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "9428d48e-f222-4191-96b8-02d3fa6068da",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "VTM (Amygdala) [v6.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -506,6 +583,13 @@
                                 23257426,
                                 -10816832,
                                 -17326733
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "9428d48e-f222-4191-96b8-02d3fa6068da",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "VTM (Amygdala) [v6.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -543,6 +627,13 @@
                                 -29180412,
                                 -3664948,
                                 -18242268
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "3acdb92c-68f0-42db-a7af-9dbb69cbea1d",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "IF (Amygdala) [v6.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -559,6 +650,13 @@
                                 27247368,
                                 -2310526,
                                 -17973684
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "3acdb92c-68f0-42db-a7af-9dbb69cbea1d",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "IF (Amygdala) [v6.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -600,7 +698,14 @@
                               ],
                               "labelIndex": 16,
                               "ngId": "jubrain mni152 v18 left",
-                              "children": []
+                              "children": [],
+                              "originDatasets": [
+                                {
+                                  "kgId": "21ed6af0-5c39-4153-a3b8-8983530436ac",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "CM (Amygdala) [v6.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
+                              ]
                             },
                             {
                               "name": "CM (Amygdala) - right hemisphere",
@@ -611,7 +716,14 @@
                               ],
                               "ngId": "jubrain mni152 v18 right",
                               "labelIndex": 16,
-                              "children": []
+                              "children": [],
+                              "originDatasets": [
+                                {
+                                  "kgId": "21ed6af0-5c39-4153-a3b8-8983530436ac",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "CM (Amygdala) [v6.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
+                              ]
                             }
                           ],
                           "fullId": {
@@ -648,6 +760,13 @@
                                 -22534091,
                                 -5320076,
                                 -13793561
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "21ed6af0-5c39-4153-a3b8-8983530436ac",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "CM (Amygdala) [v6.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -664,6 +783,13 @@
                                 21343972,
                                 -4488180,
                                 -13743499
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "21ed6af0-5c39-4153-a3b8-8983530436ac",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "CM (Amygdala) [v6.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -728,6 +854,13 @@
                                 -8012999,
                                 -74699164,
                                 53070102
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "5fd792b5-c306-4fb4-8d29-205dc3536476",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 7P (SPL) [v8.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -744,6 +877,13 @@
                                 14174790,
                                 -74087955,
                                 55690476
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "5fd792b5-c306-4fb4-8d29-205dc3536476",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 7P (SPL) [v8.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -781,6 +921,13 @@
                                 -8469145,
                                 -40822964,
                                 57099393
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "5ddbc06e-b30c-4d44-a4c0-107210a66b4f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 5M (SPL) [v8.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -797,6 +944,13 @@
                                 5921975,
                                 -43433519,
                                 59763933
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "5ddbc06e-b30c-4d44-a4c0-107210a66b4f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 5M (SPL) [v8.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -834,6 +988,13 @@
                                 -33528332,
                                 -47472312,
                                 63389891
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8cc9b1dd-caa6-49d5-85f1-1e2e78be3161",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 7PC (SPL) [v8.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -850,6 +1011,13 @@
                                 29759690,
                                 -46534053,
                                 62336656
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8cc9b1dd-caa6-49d5-85f1-1e2e78be3161",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 7PC (SPL) [v8.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -887,6 +1055,13 @@
                                 -18756077,
                                 -45216005,
                                 67108905
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1100df93-93f4-4091-bf2e-6eb48a2d56ff",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 5L (SPL) [v8.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -903,6 +1078,13 @@
                                 14224079,
                                 -48937984,
                                 69561773
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1100df93-93f4-4091-bf2e-6eb48a2d56ff",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 5L (SPL) [v8.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -940,6 +1122,13 @@
                                 -2488934,
                                 -78308853,
                                 35074447
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1715e680-a492-49a2-8f54-025aa41819da",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 7M (SPL) [v8.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -956,6 +1145,13 @@
                                 2937879,
                                 -75031818,
                                 38515152
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1715e680-a492-49a2-8f54-025aa41819da",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 7M (SPL) [v8.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1004,6 +1200,13 @@
                                 -20931652,
                                 -61293975,
                                 62298721
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f2635688-3894-471f-88db-c065871582de",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 7A (SPL) [v8.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1020,6 +1223,13 @@
                                 20754675,
                                 -61621387,
                                 62051683
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f2635688-3894-471f-88db-c065871582de",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 7A (SPL) [v8.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1056,6 +1266,13 @@
                                 -15736664,
                                 -35457926,
                                 42264087
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "fe83803d-f6dc-4341-98a0-a5aeccd63651",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 5Ci (SPL) [v8.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1072,6 +1289,13 @@
                                 11398622,
                                 -35143701,
                                 45477854
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "fe83803d-f6dc-4341-98a0-a5aeccd63651",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 5Ci (SPL) [v8.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1118,6 +1342,13 @@
                                 -37009402,
                                 -24886325,
                                 19503419
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "0a3e9feb-5816-4593-a5c8-ca4b9099f7b8",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP2 (POperc) [v9.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1134,6 +1365,13 @@
                                 35239706,
                                 -21379412,
                                 18500000
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "0a3e9feb-5816-4593-a5c8-ca4b9099f7b8",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP2 (POperc) [v9.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1171,6 +1409,13 @@
                                 -61452452,
                                 -11957958,
                                 14987487
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "55213785-8693-438c-8f6b-7628609b4017",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP4 (POperc) [v9.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1187,6 +1432,13 @@
                                 61825815,
                                 -8262531,
                                 12300125
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "55213785-8693-438c-8f6b-7628609b4017",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP4 (POperc) [v9.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1224,6 +1476,13 @@
                                 -41843266,
                                 -14720501,
                                 18247318
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "eddb0ef1-21d6-4271-ad36-f6c81ddba642",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP3 (POperc) [v9.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1240,6 +1499,13 @@
                                 40261521,
                                 -11390553,
                                 18514977
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "eddb0ef1-21d6-4271-ad36-f6c81ddba642",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP3 (POperc) [v9.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1277,6 +1543,13 @@
                                 -52293320,
                                 -24316468,
                                 18030093
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1802ffb1-6d1a-4c1a-a7d9-170664a98b49",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP1 (POperc) [v9.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1293,6 +1566,13 @@
                                 51168165,
                                 -19477523,
                                 18151001
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1802ffb1-6d1a-4c1a-a7d9-170664a98b49",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP1 (POperc) [v9.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1339,6 +1619,13 @@
                                 -47975865,
                                 -26902730,
                                 58870063
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "ce8c8428-02fe-42f8-9a76-d297579b71c9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 1 (PostCG) [v8.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1355,6 +1642,13 @@
                                 48161578,
                                 -22485924,
                                 56291435
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "ce8c8428-02fe-42f8-9a76-d297579b71c9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 1 (PostCG) [v8.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1403,6 +1697,13 @@
                                 -46100804,
                                 -21517231,
                                 46289585
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "50ac42dd-5808-459c-882a-dbd98c76999c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 3b (PostCG) [v8.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1419,6 +1720,13 @@
                                 39338624,
                                 -21564818,
                                 47310887
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "50ac42dd-5808-459c-882a-dbd98c76999c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 3b (PostCG) [v8.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1455,6 +1763,13 @@
                                 -32589090,
                                 -25737826,
                                 44292752
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "d2c20dce-122e-4c69-922a-1f33909496cf",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 3a (PostCG) [v8.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1471,6 +1786,13 @@
                                 38084107,
                                 -18062645,
                                 36367169
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "d2c20dce-122e-4c69-922a-1f33909496cf",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 3a (PostCG) [v8.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1508,6 +1830,13 @@
                                 -43927866,
                                 -31926548,
                                 51956851
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e81716df-d1ab-417b-b69c-3da566aab026",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 2 (PostCS) [v3.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1524,6 +1853,13 @@
                                 38456046,
                                 -31522535,
                                 52910085
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e81716df-d1ab-417b-b69c-3da566aab026",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 2 (PostCS) [v3.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1581,6 +1917,13 @@
                                 -56791928,
                                 -53657866,
                                 40055933
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "3a076c3e-75f4-4626-a0e8-f23bcf8b8ef0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PFm (IPL) [v9.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1597,6 +1940,13 @@
                                 57321981,
                                 -44055488,
                                 39537196
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "3a076c3e-75f4-4626-a0e8-f23bcf8b8ef0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PFm (IPL) [v9.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1644,6 +1994,13 @@
                                 -62520113,
                                 -25681018,
                                 24621307
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "29c1cad2-0a55-49ec-b7f5-a9acf5db7c1f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PFop (IPL) [v9.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1660,6 +2017,13 @@
                                 57801693,
                                 -19413543,
                                 26279323
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "29c1cad2-0a55-49ec-b7f5-a9acf5db7c1f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PFop (IPL) [v9.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1707,6 +2071,13 @@
                                 -62326709,
                                 -38492101,
                                 37676006
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e1528fe1-a812-44d9-a0ca-f738b0e705e3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PF (IPL) [v9.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1723,6 +2094,13 @@
                                 64184952,
                                 -31767876,
                                 31797118
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e1528fe1-a812-44d9-a0ca-f738b0e705e3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PF (IPL) [v9.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1770,6 +2148,13 @@
                                 -46213502,
                                 -75081229,
                                 30404363
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2105576e-e1b0-4e03-9cb4-8c2b65be2f96",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PGp (IPL) [v9.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1786,6 +2171,13 @@
                                 47682598,
                                 -70326680,
                                 31755974
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2105576e-e1b0-4e03-9cb4-8c2b65be2f96",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PGp (IPL) [v9.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1833,6 +2225,13 @@
                                 -50169585,
                                 -63561531,
                                 38956978
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "25451957-c246-4a42-99d4-07c88d4e78fc",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PGa (IPL) [v9.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1849,6 +2248,13 @@
                                 55106872,
                                 -54828987,
                                 31733304
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "25451957-c246-4a42-99d4-07c88d4e78fc",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PGa (IPL) [v9.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1896,6 +2302,13 @@
                                 -57342169,
                                 -28159557,
                                 38579423
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "b5375459-2b03-4c67-a125-25c923180017",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PFt (IPL) [v9.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1912,6 +2325,13 @@
                                 55074906,
                                 -22994639,
                                 39924515
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "b5375459-2b03-4c67-a125-25c923180017",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PFt (IPL) [v9.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1959,6 +2379,13 @@
                                 -53295618,
                                 -39421369,
                                 23142857
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "03520da2-e553-4284-84e4-d8b293446cd4",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PFcm (IPL) [v9.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1975,6 +2402,13 @@
                                 52927071,
                                 -29776768,
                                 24592525
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "03520da2-e553-4284-84e4-d8b293446cd4",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PFcm (IPL) [v9.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2020,6 +2454,13 @@
                                 -16522864,
                                 -81584154,
                                 36346936
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7593b453-f916-4bd0-ae2b-d4cbff307428",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hPO1 (POS) [v7.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2036,6 +2477,13 @@
                                 21240705,
                                 -81149825,
                                 37156498
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7593b453-f916-4bd0-ae2b-d4cbff307428",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hPO1 (POS) [v7.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2082,6 +2530,13 @@
                                 -29185032,
                                 -74634355,
                                 36823512
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "24b2682f-5c82-4439-8278-bc526b530030",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP5 (IPS) [v7.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2098,6 +2553,13 @@
                                 33939891,
                                 -69259563,
                                 34275566
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "24b2682f-5c82-4439-8278-bc526b530030",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP5 (IPS) [v7.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2135,6 +2597,13 @@
                                 -31442940,
                                 -54720825,
                                 48220503
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "bd1062af-e9c5-4b8d-9742-2172be4fef93",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP3 (IPS) [v8.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2151,6 +2620,13 @@
                                 33068074,
                                 -49000000,
                                 50509215
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "bd1062af-e9c5-4b8d-9742-2172be4fef93",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP3 (IPS) [v8.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2188,6 +2664,13 @@
                                 -18598696,
                                 -73068715,
                                 43463501
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2dba112f-075c-4dba-813d-e408ff429586",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP8 (IPS) [v7.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2204,6 +2687,13 @@
                                 24977204,
                                 -71433131,
                                 41158435
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2dba112f-075c-4dba-813d-e408ff429586",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP8 (IPS) [v7.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2241,6 +2731,13 @@
                                 -31264133,
                                 -81080409,
                                 24906920
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f2ec3ab5-c604-4dd6-b941-ffc37288cc46",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP4 (IPS) [v7.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2257,6 +2754,13 @@
                                 37282609,
                                 -76348814,
                                 22440217
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f2ec3ab5-c604-4dd6-b941-ffc37288cc46",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP4 (IPS) [v7.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2294,6 +2798,13 @@
                                 -24182639,
                                 -81016889,
                                 28962687
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "aff5df97-f341-4370-97af-58d9f40c9877",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP7 (IPS) [v7.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2310,6 +2821,13 @@
                                 29594078,
                                 -79106072,
                                 27718516
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "aff5df97-f341-4370-97af-58d9f40c9877",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP7 (IPS) [v7.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2347,6 +2865,13 @@
                                 -37649600,
                                 -50042430,
                                 40308099
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "3367db70-cd25-4834-9646-9604308dfa02",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP1 (IPS) [v6.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2363,6 +2888,13 @@
                                 40174687,
                                 -47498075,
                                 39221848
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "3367db70-cd25-4834-9646-9604308dfa02",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP1 (IPS) [v6.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2400,6 +2932,13 @@
                                 -32177576,
                                 -67578743,
                                 47685353
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e51da69b-f5de-49d5-9566-6fde3ef14d80",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP6 (IPS) [v7.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2416,6 +2955,13 @@
                                 37140789,
                                 -63130263,
                                 45176974
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e51da69b-f5de-49d5-9566-6fde3ef14d80",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP6 (IPS) [v7.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2453,6 +2999,13 @@
                                 -48109229,
                                 -42174005,
                                 43577477
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "a8ee352c-13fc-45fd-9522-c7ac9de9bd61",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP2 (IPS) [v6.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2469,6 +3022,13 @@
                                 44102535,
                                 -39182604,
                                 45742512
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "a8ee352c-13fc-45fd-9522-c7ac9de9bd61",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP2 (IPS) [v6.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2524,6 +3084,13 @@
                                 -18518125,
                                 -89169571,
                                 25335483
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "704230e3-434b-45d7-875c-05600272f01a",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc4d (Cuneus) [v2.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2540,6 +3107,13 @@
                                 19552047,
                                 -87379086,
                                 27567915
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "704230e3-434b-45d7-875c-05600272f01a",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc4d (Cuneus) [v2.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2577,6 +3151,13 @@
                                 -14416089,
                                 -92302582,
                                 21786681
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "13c8ab3f-ec22-4f61-8abb-fca2d5fbbdbc",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc3d (Cuneus) [v2.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2593,6 +3174,13 @@
                                 14188075,
                                 -89168467,
                                 24647659
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "13c8ab3f-ec22-4f61-8abb-fca2d5fbbdbc",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc3d (Cuneus) [v2.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2630,6 +3218,13 @@
                                 -17598229,
                                 -72213366,
                                 15094203
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f3a24a48-3d23-4d92-9de6-e13dc888f1b5",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc6 (POS) [v7.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2646,6 +3241,13 @@
                                 17851310,
                                 -68066256,
                                 18144838
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f3a24a48-3d23-4d92-9de6-e13dc888f1b5",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc6 (POS) [v7.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2692,6 +3294,13 @@
                                 -27885066,
                                 -80622049,
                                 -13384313
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e2d948e4-f52d-4f02-a635-017f3c71186c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc4v (LingG) [v3.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2708,6 +3317,13 @@
                                 31875471,
                                 -78011213,
                                 -12568268
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e2d948e4-f52d-4f02-a635-017f3c71186c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc4v (LingG) [v3.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2745,6 +3361,13 @@
                                 -19368217,
                                 -87017481,
                                 -10849154
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "76b837d8-5c64-4c50-b825-efbbe72f6625",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc3v (LingG) [v3.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2761,6 +3384,13 @@
                                 22758654,
                                 -83233966,
                                 -10415129
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "76b837d8-5c64-4c50-b825-efbbe72f6625",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc3v (LingG) [v3.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2807,6 +3437,13 @@
                                 -10978138,
                                 -87917881,
                                 3523276
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "fa2af93e-c0bb-4c76-bdfe-52776a37d0c0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc2 (V2, 18) [v2.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2823,6 +3460,13 @@
                                 12703537,
                                 -86800460,
                                 3658074
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "fa2af93e-c0bb-4c76-bdfe-52776a37d0c0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc2 (V2, 18) [v2.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2871,6 +3515,13 @@
                                 -10265298,
                                 -84434623,
                                 2016671
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "5c669b77-c981-424a-858d-fe9f527dbc07",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc1 (V1, 17, CalcS) [v2.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2887,6 +3538,13 @@
                                 13123488,
                                 -81803556,
                                 2052487
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "5c669b77-c981-424a-858d-fe9f527dbc07",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc1 (V1, 17, CalcS) [v2.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2932,6 +3590,13 @@
                                 -43339493,
                                 -73484161,
                                 1403907
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "84897b6c-78d3-4dd4-bea9-dbb6459fba20",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc5 (LOC) [v2.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2948,6 +3613,13 @@
                                 47686640,
                                 -66001965,
                                 4126719
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "84897b6c-78d3-4dd4-bea9-dbb6459fba20",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc5 (LOC) [v2.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2985,6 +3657,13 @@
                                 -47307308,
                                 -79566994,
                                 -653781
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "304342d8-5d55-4dea-a97e-39dccc72a7a4",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc4la (LOC) [v3.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3001,6 +3680,13 @@
                                 47940691,
                                 -74716566,
                                 251812
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "304342d8-5d55-4dea-a97e-39dccc72a7a4",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc4la (LOC) [v3.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3038,6 +3724,13 @@
                                 -34774834,
                                 -90654982,
                                 6585904
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "487f86a9-2637-4cd1-bb33-f2b0db904697",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc4lp (LOC) [v3.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3054,6 +3747,13 @@
                                 37344111,
                                 -86863972,
                                 4946882
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "487f86a9-2637-4cd1-bb33-f2b0db904697",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc4lp (LOC) [v3.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3140,7 +3840,14 @@
                               ],
                               "labelIndex": 247,
                               "ngId": "jubrain mni152 v18 left",
-                              "children": []
+                              "children": [],
+                              "originDatasets": [
+                                {
+                                  "kgId": "ec4dc0a2-bd09-4a2f-8189-96565e62fd44",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area ifs4 (IFS) [v2.2, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
+                              ]
                             },
                             {
                               "name": "Area ifs4 (IFS) - right hemisphere",
@@ -3151,7 +3858,14 @@
                               ],
                               "ngId": "jubrain mni152 v18 right",
                               "labelIndex": 247,
-                              "children": []
+                              "children": [],
+                              "originDatasets": [
+                                {
+                                  "kgId": "ec4dc0a2-bd09-4a2f-8189-96565e62fd44",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area ifs4 (IFS) [v2.2, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
+                              ]
                             }
                           ],
                           "fullId": {
@@ -3183,7 +3897,14 @@
                               ],
                               "labelIndex": 244,
                               "ngId": "jubrain mni152 v18 left",
-                              "children": []
+                              "children": [],
+                              "originDatasets": [
+                                {
+                                  "kgId": "09f84bba-fbb1-4f5c-9b79-c0a31c20692a",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area ifs1 (IFS) [v2.2, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
+                              ]
                             },
                             {
                               "name": "Area ifs1 (IFS) - right hemisphere",
@@ -3194,7 +3915,14 @@
                               ],
                               "ngId": "jubrain mni152 v18 right",
                               "labelIndex": 244,
-                              "children": []
+                              "children": [],
+                              "originDatasets": [
+                                {
+                                  "kgId": "09f84bba-fbb1-4f5c-9b79-c0a31c20692a",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area ifs1 (IFS) [v2.2, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
+                              ]
                             }
                           ],
                           "fullId": {
@@ -3262,7 +3990,14 @@
                               ],
                               "labelIndex": 245,
                               "ngId": "jubrain mni152 v18 left",
-                              "children": []
+                              "children": [],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7fec7408-fbc1-4d58-aaea-66629a684111",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area ifs2 (IFS) [v2.2, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
+                              ]
                             },
                             {
                               "name": "Area ifs2 (IFS) - right hemisphere",
@@ -3273,7 +4008,14 @@
                               ],
                               "ngId": "jubrain mni152 v18 right",
                               "labelIndex": 245,
-                              "children": []
+                              "children": [],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7fec7408-fbc1-4d58-aaea-66629a684111",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area ifs2 (IFS) [v2.2, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
+                              ]
                             }
                           ],
                           "fullId": {
@@ -3305,7 +4047,14 @@
                               ],
                               "labelIndex": 246,
                               "ngId": "jubrain mni152 v18 left",
-                              "children": []
+                              "children": [],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e1cede6b-d29b-4cfc-b12c-dd236fa313ac",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area ifs3 (IFS) [v2.2, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
+                              ]
                             },
                             {
                               "name": "Area ifs3 (IFS) - right hemisphere",
@@ -3316,7 +4065,14 @@
                               ],
                               "ngId": "jubrain mni152 v18 right",
                               "labelIndex": 246,
-                              "children": []
+                              "children": [],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e1cede6b-d29b-4cfc-b12c-dd236fa313ac",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area ifs3 (IFS) [v2.2, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
+                              ]
                             }
                           ],
                           "fullId": {
@@ -3382,6 +4138,13 @@
                                 -54134365,
                                 11216664,
                                 15641040
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8f180ff1-20d1-4112-9e71-a5c7eca6c369",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 44 (IFG) [v7.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3398,6 +4161,13 @@
                                 53627432,
                                 13897917,
                                 11532612
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8f180ff1-20d1-4112-9e71-a5c7eca6c369",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 44 (IFG) [v7.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3445,6 +4215,13 @@
                                 -54741552,
                                 27110876,
                                 13391235
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1db64761-aad6-4d3d-b67c-2a9ef4df6e47",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 45 (IFG) [v7.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3461,6 +4238,13 @@
                                 52598442,
                                 28512366,
                                 11201622
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1db64761-aad6-4d3d-b67c-2a9ef4df6e47",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 45 (IFG) [v7.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3494,7 +4278,7 @@
                           "fullId": {
                             "kg": {
                               "kgSchema": "minds/core/parcellationregion/v1.0.0",
-                              "kgId":"a802f3dc-b7e5-48b7-9845-832a6e6f9b1c"
+                              "kgId": "a802f3dc-b7e5-48b7-9845-832a6e6f9b1c"
                             }
                           },
                           "children": [
@@ -3512,6 +4296,13 @@
                                 -21374190,
                                 -13807593,
                                 67532003
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "6a2ee2d8-120c-40de-b390-53ca87210298",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6d1 (PreCG) [v4.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3528,6 +4319,13 @@
                                 18459790,
                                 -13929543,
                                 67653920
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "6a2ee2d8-120c-40de-b390-53ca87210298",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6d1 (PreCG) [v4.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ]
@@ -3546,7 +4344,7 @@
                           "fullId": {
                             "kg": {
                               "kgSchema": "minds/core/parcellationregion/v1.0.0",
-                              "kgId":"963c5281-67df-4d41-9b91-60b31cf150c0"
+                              "kgId": "963c5281-67df-4d41-9b91-60b31cf150c0"
                             }
                           },
                           "children": [
@@ -3564,6 +4362,13 @@
                                 -16167826,
                                 3331479,
                                 67316412
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "b2fa41bb-67ab-4c69-bbea-5108ef1d0dc3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6d2 (PreCG) [v4.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3580,6 +4385,13 @@
                                 13586847,
                                 5159934,
                                 67533325
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "b2fa41bb-67ab-4c69-bbea-5108ef1d0dc3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6d2 (PreCG) [v4.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ]
@@ -3619,6 +4431,13 @@
                                 -5793912,
                                 6001050,
                                 57168300
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "89347668-eee6-4be5-b783-8dddf422bba0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6ma (preSMA, mesial SFG) [v9.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3635,6 +4454,13 @@
                                 5128280,
                                 6328025,
                                 57073758
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "89347668-eee6-4be5-b783-8dddf422bba0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6ma (preSMA, mesial SFG) [v9.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3681,6 +4507,13 @@
                                 -24754304,
                                 4064945,
                                 51648670
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "502b40a0-1689-4329-854e-a77dfd94d30b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6d3 (SFS) [v4.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3697,6 +4530,13 @@
                                 23956070,
                                 3653802,
                                 53205165
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "502b40a0-1689-4329-854e-a77dfd94d30b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6d3 (SFS) [v4.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3743,6 +4583,13 @@
                                 -19102858,
                                 63747679,
                                 -1631986
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7a02d7b6-51f7-4f6f-a1c3-ca04b56cc107",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fp1 (FPole) [v2.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3759,6 +4606,13 @@
                                 17092523,
                                 64510614,
                                 -2304434
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7a02d7b6-51f7-4f6f-a1c3-ca04b56cc107",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fp1 (FPole) [v2.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3796,6 +4650,13 @@
                                 -6503595,
                                 59384951,
                                 -3961993
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8d2f06b2-d3bd-4f89-a6e3-953c90cc9661",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fp2 (FPole) [v2.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3812,6 +4673,13 @@
                                 4778743,
                                 61080225,
                                 -3022228
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8d2f06b2-d3bd-4f89-a6e3-953c90cc9661",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fp2 (FPole) [v2.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3869,6 +4737,13 @@
                                 -37145015,
                                 -22255287,
                                 49007049
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "02a0087e-3fdc-4b95-826a-0a953490103b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 4p (PreCG) [v9.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3885,6 +4760,13 @@
                                 36616185,
                                 -18949518,
                                 46248351
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "02a0087e-3fdc-4b95-826a-0a953490103b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 4p (PreCG) [v9.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3921,6 +4803,13 @@
                                 -17759520,
                                 -26329160,
                                 66684048
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "6e1728c2-dd89-40d4-a0ea-fdede469684f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 4a (PreCG) [v9.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3937,6 +4826,13 @@
                                 9561296,
                                 -29536520,
                                 67748853
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "6e1728c2-dd89-40d4-a0ea-fdede469684f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 4a (PreCG) [v9.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3983,6 +4879,13 @@
                                 -5060089,
                                 -12636499,
                                 57999629
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1e7ee33c-a1e4-49a9-9093-54520392dff9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6mp (SMA, mesial SFG) [v9.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3999,6 +4902,13 @@
                                 4281209,
                                 -12118010,
                                 56050065
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1e7ee33c-a1e4-49a9-9093-54520392dff9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6mp (SMA, mesial SFG) [v9.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4045,6 +4955,13 @@
                                 -22798035,
                                 32470959,
                                 -20700499
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "fca58db5-fadb-4314-a06c-75948110d7f0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo3 (OFC) [v3.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4061,6 +4978,13 @@
                                 20788728,
                                 33338701,
                                 -20253609
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "fca58db5-fadb-4314-a06c-75948110d7f0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo3 (OFC) [v3.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4098,6 +5022,13 @@
                                 -8931833,
                                 40936870,
                                 -25550705
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2153a21a-7fee-4fcd-9a91-6d23c494403b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo1 (OFC) [v3.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4114,6 +5045,13 @@
                                 7452738,
                                 40856484,
                                 -25066859
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2153a21a-7fee-4fcd-9a91-6d23c494403b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo1 (OFC) [v3.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4151,6 +5089,13 @@
                                 -10107850,
                                 20731801,
                                 -22045790
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2e8f2ce5-abf8-4881-8ea6-4eddcb188c12",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo2 (OFC) [v3.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4167,6 +5112,13 @@
                                 7453208,
                                 20602446,
                                 -21936370
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2e8f2ce5-abf8-4881-8ea6-4eddcb188c12",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo2 (OFC) [v3.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4213,6 +5165,13 @@
                                 -45695111,
                                 26848756,
                                 3249018
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2034ee9f-69f8-4633-9b81-eaf4b8f44aed",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP9 (Frontal Operculum) [v5.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4229,6 +5188,13 @@
                                 41290819,
                                 28113597,
                                 1086868
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2034ee9f-69f8-4633-9b81-eaf4b8f44aed",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP9 (Frontal Operculum) [v5.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ]
@@ -4259,6 +5225,13 @@
                                 -42412158,
                                 17741884,
                                 5519733
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "43d46017-2bef-467b-b870-9866c838e4f3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP8 (Frontal Operculum) [v5.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4275,6 +5248,13 @@
                                 40480213,
                                 18898782,
                                 6836377
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "43d46017-2bef-467b-b870-9866c838e4f3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP8 (Frontal Operculum) [v5.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ]
@@ -4314,6 +5294,13 @@
                                 -39738252,
                                 56611294,
                                 -10218054
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "688bee67-abc0-4a17-9800-21c5c9bf3870",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo5 (OFC) [v2.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4330,6 +5317,13 @@
                                 38497105,
                                 57087145,
                                 -6858425
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "688bee67-abc0-4a17-9800-21c5c9bf3870",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo5 (OFC) [v2.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4367,6 +5361,13 @@
                                 -37151362,
                                 38147830,
                                 -12621090
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7d4726da-7023-4e64-8b60-9d0271766bea",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo7 (OFC) [v2.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4383,6 +5384,13 @@
                                 35554006,
                                 39868546,
                                 -13535015
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7d4726da-7023-4e64-8b60-9d0271766bea",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo7 (OFC) [v2.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4420,6 +5428,13 @@
                                 -29237908,
                                 52508436,
                                 -15236783
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "d26dd88e-ae9d-41a1-a5c4-7e5b51f7e9c4",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo4 (OFC) [v2.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4436,6 +5451,13 @@
                                 31156863,
                                 53829721,
                                 -15390093
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "d26dd88e-ae9d-41a1-a5c4-7e5b51f7e9c4",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo4 (OFC) [v2.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4473,6 +5495,13 @@
                                 -45788648,
                                 42884347,
                                 -14819256
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "ab21e50f-c46d-45c5-b9f6-2b82d5728400",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo6 (OFC) [v2.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4489,6 +5518,13 @@
                                 46408524,
                                 41220374,
                                 -14205821
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "ab21e50f-c46d-45c5-b9f6-2b82d5728400",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo6 (OFC) [v2.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4544,6 +5580,13 @@
                                 -33927907,
                                 -25610078,
                                 9513953
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "30d68317-ee5b-4975-b643-4468eb8dfbe3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Ig1 (Insula) [v13.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4560,6 +5603,13 @@
                                 33261224,
                                 -23922449,
                                 8838776
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "30d68317-ee5b-4975-b643-4468eb8dfbe3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Ig1 (Insula) [v13.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4597,6 +5647,13 @@
                                 -38185879,
                                 -19442363,
                                 5011527
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f06b5ac4-3dff-4f92-a9b5-9a16fd4cf147",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Ig2 (Insula) [v13.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4613,6 +5670,13 @@
                                 37140230,
                                 -17412644,
                                 5868966
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f06b5ac4-3dff-4f92-a9b5-9a16fd4cf147",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Ig2 (Insula) [v13.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4659,6 +5723,13 @@
                                 -41710811,
                                 -3478378,
                                 -8602703
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8c98a495-a8d6-4fe8-8de1-5fd876e37d3f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Ia (Insula) [v3.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4675,6 +5746,13 @@
                                 40271008,
                                 -306723,
                                 -8955882
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8c98a495-a8d6-4fe8-8de1-5fd876e37d3f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Ia (Insula) [v3.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4721,6 +5799,13 @@
                                 -32161180,
                                 23947874,
                                 2868999
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2da42b86-d839-41e8-bb27-1bb7697e3868",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id7 (Insula) [v6.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4737,6 +5822,13 @@
                                 32412012,
                                 26220735,
                                 1550497
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2da42b86-d839-41e8-bb27-1bb7697e3868",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id7 (Insula) [v6.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4783,6 +5875,13 @@
                                 -41135158,
                                 -19816750,
                                 -5491708
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "456e67e7-ef36-4d1e-8b2e-0a1b40831086",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id1 (Insula) [v13.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4799,6 +5898,13 @@
                                 38820470,
                                 -17815436,
                                 -5112416
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "456e67e7-ef36-4d1e-8b2e-0a1b40831086",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id1 (Insula) [v13.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4836,6 +5942,13 @@
                                 -40449519,
                                 -4582933,
                                 382212
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "bfee9d73-2ea3-4b35-9e99-8862e1ed59a9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id5 (Insula) [v3.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4852,6 +5965,13 @@
                                 38537963,
                                 -2796296,
                                 165741
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "bfee9d73-2ea3-4b35-9e99-8862e1ed59a9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id5 (Insula) [v3.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4889,6 +6009,13 @@
                                 -37849096,
                                 -4693324,
                                 11819889
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "49a74d3a-9290-4ff9-9a5a-522c0a096d1b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id4 (Insula) [v3.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4905,6 +6032,13 @@
                                 36201613,
                                 -3791475,
                                 10987327
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "49a74d3a-9290-4ff9-9a5a-522c0a096d1b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id4 (Insula) [v3.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4942,6 +6076,13 @@
                                 -37077741,
                                 9330986,
                                 2058685
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "a98c1711-4d2c-4351-bc63-c3f827f41eab",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id6 (Insula) [v3.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4958,6 +6099,13 @@
                                 35516562,
                                 11115104,
                                 2772938
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "a98c1711-4d2c-4351-bc63-c3f827f41eab",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id6 (Insula) [v3.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5013,6 +6161,13 @@
                                 -55442669,
                                 -18314601,
                                 -6381831
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "61460dd7-7696-485e-b638-407e7b7dc99f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area STS1 (STS) [v3.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5029,6 +6184,13 @@
                                 52602966,
                                 -18339402,
                                 -5666868
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "61460dd7-7696-485e-b638-407e7b7dc99f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area STS1 (STS) [v3.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5066,6 +6228,13 @@
                                 -57958891,
                                 -8931681,
                                 -16581483
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7cef408f-0b23-46c3-8411-102cce3d86a0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area STS2 (STS) [v3.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5082,6 +6251,13 @@
                                 55536716,
                                 -8701651,
                                 -16698805
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7cef408f-0b23-46c3-8411-102cce3d86a0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area STS2 (STS) [v3.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5128,6 +6304,13 @@
                                 -65021452,
                                 -13798267,
                                 691213
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "03b1cb7b-f142-4612-bbd3-10fc7743bf13",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area TE 3 (STG) [v5.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5144,6 +6327,13 @@
                                 63517180,
                                 -9223240,
                                 -1006136
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "03b1cb7b-f142-4612-bbd3-10fc7743bf13",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area TE 3 (STG) [v5.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5190,6 +6380,13 @@
                                 -51139794,
                                 -7275300,
                                 2604631
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f00b4a71-4a30-4e55-9cfc-dccf4c72c8b2",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area TE 1.2 (HESCHL) [v5.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5206,6 +6403,13 @@
                                 53854260,
                                 -2428251,
                                 -1426009
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f00b4a71-4a30-4e55-9cfc-dccf4c72c8b2",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area TE 1.2 (HESCHL) [v5.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5243,6 +6447,13 @@
                                 -39537206,
                                 -29185649,
                                 11225133
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "85ad6ef7-228a-4543-a0b1-71ccf11bc69c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area TE 1.1 (HESCHL) [v5.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5259,6 +6470,13 @@
                                 40353878,
                                 -24757143,
                                 10842857
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "85ad6ef7-228a-4543-a0b1-71ccf11bc69c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area TE 1.1 (HESCHL) [v5.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5307,6 +6525,13 @@
                                 -47745772,
                                 -19329763,
                                 7810034
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8a105954-a724-428d-aed8-6c8d50fe4218",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area TE 1.0 (HESCHL) [v5.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5323,6 +6548,13 @@
                                 49200565,
                                 -12937288,
                                 5319209
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8a105954-a724-428d-aed8-6c8d50fe4218",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area TE 1.0 (HESCHL) [v5.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5379,6 +6611,13 @@
                                 -30094949,
                                 -68384410,
                                 -12800146
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "a00577ca-5089-443d-918e-b99531efd5e9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area FG1 (FusG) [v1.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5395,6 +6634,13 @@
                                 32164756,
                                 -65600287,
                                 -12459885
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "a00577ca-5089-443d-918e-b99531efd5e9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area FG1 (FusG) [v1.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5431,6 +6677,13 @@
                                 -44817844,
                                 -46757217,
                                 -19517597
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e7a2b57c-c4f0-41b9-8d80-8accd509497b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area FG4 (FusG) [v6.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5447,6 +6700,13 @@
                                 42929445,
                                 -44444275,
                                 -21712296
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e7a2b57c-c4f0-41b9-8d80-8accd509497b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area FG4 (FusG) [v6.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5484,6 +6744,13 @@
                                 -31763265,
                                 -47519967,
                                 -14980126
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "34f29154-e210-4bef-9510-73b77f727132",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area FG3 (FusG) [v6.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5500,6 +6767,13 @@
                                 30835007,
                                 -45941176,
                                 -15743424
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "34f29154-e210-4bef-9510-73b77f727132",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area FG3 (FusG) [v6.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5548,6 +6822,13 @@
                                 -44484053,
                                 -67922326,
                                 -16558015
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "526f6a7d-e8f8-4a8e-a895-a92696281eb9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area FG2 (FusG) [v1.4, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5564,6 +6845,13 @@
                                 44057346,
                                 -64586582,
                                 -16661544
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "526f6a7d-e8f8-4a8e-a895-a92696281eb9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area FG2 (FusG) [v1.4, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5618,6 +6906,13 @@
                                 -10315842,
                                 41083498,
                                 11735644
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8b778e42-b3f2-41e2-8295-a6f0e1f20721",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area p24c (pACC) [v16.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5634,6 +6929,13 @@
                                 9082066,
                                 42907018,
                                 11145614
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8b778e42-b3f2-41e2-8295-a6f0e1f20721",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area p24c (pACC) [v16.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5671,6 +6973,13 @@
                                 -3951741,
                                 38786470,
                                 4481049
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1acd6cd6-6941-4228-94fa-9da5ce014503",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area p24ab (pACC) [v16.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5687,6 +6996,13 @@
                                 2508004,
                                 39161686,
                                 6891142
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1acd6cd6-6941-4228-94fa-9da5ce014503",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area p24ab (pACC) [v16.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5724,6 +7040,13 @@
                                 -7960610,
                                 35317027,
                                 -14716010
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "57ac8798-a260-4c9b-8f9c-3e32d1dd3aca",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area s32 (sACC) [v16.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5740,6 +7063,13 @@
                                 2693907,
                                 34682777,
                                 -15008494
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "57ac8798-a260-4c9b-8f9c-3e32d1dd3aca",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area s32 (sACC) [v16.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5777,6 +7107,13 @@
                                 -5565878,
                                 12434122,
                                 -13119932
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "74bc9736-7044-4c72-b7bb-15739ae70e1e",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 25 (sACC) [v16.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5793,6 +7130,13 @@
                                 3297386,
                                 11678649,
                                 -13530501
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "74bc9736-7044-4c72-b7bb-15739ae70e1e",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 25 (sACC) [v16.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5830,6 +7174,13 @@
                                 -4719528,
                                 24562540,
                                 -11547224
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2092649c-7880-4d13-9537-a8f5a71dccf3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area s24 (sACC) [v16.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5846,6 +7197,13 @@
                                 2316712,
                                 23962938,
                                 -10923181
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2092649c-7880-4d13-9537-a8f5a71dccf3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area s24 (sACC) [v16.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5883,6 +7241,13 @@
                                 -8368982,
                                 49719698,
                                 10114173
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7a326443-3ced-482f-8772-fb948b0f298f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area p32 (pACC) [v16.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5899,6 +7264,13 @@
                                 6403235,
                                 50410059,
                                 10022042
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7a326443-3ced-482f-8772-fb948b0f298f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area p32 (pACC) [v16.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5936,6 +7308,13 @@
                                 -6094628,
                                 15035613,
                                 15966015
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2801b466-fc6e-4079-91da-1f2a5180f76c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 33 (ACC) [v16.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5952,6 +7331,13 @@
                                 4398596,
                                 17026911,
                                 15680187
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2801b466-fc6e-4079-91da-1f2a5180f76c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 33 (ACC) [v16.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5998,6 +7384,13 @@
                                 -23891483,
                                 -7276972,
                                 -35148896
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f251d71c-32ac-489d-b96d-fe5e1297fcb7",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Entorhinal Cortex [v11.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6014,6 +7407,13 @@
                                 21129607,
                                 -4977075,
                                 -34844921
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f251d71c-32ac-489d-b96d-fe5e1297fcb7",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Entorhinal Cortex [v11.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6062,6 +7462,13 @@
                                 -28408447,
                                 -27605379,
                                 -12640617
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f02f274f-5e8f-4c0b-a4c8-eef628a8af01",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "CA (Hippocampus) [v11.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6078,6 +7485,13 @@
                                 27668137,
                                 -26314056,
                                 -11735266
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f02f274f-5e8f-4c0b-a4c8-eef628a8af01",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "CA (Hippocampus) [v11.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6114,6 +7528,13 @@
                                 -27551185,
                                 -28070616,
                                 -11281043
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "677c84c3-56b2-4671-bc63-15d3dda730a2",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "DG (Hippocampus) [v11.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6130,6 +7551,13 @@
                                 26996134,
                                 -25789948,
                                 -11462629
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "677c84c3-56b2-4671-bc63-15d3dda730a2",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "DG (Hippocampus) [v11.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6167,6 +7595,13 @@
                                 -22231264,
                                 -25557482,
                                 -18551904
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1153f14e-100f-477e-bf95-89fb0af6d80b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Subiculum (Hippocampus) [v11.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6183,6 +7618,13 @@
                                 21763286,
                                 -24252804,
                                 -18015846
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1153f14e-100f-477e-bf95-89fb0af6d80b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Subiculum (Hippocampus) [v11.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6220,6 +7662,13 @@
                                 -14934109,
                                 -11686047,
                                 -20011628
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "4225fb8e-b9b4-456a-961e-9db90acac575",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "HATA (Hippocampus) [v11.1, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6236,6 +7685,13 @@
                                 13262963,
                                 -10581481,
                                 -18866667
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "4225fb8e-b9b4-456a-961e-9db90acac575",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "HATA (Hippocampus) [v11.1, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6309,6 +7765,13 @@
                                 -9205882,
                                 -57128342,
                                 -32224599
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "658a7f71-1b94-4f4a-8f15-726043bbb52a",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Interposed Nucleus (Cerebellum) [v6.2, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6325,6 +7788,13 @@
                                 6034375,
                                 -56068750,
                                 -32600000
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "658a7f71-1b94-4f4a-8f15-726043bbb52a",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Interposed Nucleus (Cerebellum) [v6.2, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6371,6 +7841,13 @@
                                 -17069823,
                                 -58618780,
                                 -38297753
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "870cdd4a-fdb4-4d70-9c3d-d459a122c845",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Dorsal Dentate Nucleus (Cerebellum) [v6.2, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6387,6 +7864,13 @@
                                 13542553,
                                 -60120346,
                                 -37750665
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "870cdd4a-fdb4-4d70-9c3d-d459a122c845",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Dorsal Dentate Nucleus (Cerebellum) [v6.2, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6424,6 +7908,13 @@
                                 -13748954,
                                 -58276151,
                                 -31782427
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "d3e0ae99-49f4-4bb1-a394-c9c12016ed2f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Ventral Dentate Nucleus (Cerebellum) [v6.2, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6440,6 +7931,13 @@
                                 10255877,
                                 -57747740,
                                 -32527125
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "d3e0ae99-49f4-4bb1-a394-c9c12016ed2f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Ventral Dentate Nucleus (Cerebellum) [v6.2, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6486,6 +7984,13 @@
                                 -4666667,
                                 -54963333,
                                 -30763333
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "dec5c207-c0d9-4f25-a333-1db039c570cb",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Fastigial Nucleus (Cerebellum) [v6.2, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6502,6 +8007,13 @@
                                 1261658,
                                 -54932642,
                                 -30598446
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "dec5c207-c0d9-4f25-a333-1db039c570cb",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Fastigial Nucleus (Cerebellum) [v6.2, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6548,6 +8060,13 @@
                                 -9205882,
                                 -57128342,
                                 -32224599
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "658a7f71-1b94-4f4a-8f15-726043bbb52a",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Interposed Nucleus (Cerebellum) [v6.2, ICBM 2009c Asymmetric, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6564,6 +8083,13 @@
                                 6034375,
                                 -56068750,
                                 -32600000
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "658a7f71-1b94-4f4a-8f15-726043bbb52a",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Interposed Nucleus (Cerebellum) [v6.2, ICBM 2009c Asymmetric, right hemisphere]"
+                                }
                               ]
                             }
                           ],
diff --git a/src/res/ext/colin.json b/src/res/ext/colin.json
index d80629a3b3dedf68cf0958d94ce55353ac0cbde0..0bfba5ad72b835a7937719b0942b0ef39477aa21 100644
--- a/src/res/ext/colin.json
+++ b/src/res/ext/colin.json
@@ -162,6 +162,13 @@
                                 -16053628,
                                 -454259,
                                 -12470032
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "791a14c8-b899-414f-b237-27574a4cce7e",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Ch 4 (Basal Forebrain) [v4.2, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -179,6 +186,13 @@
                                 17655072,
                                 263768,
                                 -11539130
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "791a14c8-b899-414f-b237-27574a4cce7e",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Ch 4 (Basal Forebrain) [v4.2, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -288,7 +302,14 @@
                               "labelIndex": 15,
                               "ngId": "jubrain colin v18 left",
                               "children": [],
-                              "status": "publicP"
+                              "status": "publicP",
+                              "originDatasets": [
+                                {
+                                  "kgId": "fa4cab6a-1cec-4cec-b481-90aa0cc7d96c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "LB (Amygdala) [v6.4, Colin 27, left hemisphere]"
+                                }
+                              ]
                             },
                             {
                               "name": "LB (Amygdala) - right hemisphere",
@@ -296,7 +317,14 @@
                               "ngId": "jubrain colin v18 right",
                               "labelIndex": 15,
                               "children": [],
-                              "status": "publicP"
+                              "status": "publicP",
+                              "originDatasets": [
+                                {
+                                  "kgId": "fa4cab6a-1cec-4cec-b481-90aa0cc7d96c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "LB (Amygdala) [v6.4, Colin 27, right hemisphere]"
+                                }
+                              ]
                             }
                           ],
                           "fullId": {
@@ -322,7 +350,14 @@
                               "labelIndex": 11,
                               "ngId": "jubrain colin v18 left",
                               "children": [],
-                              "status": "publicP"
+                              "status": "publicP",
+                              "originDatasets": [
+                                {
+                                  "kgId": "fa4cab6a-1cec-4cec-b481-90aa0cc7d96c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "LB (Amygdala) [v6.4, Colin 27, left hemisphere]"
+                                }
+                              ]
                             },
                             {
                               "name": "LB (Amygdala) - right hemisphere",
@@ -330,7 +365,14 @@
                               "ngId": "jubrain colin v18 right",
                               "labelIndex": 11,
                               "children": [],
-                              "status": "publicP"
+                              "status": "publicP",
+                              "originDatasets": [
+                                {
+                                  "kgId": "fa4cab6a-1cec-4cec-b481-90aa0cc7d96c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "LB (Amygdala) [v6.4, Colin 27, right hemisphere]"
+                                }
+                              ]
                             }
                           ],
                           "fullId": {
@@ -356,7 +398,14 @@
                               "labelIndex": 19,
                               "ngId": "jubrain colin v18 left",
                               "children": [],
-                              "status": "publicP"
+                              "status": "publicP",
+                              "originDatasets": [
+                                {
+                                  "kgId": "fa4cab6a-1cec-4cec-b481-90aa0cc7d96c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "LB (Amygdala) [v6.4, Colin 27, left hemisphere]"
+                                }
+                              ]
                             },
                             {
                               "name": "LB (Amygdala) - right hemisphere",
@@ -364,7 +413,14 @@
                               "ngId": "jubrain colin v18 right",
                               "labelIndex": 19,
                               "children": [],
-                              "status": "publicP"
+                              "status": "publicP",
+                              "originDatasets": [
+                                {
+                                  "kgId": "fa4cab6a-1cec-4cec-b481-90aa0cc7d96c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "LB (Amygdala) [v6.4, Colin 27, right hemisphere]"
+                                }
+                              ]
                             }
                           ],
                           "fullId": {
@@ -395,6 +451,13 @@
                                 -25304803,
                                 -1696429,
                                 -23766626
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "fa4cab6a-1cec-4cec-b481-90aa0cc7d96c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "LB (Amygdala) [v6.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -408,6 +471,13 @@
                                 28015494,
                                 -81343,
                                 -24045836
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "fa4cab6a-1cec-4cec-b481-90aa0cc7d96c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "LB (Amygdala) [v6.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -448,6 +518,13 @@
                                 -16044471,
                                 530048,
                                 -20831731
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "37a6a7d9-5252-4605-a792-6fefe2fde816",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "SF (Amygdala) [v6.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -461,6 +538,13 @@
                                 19382770,
                                 1539804,
                                 -19413304
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "37a6a7d9-5252-4605-a792-6fefe2fde816",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "SF (Amygdala) [v6.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -487,7 +571,14 @@
                               "labelIndex": 17,
                               "ngId": "jubrain colin v18 left",
                               "children": [],
-                              "status": "publicP"
+                              "status": "publicP",
+                              "originDatasets": [
+                                {
+                                  "kgId": "37a6a7d9-5252-4605-a792-6fefe2fde816",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "SF (Amygdala) [v6.4, Colin 27, left hemisphere]"
+                                }
+                              ]
                             },
                             {
                               "name": "SF (Amygdala) - right hemisphere",
@@ -495,7 +586,14 @@
                               "ngId": "jubrain colin v18 right",
                               "labelIndex": 17,
                               "children": [],
-                              "status": "publicP"
+                              "status": "publicP",
+                              "originDatasets": [
+                                {
+                                  "kgId": "37a6a7d9-5252-4605-a792-6fefe2fde816",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "SF (Amygdala) [v6.4, Colin 27, right hemisphere]"
+                                }
+                              ]
                             }
                           ],
                           "fullId": {
@@ -529,7 +627,14 @@
                               "labelIndex": 186,
                               "ngId": "jubrain colin v18 left",
                               "children": [],
-                              "status": "publicP"
+                              "status": "publicP",
+                              "originDatasets": [
+                                {
+                                  "kgId": "37a6a7d9-5252-4605-a792-6fefe2fde816",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "SF (Amygdala) [v6.4, Colin 27, left hemisphere]"
+                                }
+                              ]
                             },
                             {
                               "name": "SF (Amygdala) - right hemisphere",
@@ -541,7 +646,14 @@
                               "ngId": "jubrain colin v18 right",
                               "labelIndex": 186,
                               "children": [],
-                              "status": "publicP"
+                              "status": "publicP",
+                              "originDatasets": [
+                                {
+                                  "kgId": "37a6a7d9-5252-4605-a792-6fefe2fde816",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "SF (Amygdala) [v6.4, Colin 27, right hemisphere]"
+                                }
+                              ]
                             }
                           ],
                           "fullId": {
@@ -575,7 +687,14 @@
                               "labelIndex": 22,
                               "ngId": "jubrain colin v18 left",
                               "children": [],
-                              "status": "publicP"
+                              "status": "publicP",
+                              "originDatasets": [
+                                {
+                                  "kgId": "21ed6af0-5c39-4153-a3b8-8983530436ac",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "CM (Amygdala) [v6.4, Colin 27, left hemisphere]"
+                                }
+                              ]
                             },
                             {
                               "name": "CM (Amygdala) - right hemisphere",
@@ -587,7 +706,14 @@
                               "ngId": "jubrain colin v18 right",
                               "labelIndex": 22,
                               "children": [],
-                              "status": "publicP"
+                              "status": "publicP",
+                              "originDatasets": [
+                                {
+                                  "kgId": "21ed6af0-5c39-4153-a3b8-8983530436ac",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "CM (Amygdala) [v6.4, Colin 27, right hemisphere]"
+                                }
+                              ]
                             }
                           ],
                           "fullId": {
@@ -635,6 +761,13 @@
                                 -23377907,
                                 -9837209,
                                 -14848837
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "9428d48e-f222-4191-96b8-02d3fa6068da",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "VTM (Amygdala) [v6.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -652,6 +785,13 @@
                                 25513514,
                                 -8881081,
                                 -15551351
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "9428d48e-f222-4191-96b8-02d3fa6068da",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "VTM (Amygdala) [v6.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -691,6 +831,13 @@
                                 -27588235,
                                 -1431373,
                                 -17460784
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "3acdb92c-68f0-42db-a7af-9dbb69cbea1d",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "IF (Amygdala) [v6.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -708,6 +855,13 @@
                                 29372549,
                                 -813725,
                                 -16578431
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "3acdb92c-68f0-42db-a7af-9dbb69cbea1d",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "IF (Amygdala) [v6.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -747,6 +901,13 @@
                                 -18714286,
                                 -6523810,
                                 -15428571
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1ea87428-a211-439f-b258-40fa3e3363c9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "MF (Amygdala) [v6.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -764,6 +925,13 @@
                                 20976744,
                                 -4930233,
                                 -14441860
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1ea87428-a211-439f-b258-40fa3e3363c9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "MF (Amygdala) [v6.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -807,7 +975,14 @@
                               "labelIndex": 16,
                               "ngId": "jubrain colin v18 left",
                               "children": [],
-                              "status": "publicP"
+                              "status": "publicP",
+                              "originDatasets": [
+                                {
+                                  "kgId": "21ed6af0-5c39-4153-a3b8-8983530436ac",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "CM (Amygdala) [v6.4, Colin 27, left hemisphere]"
+                                }
+                              ]
                             },
                             {
                               "name": "CM (Amygdala) - right hemisphere",
@@ -819,7 +994,14 @@
                               "ngId": "jubrain colin v18 right",
                               "labelIndex": 16,
                               "children": [],
-                              "status": "publicP"
+                              "status": "publicP",
+                              "originDatasets": [
+                                {
+                                  "kgId": "21ed6af0-5c39-4153-a3b8-8983530436ac",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "CM (Amygdala) [v6.4, Colin 27, right hemisphere]"
+                                }
+                              ]
                             }
                           ],
                           "fullId": {
@@ -858,6 +1040,13 @@
                                 -21108108,
                                 -3376448,
                                 -13214286
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "21ed6af0-5c39-4153-a3b8-8983530436ac",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "CM (Amygdala) [v6.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -875,6 +1064,13 @@
                                 23157767,
                                 -2679612,
                                 -12555825
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "21ed6af0-5c39-4153-a3b8-8983530436ac",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "CM (Amygdala) [v6.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -941,6 +1137,13 @@
                                 -18807832,
                                 -47524930,
                                 66950353
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1100df93-93f4-4091-bf2e-6eb48a2d56ff",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 5L (SPL) [v8.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -958,6 +1161,13 @@
                                 12970516,
                                 -51174624,
                                 70371695
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1100df93-93f4-4091-bf2e-6eb48a2d56ff",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 5L (SPL) [v8.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -997,6 +1207,13 @@
                                 -777896,
                                 -78103082,
                                 35256111
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1715e680-a492-49a2-8f54-025aa41819da",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 7M (SPL) [v8.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1014,6 +1231,13 @@
                                 4281250,
                                 -75882812,
                                 38312500
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1715e680-a492-49a2-8f54-025aa41819da",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 7M (SPL) [v8.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1053,6 +1277,13 @@
                                 -32056266,
                                 -48916454,
                                 60868713
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8cc9b1dd-caa6-49d5-85f1-1e2e78be3161",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 7PC (SPL) [v8.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1070,6 +1301,13 @@
                                 30055171,
                                 -49079568,
                                 61493485
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8cc9b1dd-caa6-49d5-85f1-1e2e78be3161",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 7PC (SPL) [v8.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1109,6 +1347,13 @@
                                 -7527881,
                                 -41962560,
                                 59221721
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "5ddbc06e-b30c-4d44-a4c0-107210a66b4f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 5M (SPL) [v8.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1126,6 +1371,13 @@
                                 4642562,
                                 -44304959,
                                 60273140
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "5ddbc06e-b30c-4d44-a4c0-107210a66b4f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 5M (SPL) [v8.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1165,6 +1417,13 @@
                                 -7679310,
                                 -76043295,
                                 52631801
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "5fd792b5-c306-4fb4-8d29-205dc3536476",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 7P (SPL) [v8.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1182,6 +1441,13 @@
                                 14232037,
                                 -74892094,
                                 56304919
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "5fd792b5-c306-4fb4-8d29-205dc3536476",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 7P (SPL) [v8.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1221,6 +1487,13 @@
                                 -14033790,
                                 -35828311,
                                 43857534
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "fe83803d-f6dc-4341-98a0-a5aeccd63651",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 5Ci (SPL) [v8.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1238,6 +1511,13 @@
                                 10563961,
                                 -36194957,
                                 46892989
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "fe83803d-f6dc-4341-98a0-a5aeccd63651",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 5Ci (SPL) [v8.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1277,6 +1557,13 @@
                                 -20856230,
                                 -62269710,
                                 61643512
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f2635688-3894-471f-88db-c065871582de",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 7A (SPL) [v8.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1294,6 +1581,13 @@
                                 20910951,
                                 -62880523,
                                 62944473
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f2635688-3894-471f-88db-c065871582de",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 7A (SPL) [v8.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1352,6 +1646,13 @@
                                 -40814044,
                                 -13737321,
                                 17669701
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "eddb0ef1-21d6-4271-ad36-f6c81ddba642",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP3 (POperc) [v9.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1369,6 +1670,13 @@
                                 41195980,
                                 -11633166,
                                 18002513
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "eddb0ef1-21d6-4271-ad36-f6c81ddba642",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP3 (POperc) [v9.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1408,6 +1716,13 @@
                                 -60514139,
                                 -10849614,
                                 15368038
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "55213785-8693-438c-8f6b-7628609b4017",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP4 (POperc) [v9.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1425,6 +1740,13 @@
                                 63398148,
                                 -9211111,
                                 12780864
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "55213785-8693-438c-8f6b-7628609b4017",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP4 (POperc) [v9.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1464,6 +1786,13 @@
                                 -36355372,
                                 -23452479,
                                 18938017
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "0a3e9feb-5816-4593-a5c8-ca4b9099f7b8",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP2 (POperc) [v9.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1481,6 +1810,13 @@
                                 35629457,
                                 -21159690,
                                 18021705
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "0a3e9feb-5816-4593-a5c8-ca4b9099f7b8",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP2 (POperc) [v9.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1520,6 +1856,13 @@
                                 -51566527,
                                 -22523828,
                                 17190240
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1802ffb1-6d1a-4c1a-a7d9-170664a98b49",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP1 (POperc) [v9.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1537,6 +1880,13 @@
                                 52888430,
                                 -20697107,
                                 17000826
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1802ffb1-6d1a-4c1a-a7d9-170664a98b49",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP1 (POperc) [v9.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1596,6 +1946,13 @@
                                 -44439219,
                                 -21735041,
                                 46012387
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "50ac42dd-5808-459c-882a-dbd98c76999c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 3b (PostCG) [v8.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1613,6 +1970,13 @@
                                 38765839,
                                 -25096118,
                                 48227174
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "50ac42dd-5808-459c-882a-dbd98c76999c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 3b (PostCG) [v8.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1651,6 +2015,13 @@
                                 -47104485,
                                 -28297920,
                                 57798046
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "ce8c8428-02fe-42f8-9a76-d297579b71c9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 1 (PostCG) [v8.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1668,6 +2039,13 @@
                                 48452543,
                                 -27132790,
                                 56150187
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "ce8c8428-02fe-42f8-9a76-d297579b71c9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 1 (PostCG) [v8.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1707,6 +2085,13 @@
                                 -42268059,
                                 -32424512,
                                 51210202
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e81716df-d1ab-417b-b69c-3da566aab026",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 2 (PostCS) [v3.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1724,6 +2109,13 @@
                                 38223619,
                                 -34651627,
                                 52535010
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e81716df-d1ab-417b-b69c-3da566aab026",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 2 (PostCS) [v3.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1763,6 +2155,13 @@
                                 -31927553,
                                 -25650901,
                                 44513889
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "d2c20dce-122e-4c69-922a-1f33909496cf",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 3a (PostCG) [v8.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1780,6 +2179,13 @@
                                 38813714,
                                 -19184000,
                                 36284571
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "d2c20dce-122e-4c69-922a-1f33909496cf",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 3a (PostCG) [v8.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1839,6 +2245,13 @@
                                 -59814938,
                                 -37432365,
                                 36569295
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e1528fe1-a812-44d9-a0ca-f738b0e705e3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PF (IPL) [v9.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1856,6 +2269,13 @@
                                 64016699,
                                 -33052700,
                                 30153112
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e1528fe1-a812-44d9-a0ca-f738b0e705e3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PF (IPL) [v9.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1905,6 +2325,13 @@
                                 -51751410,
                                 -36954069,
                                 22546334
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "03520da2-e553-4284-84e4-d8b293446cd4",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PFcm (IPL) [v9.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1922,6 +2349,13 @@
                                 53524370,
                                 -31637287,
                                 23177904
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "03520da2-e553-4284-84e4-d8b293446cd4",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PFcm (IPL) [v9.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -1971,6 +2405,13 @@
                                 -48873487,
                                 -60780569,
                                 37191889
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "25451957-c246-4a42-99d4-07c88d4e78fc",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PGa (IPL) [v9.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -1988,6 +2429,13 @@
                                 55283797,
                                 -55333653,
                                 30316395
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "25451957-c246-4a42-99d4-07c88d4e78fc",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PGa (IPL) [v9.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2037,6 +2485,13 @@
                                 -55015237,
                                 -27583919,
                                 38095874
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "b5375459-2b03-4c67-a125-25c923180017",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PFt (IPL) [v9.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2054,6 +2509,13 @@
                                 54808632,
                                 -24626296,
                                 37973570
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "b5375459-2b03-4c67-a125-25c923180017",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PFt (IPL) [v9.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2103,6 +2565,13 @@
                                 -54527689,
                                 -52389045,
                                 38877207
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "3a076c3e-75f4-4626-a0e8-f23bcf8b8ef0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PFm (IPL) [v9.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2120,6 +2589,13 @@
                                 56990022,
                                 -45541717,
                                 38606571
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "3a076c3e-75f4-4626-a0e8-f23bcf8b8ef0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PFm (IPL) [v9.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2158,6 +2634,13 @@
                                 -44673441,
                                 -73269937,
                                 29840224
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2105576e-e1b0-4e03-9cb4-8c2b65be2f96",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PGp (IPL) [v9.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2175,6 +2658,13 @@
                                 47749459,
                                 -70528695,
                                 30721440
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2105576e-e1b0-4e03-9cb4-8c2b65be2f96",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PGp (IPL) [v9.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2224,6 +2714,13 @@
                                 -60026462,
                                 -24694986,
                                 24259053
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "29c1cad2-0a55-49ec-b7f5-a9acf5db7c1f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PFop (IPL) [v9.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2241,6 +2738,13 @@
                                 58286575,
                                 -20617534,
                                 24917260
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "29c1cad2-0a55-49ec-b7f5-a9acf5db7c1f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area PFop (IPL) [v9.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2299,6 +2803,13 @@
                                 -15069260,
                                 -80661951,
                                 37074565
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7593b453-f916-4bd0-ae2b-d4cbff307428",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hPO1 (POS) [v7.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2316,6 +2827,13 @@
                                 21853147,
                                 -80927739,
                                 37048660
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7593b453-f916-4bd0-ae2b-d4cbff307428",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hPO1 (POS) [v7.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2364,6 +2882,13 @@
                                 -36841999,
                                 -49449871,
                                 40584028
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "3367db70-cd25-4834-9646-9604308dfa02",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP1 (IPS) [v6.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2381,6 +2906,13 @@
                                 40629988,
                                 -48019372,
                                 39158853
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "3367db70-cd25-4834-9646-9604308dfa02",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP1 (IPS) [v6.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2420,6 +2952,13 @@
                                 -22044741,
                                 -79989011,
                                 29353218
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "aff5df97-f341-4370-97af-58d9f40c9877",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP7 (IPS) [v7.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2437,6 +2976,13 @@
                                 29041586,
                                 -79117828,
                                 27046207
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "aff5df97-f341-4370-97af-58d9f40c9877",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP7 (IPS) [v7.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2476,6 +3022,13 @@
                                 -30430769,
                                 -55031164,
                                 46842209
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "bd1062af-e9c5-4b8d-9742-2172be4fef93",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP3 (IPS) [v8.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2493,6 +3046,13 @@
                                 33538679,
                                 -49884591,
                                 50461950
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "bd1062af-e9c5-4b8d-9742-2172be4fef93",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP3 (IPS) [v8.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2532,6 +3092,13 @@
                                 -46531100,
                                 -41482722,
                                 43278044
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "a8ee352c-13fc-45fd-9522-c7ac9de9bd61",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP2 (IPS) [v6.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2549,6 +3116,13 @@
                                 44605145,
                                 -39958613,
                                 45130872
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "a8ee352c-13fc-45fd-9522-c7ac9de9bd61",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP2 (IPS) [v6.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2588,6 +3162,13 @@
                                 -29349066,
                                 -79948651,
                                 25849585
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f2ec3ab5-c604-4dd6-b941-ffc37288cc46",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP4 (IPS) [v7.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2605,6 +3186,13 @@
                                 37324927,
                                 -76495150,
                                 22338021
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f2ec3ab5-c604-4dd6-b941-ffc37288cc46",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP4 (IPS) [v7.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2644,6 +3232,13 @@
                                 -28321120,
                                 -73162807,
                                 36664362
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "24b2682f-5c82-4439-8278-bc526b530030",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP5 (IPS) [v7.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2661,6 +3256,13 @@
                                 34614713,
                                 -68930590,
                                 33299252
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "24b2682f-5c82-4439-8278-bc526b530030",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP5 (IPS) [v7.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2700,6 +3302,13 @@
                                 -31988131,
                                 -66522626,
                                 46155045
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e51da69b-f5de-49d5-9566-6fde3ef14d80",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP6 (IPS) [v7.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2717,6 +3326,13 @@
                                 37069307,
                                 -63723479,
                                 45628006
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e51da69b-f5de-49d5-9566-6fde3ef14d80",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP6 (IPS) [v7.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2756,6 +3372,13 @@
                                 -18133307,
                                 -72231198,
                                 43245125
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2dba112f-075c-4dba-813d-e408ff429586",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP8 (IPS) [v7.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2773,6 +3396,13 @@
                                 26220986,
                                 -71480127,
                                 41680048
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2dba112f-075c-4dba-813d-e408ff429586",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hIP8 (IPS) [v7.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2830,6 +3460,13 @@
                                 -15925775,
                                 -70685971,
                                 16518760
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f3a24a48-3d23-4d92-9de6-e13dc888f1b5",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc6 (POS) [v7.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2847,6 +3484,13 @@
                                 17750454,
                                 -67625227,
                                 17755898
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f3a24a48-3d23-4d92-9de6-e13dc888f1b5",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc6 (POS) [v7.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2886,6 +3530,13 @@
                                 -17209585,
                                 -87846006,
                                 25522684
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "704230e3-434b-45d7-875c-05600272f01a",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc4d (Cuneus) [v2.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2903,6 +3554,13 @@
                                 20232373,
                                 -87193644,
                                 27253227
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "704230e3-434b-45d7-875c-05600272f01a",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc4d (Cuneus) [v2.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -2942,6 +3600,13 @@
                                 -12816505,
                                 -91289984,
                                 21840872
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "13c8ab3f-ec22-4f61-8abb-fca2d5fbbdbc",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc3d (Cuneus) [v2.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -2959,6 +3624,13 @@
                                 16129503,
                                 -88897084,
                                 23080617
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "13c8ab3f-ec22-4f61-8abb-fca2d5fbbdbc",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc3d (Cuneus) [v2.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3007,6 +3679,13 @@
                                 -18685863,
                                 -85629087,
                                 -10106719
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "76b837d8-5c64-4c50-b825-efbbe72f6625",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc3v (LingG) [v3.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3024,6 +3703,13 @@
                                 24296060,
                                 -81686611,
                                 -10031193
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "76b837d8-5c64-4c50-b825-efbbe72f6625",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc3v (LingG) [v3.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3063,6 +3749,13 @@
                                 -26315808,
                                 -78419533,
                                 -12497238
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e2d948e4-f52d-4f02-a635-017f3c71186c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc4v (LingG) [v3.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3080,6 +3773,13 @@
                                 32665897,
                                 -76519832,
                                 -12453305
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e2d948e4-f52d-4f02-a635-017f3c71186c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc4v (LingG) [v3.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3128,6 +3828,13 @@
                                 -10521334,
                                 -88185706,
                                 4055081
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "fa2af93e-c0bb-4c76-bdfe-52776a37d0c0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc2 (V2, 18) [v2.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3145,6 +3852,13 @@
                                 15409559,
                                 -86163484,
                                 2905309
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "fa2af93e-c0bb-4c76-bdfe-52776a37d0c0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc2 (V2, 18) [v2.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3176,6 +3890,13 @@
                                 132,
                                 147
                               ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "5c669b77-c981-424a-858d-fe9f527dbc07",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc1 (V1, 17, CalcS) [v2.4, Colin 27, left hemisphere]"
+                                }
+                              ],
                               "labelIndex": 8,
                               "ngId": "jubrain colin v18 left",
                               "children": [],
@@ -3193,6 +3914,13 @@
                                 132,
                                 147
                               ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "5c669b77-c981-424a-858d-fe9f527dbc07",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc1 (V1, 17, CalcS) [v2.4, Colin 27, right hemisphere]"
+                                }
+                              ],
                               "ngId": "jubrain colin v18 right",
                               "labelIndex": 8,
                               "children": [],
@@ -3259,6 +3987,13 @@
                                 -34066943,
                                 -88725728,
                                 6360721
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "487f86a9-2637-4cd1-bb33-f2b0db904697",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc4lp (LOC) [v3.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3276,6 +4011,13 @@
                                 38538256,
                                 -86375516,
                                 4086228
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "487f86a9-2637-4cd1-bb33-f2b0db904697",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc4lp (LOC) [v3.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3315,6 +4057,13 @@
                                 -42484324,
                                 -71486486,
                                 1795676
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "84897b6c-78d3-4dd4-bea9-dbb6459fba20",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc5 (LOC) [v2.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3332,6 +4081,13 @@
                                 48090700,
                                 -66172216,
                                 3121699
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "84897b6c-78d3-4dd4-bea9-dbb6459fba20",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc5 (LOC) [v2.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3371,6 +4127,13 @@
                                 -46291484,
                                 -76947955,
                                 -372761
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "304342d8-5d55-4dea-a97e-39dccc72a7a4",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc4la (LOC) [v3.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3388,6 +4151,13 @@
                                 48566255,
                                 -73862041,
                                 -779202
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "304342d8-5d55-4dea-a97e-39dccc72a7a4",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area hOc4la (LOC) [v3.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3465,6 +4235,13 @@
                                 -54242820,
                                 11425127,
                                 18292735
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8f180ff1-20d1-4112-9e71-a5c7eca6c369",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 44 (IFG) [v7.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3482,6 +4259,13 @@
                                 56359074,
                                 11741030,
                                 13444358
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8f180ff1-20d1-4112-9e71-a5c7eca6c369",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 44 (IFG) [v7.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3531,6 +4315,13 @@
                                 -54903012,
                                 26558233,
                                 15528514
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1db64761-aad6-4d3d-b67c-2a9ef4df6e47",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 45 (IFG) [v7.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3548,6 +4339,13 @@
                                 55787613,
                                 26216770,
                                 12102941
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1db64761-aad6-4d3d-b67c-2a9ef4df6e47",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 45 (IFG) [v7.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3595,6 +4393,13 @@
                                 -15757793,
                                 2030353,
                                 68024610
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "b2fa41bb-67ab-4c69-bbea-5108ef1d0dc3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6d2 (PreCG) [v4.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3612,6 +4417,13 @@
                                 14562976,
                                 2312675,
                                 68442439
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "b2fa41bb-67ab-4c69-bbea-5108ef1d0dc3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6d2 (PreCG) [v4.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3651,6 +4463,13 @@
                                 -20332759,
                                 -14746524,
                                 68590141
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "6a2ee2d8-120c-40de-b390-53ca87210298",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6d1 (PreCG) [v4.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3668,6 +4487,13 @@
                                 20258981,
                                 -16559656,
                                 68870890
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "6a2ee2d8-120c-40de-b390-53ca87210298",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6d1 (PreCG) [v4.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3716,6 +4542,13 @@
                                 -4083913,
                                 4296092,
                                 58555023
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "89347668-eee6-4be5-b783-8dddf422bba0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6ma (preSMA, mesial SFG) [v9.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3733,6 +4566,13 @@
                                 5230140,
                                 4042128,
                                 58355079
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "89347668-eee6-4be5-b783-8dddf422bba0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6ma (preSMA, mesial SFG) [v9.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3781,6 +4621,13 @@
                                 -23315931,
                                 4317151,
                                 51434008
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "502b40a0-1689-4329-854e-a77dfd94d30b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6d3 (SFS) [v4.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3798,6 +4645,13 @@
                                 25173639,
                                 1578188,
                                 53334281
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "502b40a0-1689-4329-854e-a77dfd94d30b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6d3 (SFS) [v4.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3846,6 +4700,13 @@
                                 -16331031,
                                 64168302,
                                 549101
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7a02d7b6-51f7-4f6f-a1c3-ca04b56cc107",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fp1 (FPole) [v2.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3863,6 +4724,13 @@
                                 18482225,
                                 63988011,
                                 -317043
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7a02d7b6-51f7-4f6f-a1c3-ca04b56cc107",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fp1 (FPole) [v2.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3902,6 +4770,13 @@
                                 -3739067,
                                 59074587,
                                 -1181973
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8d2f06b2-d3bd-4f89-a6e3-953c90cc9661",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fp2 (FPole) [v2.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3919,6 +4794,13 @@
                                 6093420,
                                 59611191,
                                 -509606
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8d2f06b2-d3bd-4f89-a6e3-953c90cc9661",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fp2 (FPole) [v2.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -3978,6 +4860,13 @@
                                 -36140917,
                                 -22750424,
                                 49282965
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "02a0087e-3fdc-4b95-826a-0a953490103b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 4p (PreCG) [v9.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -3995,6 +4884,13 @@
                                 37510795,
                                 -21359659,
                                 46456250
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "02a0087e-3fdc-4b95-826a-0a953490103b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 4p (PreCG) [v9.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4033,6 +4929,13 @@
                                 -17367391,
                                 -28669064,
                                 67404682
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "6e1728c2-dd89-40d4-a0ea-fdede469684f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 4a (PreCG) [v9.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4050,6 +4953,13 @@
                                 9609157,
                                 -31334779,
                                 68068112
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "6e1728c2-dd89-40d4-a0ea-fdede469684f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 4a (PreCG) [v9.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4098,6 +5008,13 @@
                                 -4094374,
                                 -14286751,
                                 59329220
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1e7ee33c-a1e4-49a9-9093-54520392dff9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6mp (SMA, mesial SFG) [v9.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4115,6 +5032,13 @@
                                 4949202,
                                 -13788668,
                                 57534028
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1e7ee33c-a1e4-49a9-9093-54520392dff9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 6mp (SMA, mesial SFG) [v9.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4163,6 +5087,13 @@
                                 -7962771,
                                 41364968,
                                 -22537687
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2153a21a-7fee-4fcd-9a91-6d23c494403b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo1 (OFC) [v3.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4180,6 +5111,13 @@
                                 9705948,
                                 40760961,
                                 -22481988
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2153a21a-7fee-4fcd-9a91-6d23c494403b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo1 (OFC) [v3.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4219,6 +5157,13 @@
                                 -21866985,
                                 33732378,
                                 -19882472
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "fca58db5-fadb-4314-a06c-75948110d7f0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo3 (OFC) [v3.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4236,6 +5181,13 @@
                                 22929678,
                                 33527877,
                                 -20231493
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "fca58db5-fadb-4314-a06c-75948110d7f0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo3 (OFC) [v3.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4275,6 +5227,13 @@
                                 -8588272,
                                 22532156,
                                 -20474464
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2e8f2ce5-abf8-4881-8ea6-4eddcb188c12",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo2 (OFC) [v3.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4292,6 +5251,13 @@
                                 9164379,
                                 21928964,
                                 -20593342
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2e8f2ce5-abf8-4881-8ea6-4eddcb188c12",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo2 (OFC) [v3.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4340,6 +5306,13 @@
                                 -41777921,
                                 17183344,
                                 7912847
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "43d46017-2bef-467b-b870-9866c838e4f3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP8 (Frontal Operculum) [v5.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4357,6 +5330,13 @@
                                 42725111,
                                 16774146,
                                 7832095
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "43d46017-2bef-467b-b870-9866c838e4f3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP8 (Frontal Operculum) [v5.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ]
@@ -4389,6 +5369,13 @@
                                 -45090542,
                                 25998787,
                                 5597413
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2034ee9f-69f8-4633-9b81-eaf4b8f44aed",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP9 (Frontal Operculum) [v5.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4406,6 +5393,13 @@
                                 44374928,
                                 26272467,
                                 2966228
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2034ee9f-69f8-4633-9b81-eaf4b8f44aed",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area OP9 (Frontal Operculum) [v5.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ]
@@ -4447,6 +5441,13 @@
                                 -38055351,
                                 56315867,
                                 -8720295
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "688bee67-abc0-4a17-9800-21c5c9bf3870",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo5 (OFC) [v2.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4464,6 +5465,13 @@
                                 40545983,
                                 54504228,
                                 -4983615
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "688bee67-abc0-4a17-9800-21c5c9bf3870",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo5 (OFC) [v2.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4503,6 +5511,13 @@
                                 -27573653,
                                 52998204,
                                 -14510778
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "d26dd88e-ae9d-41a1-a5c4-7e5b51f7e9c4",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo4 (OFC) [v2.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4520,6 +5535,13 @@
                                 33636124,
                                 52034755,
                                 -15509742
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "d26dd88e-ae9d-41a1-a5c4-7e5b51f7e9c4",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo4 (OFC) [v2.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4559,6 +5581,13 @@
                                 -44272971,
                                 42876258,
                                 -12938967
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "ab21e50f-c46d-45c5-b9f6-2b82d5728400",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo6 (OFC) [v2.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4576,6 +5605,13 @@
                                 48891176,
                                 40513824,
                                 -12457353
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "ab21e50f-c46d-45c5-b9f6-2b82d5728400",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo6 (OFC) [v2.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4615,6 +5651,13 @@
                                 -36046240,
                                 37308943,
                                 -11666667
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7d4726da-7023-4e64-8b60-9d0271766bea",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo7 (OFC) [v2.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4632,6 +5675,13 @@
                                 37850755,
                                 37700302,
                                 -13777644
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7d4726da-7023-4e64-8b60-9d0271766bea",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Fo7 (OFC) [v2.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4689,6 +5739,13 @@
                                 -33211215,
                                 -24171963,
                                 9923364
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "30d68317-ee5b-4975-b643-4468eb8dfbe3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Ig1 (Insula) [v13.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4706,6 +5763,13 @@
                                 33707983,
                                 -23338235,
                                 9071429
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "30d68317-ee5b-4975-b643-4468eb8dfbe3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Ig1 (Insula) [v13.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4801,6 +5865,13 @@
                                 -37117338,
                                 -17859895,
                                 5094571
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f06b5ac4-3dff-4f92-a9b5-9a16fd4cf147",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Ig2 (Insula) [v13.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4818,6 +5889,13 @@
                                 37843632,
                                 -16445145,
                                 5703657
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f06b5ac4-3dff-4f92-a9b5-9a16fd4cf147",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Ig2 (Insula) [v13.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4866,6 +5944,13 @@
                                 -41612827,
                                 -1876485,
                                 -7019002
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8c98a495-a8d6-4fe8-8de1-5fd876e37d3f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Ia (Insula) [v3.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4883,6 +5968,13 @@
                                 43525000,
                                 36538,
                                 -7609615
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8c98a495-a8d6-4fe8-8de1-5fd876e37d3f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Ia (Insula) [v3.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -4931,6 +6023,13 @@
                                 -30926962,
                                 23741297,
                                 4787031
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2da42b86-d839-41e8-bb27-1bb7697e3868",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id7 (Insula) [v6.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -4948,6 +6047,13 @@
                                 35034429,
                                 24873239,
                                 2446009
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2da42b86-d839-41e8-bb27-1bb7697e3868",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id7 (Insula) [v6.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5052,6 +6158,13 @@
                                 -40090747,
                                 -18279359,
                                 -4567616
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "456e67e7-ef36-4d1e-8b2e-0a1b40831086",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id1 (Insula) [v13.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5069,6 +6182,13 @@
                                 40527825,
                                 -17443508,
                                 -4688027
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "456e67e7-ef36-4d1e-8b2e-0a1b40831086",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id1 (Insula) [v13.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5164,6 +6284,13 @@
                                 -40174302,
                                 -3354190,
                                 741899
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "bfee9d73-2ea3-4b35-9e99-8862e1ed59a9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id5 (Insula) [v3.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5181,6 +6308,13 @@
                                 41094953,
                                 -2659538,
                                 607357
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "bfee9d73-2ea3-4b35-9e99-8862e1ed59a9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id5 (Insula) [v3.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5220,6 +6354,13 @@
                                 -36392282,
                                 9843698,
                                 3385341
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "a98c1711-4d2c-4351-bc63-c3f827f41eab",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id6 (Insula) [v3.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5237,6 +6378,13 @@
                                 37750946,
                                 10762642,
                                 3041624
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "a98c1711-4d2c-4351-bc63-c3f827f41eab",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id6 (Insula) [v3.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5276,6 +6424,13 @@
                                 -37055965,
                                 -3505155,
                                 11422680
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "49a74d3a-9290-4ff9-9a5a-522c0a096d1b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id4 (Insula) [v3.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5293,6 +6448,13 @@
                                 37461444,
                                 -3746634,
                                 10858017
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "49a74d3a-9290-4ff9-9a5a-522c0a096d1b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area Id4 (Insula) [v3.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5350,6 +6512,13 @@
                                 -56352486,
                                 -8557380,
                                 -14844672
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7cef408f-0b23-46c3-8411-102cce3d86a0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area STS2 (STS) [v3.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5367,6 +6536,13 @@
                                 56942990,
                                 -8020716,
                                 -16067930
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7cef408f-0b23-46c3-8411-102cce3d86a0",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area STS2 (STS) [v3.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5406,6 +6582,13 @@
                                 -54514755,
                                 -16753913,
                                 -5260713
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "61460dd7-7696-485e-b638-407e7b7dc99f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area STS1 (STS) [v3.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5423,6 +6606,13 @@
                                 54536567,
                                 -17992636,
                                 -5712544
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "61460dd7-7696-485e-b638-407e7b7dc99f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area STS1 (STS) [v3.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5471,6 +6661,13 @@
                                 -64398501,
                                 -12497885,
                                 1316801
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "03b1cb7b-f142-4612-bbd3-10fc7743bf13",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area TE 3 (STG) [v5.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5488,6 +6685,13 @@
                                 65811519,
                                 -9018989,
                                 -1027621
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "03b1cb7b-f142-4612-bbd3-10fc7743bf13",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area TE 3 (STG) [v5.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5536,6 +6740,13 @@
                                 -50810427,
                                 -6551343,
                                 1635071
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f00b4a71-4a30-4e55-9cfc-dccf4c72c8b2",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area TE 1.2 (HESCHL) [v5.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5553,6 +6764,13 @@
                                 55870330,
                                 -2672527,
                                 52747
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f00b4a71-4a30-4e55-9cfc-dccf4c72c8b2",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area TE 1.2 (HESCHL) [v5.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5592,6 +6810,13 @@
                                 -38219760,
                                 -27125577,
                                 10774700
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "85ad6ef7-228a-4543-a0b1-71ccf11bc69c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area TE 1.1 (HESCHL) [v5.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5609,6 +6834,13 @@
                                 40719340,
                                 -24106132,
                                 10308962
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "85ad6ef7-228a-4543-a0b1-71ccf11bc69c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area TE 1.1 (HESCHL) [v5.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5659,6 +6891,13 @@
                                 -46560150,
                                 -17508772,
                                 7622807
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8a105954-a724-428d-aed8-6c8d50fe4218",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area TE 1.0 (HESCHL) [v5.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5676,6 +6915,13 @@
                                 50392116,
                                 -12932573,
                                 5942946
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8a105954-a724-428d-aed8-6c8d50fe4218",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area TE 1.0 (HESCHL) [v5.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5734,6 +6980,13 @@
                                 -43549584,
                                 -65531770,
                                 -16708135
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "526f6a7d-e8f8-4a8e-a895-a92696281eb9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area FG2 (FusG) [v1.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5751,6 +7004,13 @@
                                 44839825,
                                 -63606518,
                                 -17316773
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "526f6a7d-e8f8-4a8e-a895-a92696281eb9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area FG2 (FusG) [v1.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5789,6 +7049,13 @@
                                 -29844935,
                                 -45368421,
                                 -14184493
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "34f29154-e210-4bef-9510-73b77f727132",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area FG3 (FusG) [v6.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5806,6 +7073,13 @@
                                 31148061,
                                 -44485336,
                                 -15533822
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "34f29154-e210-4bef-9510-73b77f727132",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area FG3 (FusG) [v6.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5845,6 +7119,13 @@
                                 -29006116,
                                 -66264526,
                                 -12290010
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "a00577ca-5089-443d-918e-b99531efd5e9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area FG1 (FusG) [v1.4, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5862,6 +7143,13 @@
                                 32840456,
                                 -64340456,
                                 -12612536
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "a00577ca-5089-443d-918e-b99531efd5e9",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area FG1 (FusG) [v1.4, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5922,6 +7210,13 @@
                                 -43204016,
                                 -44325167,
                                 -20016734
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e7a2b57c-c4f0-41b9-8d80-8accd509497b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area FG4 (FusG) [v6.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -5939,6 +7234,13 @@
                                 43609694,
                                 -43478025,
                                 -22392295
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "e7a2b57c-c4f0-41b9-8d80-8accd509497b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area FG4 (FusG) [v6.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -5995,6 +7297,13 @@
                                 -8144989,
                                 41168443,
                                 14314854
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8b778e42-b3f2-41e2-8295-a6f0e1f20721",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area p24c (pACC) [v16.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6012,6 +7321,13 @@
                                 9856593,
                                 40780558,
                                 12002406
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "8b778e42-b3f2-41e2-8295-a6f0e1f20721",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area p24c (pACC) [v16.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6051,6 +7367,13 @@
                                 -3522692,
                                 13560250,
                                 -11860720
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "74bc9736-7044-4c72-b7bb-15739ae70e1e",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 25 (sACC) [v16.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6068,6 +7391,13 @@
                                 4564663,
                                 12954463,
                                 -12174863
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "74bc9736-7044-4c72-b7bb-15739ae70e1e",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 25 (sACC) [v16.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6107,6 +7437,13 @@
                                 -2244059,
                                 38783168,
                                 6389109
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1acd6cd6-6941-4228-94fa-9da5ce014503",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area p24ab (pACC) [v16.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6124,6 +7461,13 @@
                                 3429274,
                                 38385609,
                                 7809963
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1acd6cd6-6941-4228-94fa-9da5ce014503",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area p24ab (pACC) [v16.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6163,6 +7507,13 @@
                                 -6738110,
                                 35256183,
                                 -11765377
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "57ac8798-a260-4c9b-8f9c-3e32d1dd3aca",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area s32 (sACC) [v16.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6180,6 +7531,13 @@
                                 4307795,
                                 34460360,
                                 -12141905
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "57ac8798-a260-4c9b-8f9c-3e32d1dd3aca",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area s32 (sACC) [v16.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6219,6 +7577,13 @@
                                 -4861218,
                                 14163048,
                                 15911877
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2801b466-fc6e-4079-91da-1f2a5180f76c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 33 (ACC) [v16.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6236,6 +7601,13 @@
                                 5087045,
                                 15562321,
                                 16125051
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2801b466-fc6e-4079-91da-1f2a5180f76c",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area 33 (ACC) [v16.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6275,6 +7647,13 @@
                                 -6122937,
                                 49256108,
                                 11929896
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7a326443-3ced-482f-8772-fb948b0f298f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area p32 (pACC) [v16.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6292,6 +7671,13 @@
                                 7759613,
                                 48520792,
                                 12436058
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "7a326443-3ced-482f-8772-fb948b0f298f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area p32 (pACC) [v16.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6331,6 +7717,13 @@
                                 -3247887,
                                 24596479,
                                 -9615493
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2092649c-7880-4d13-9537-a8f5a71dccf3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area s24 (sACC) [v16.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6348,6 +7741,13 @@
                                 3259899,
                                 23813535,
                                 -9257019
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "2092649c-7880-4d13-9537-a8f5a71dccf3",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Area s24 (sACC) [v16.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6396,6 +7796,13 @@
                                 -13947917,
                                 -9576389,
                                 -18975694
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "4225fb8e-b9b4-456a-961e-9db90acac575",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "HATA (Hippocampus) [v11.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6413,6 +7820,13 @@
                                 15080586,
                                 -8358974,
                                 -17871795
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "4225fb8e-b9b4-456a-961e-9db90acac575",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "HATA (Hippocampus) [v11.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6452,6 +7866,13 @@
                                 -20926052,
                                 -6082765,
                                 -33357509
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f251d71c-32ac-489d-b96d-fe5e1297fcb7",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Entorhinal Cortex [v11.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6469,6 +7890,13 @@
                                 22877203,
                                 -3501469,
                                 -32577556
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f251d71c-32ac-489d-b96d-fe5e1297fcb7",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Entorhinal Cortex [v11.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6519,6 +7947,13 @@
                                 -27476326,
                                 -26068931,
                                 -11082817
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f02f274f-5e8f-4c0b-a4c8-eef628a8af01",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "CA (Hippocampus) [v11.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6536,6 +7971,13 @@
                                 29426785,
                                 -24801145,
                                 -11142814
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "f02f274f-5e8f-4c0b-a4c8-eef628a8af01",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "CA (Hippocampus) [v11.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6574,6 +8016,13 @@
                                 -26946498,
                                 -26708171,
                                 -9589494
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "677c84c3-56b2-4671-bc63-15d3dda730a2",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "DG (Hippocampus) [v11.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6591,6 +8040,13 @@
                                 28316456,
                                 -24674684,
                                 -10596203
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "677c84c3-56b2-4671-bc63-15d3dda730a2",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "DG (Hippocampus) [v11.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6630,6 +8086,13 @@
                                 -20352171,
                                 -24057796,
                                 -16326997
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1153f14e-100f-477e-bf95-89fb0af6d80b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Subiculum (Hippocampus) [v11.1, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6647,6 +8110,13 @@
                                 22543982,
                                 -23195614,
                                 -15923499
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "1153f14e-100f-477e-bf95-89fb0af6d80b",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Subiculum (Hippocampus) [v11.1, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6722,6 +8192,13 @@
                                 -8457921,
                                 -55262376,
                                 -30235149
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "658a7f71-1b94-4f4a-8f15-726043bbb52a",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Interposed Nucleus (Cerebellum) [v6.2, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6739,6 +8216,13 @@
                                 7917989,
                                 -54201058,
                                 -31489418
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "658a7f71-1b94-4f4a-8f15-726043bbb52a",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Interposed Nucleus (Cerebellum) [v6.2, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6787,6 +8271,13 @@
                                 -16612782,
                                 -56036341,
                                 -36064536
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "870cdd4a-fdb4-4d70-9c3d-d459a122c845",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Dorsal Dentate Nucleus (Cerebellum) [v6.2, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6804,6 +8295,13 @@
                                 15388967,
                                 -58303395,
                                 -36586280
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "870cdd4a-fdb4-4d70-9c3d-d459a122c845",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Dorsal Dentate Nucleus (Cerebellum) [v6.2, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6843,6 +8341,13 @@
                                 -13112867,
                                 -56176072,
                                 -29957111
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "d3e0ae99-49f4-4bb1-a394-c9c12016ed2f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Ventral Dentate Nucleus (Cerebellum) [v6.2, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6860,6 +8365,13 @@
                                 12107011,
                                 -55974170,
                                 -31385609
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "d3e0ae99-49f4-4bb1-a394-c9c12016ed2f",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Ventral Dentate Nucleus (Cerebellum) [v6.2, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6908,6 +8420,13 @@
                                 -3828877,
                                 -53149733,
                                 -29013369
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "dec5c207-c0d9-4f25-a333-1db039c570cb",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Fastigial Nucleus (Cerebellum) [v6.2, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6925,6 +8444,13 @@
                                 3011287,
                                 -53069977,
                                 -29040632
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "dec5c207-c0d9-4f25-a333-1db039c570cb",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Fastigial Nucleus (Cerebellum) [v6.2, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
@@ -6973,6 +8499,13 @@
                                 -8457921,
                                 -55262376,
                                 -30235149
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "658a7f71-1b94-4f4a-8f15-726043bbb52a",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Interposed Nucleus (Cerebellum) [v6.2, Colin 27, left hemisphere]"
+                                }
                               ]
                             },
                             {
@@ -6990,6 +8523,13 @@
                                 7917989,
                                 -54201058,
                                 -31489418
+                              ],
+                              "originDatasets": [
+                                {
+                                  "kgId": "658a7f71-1b94-4f4a-8f15-726043bbb52a",
+                                  "kgSchema": "minds/core/dataset/v1.0.0",
+                                  "filename": "Interposed Nucleus (Cerebellum) [v6.2, Colin 27, right hemisphere]"
+                                }
                               ]
                             }
                           ],
diff --git a/src/res/generateAllenDataset.js b/src/res/generateAllenDataset.js
deleted file mode 100644
index 3b41d23dacd6e4c7375f7f42b2224e7d429501fd..0000000000000000000000000000000000000000
--- a/src/res/generateAllenDataset.js
+++ /dev/null
@@ -1,82 +0,0 @@
-const fs = require('fs')
-
-
-const dict = {
-  'hbp-00015': 'https://www.humanbrainproject.eu/en/explore-the-brain/search/?q=action%20potential#Project/9bf31c7ff062936a96d3c8bd1f8f2ff3',
-  'hbp-00014': 'https://www.humanbrainproject.eu/en/explore-the-brain/search/?q=action%20potential#Project/aab3238922bcc25a6f606eb525ffdc56',
-  'hbp-00013': 'https://www.humanbrainproject.eu/en/explore-the-brain/search/?q=action%20potential#Project/c51ce410c124a10e0db5e4b97fc2af39',
-  'hbp-00012': 'https://www.humanbrainproject.eu/en/explore-the-brain/search/?q=action%20potential#Project/c20ad4d76fe97759aa27a0c99bff6710',
-  'hbp-00011': 'https://www.humanbrainproject.eu/en/explore-the-brain/search/?q=action%20potential#Project/6512bd43d9caa6e02c990b0a82652dca',
-  'hbp-00005': 'https://www.humanbrainproject.eu/en/explore-the-brain/search/?q=stdp#Project/e4da3b7fbbce2345d7772b0674a318d5'
-}
-
-const dict2 = {
-  '140213' : 'Subject/9703f44d9e8e3e89b04fe32df38d3a50',
-  '140220' : 'Subject/62a12ea44022cc61bc50622c25d9ba90',
-  '140304' : 'Subject/b7a9bfa817b00f0b8602eef0961dd9c1',
-  '140514' : 'Subject/6d212b1a18a6f09098123aeff7ee540e',
-  '140505' : 'Subject/173dc7e71e243a7a6ad5718872950c3e',
-  '140519' : 'Subject/6dc041463d5e021652824319d0273289',
-}
-
-
-const planeFragment = 'GCaMP6'
-
-fs.readdir('./raw/allenFromCamila',(err,files) => {
-  if(err) throw err
-  const filteredFiles = files.filter(file => !(/md$/.test(file)))
-  const json = filteredFiles.map(file => {
-    const data = fs.readFileSync(`./raw/allenFromCamila/${file}`, 'utf-8')
-
-    const json = JSON.parse(data)
-    const regex = /hbp\-[0-9]{5}/.exec(file)
-    const name = json.name
-      ? json.name
-      : json.Name
-    let kgID
-    const obj = {
-      type : 'Allen Dataset',
-      name : name,
-      regionName : [],
-      targetParcellation : 'Allen Mouse Brain Atlas',
-      files : [{
-        filename : name,
-        name : name,
-        mimetype : 'raw',
-      }]
-    }
-    if(regex && dict[regex[0]]){
-      kgID = /Project\/.*?$/.exec(dict[regex[0]])[0]
-      obj.regionName = [{
-        regionName : json['Primary region(s)'],
-        relationship : 'equals'
-      }]
-    }else{
-      const regex2 = /[0-9]{6}/.exec(file)
-      if(regex2 && dict2[regex2[0]]){
-        kgID = dict2[regex2[0]]
-        obj.regionName = obj.regionName.concat([{
-          regionName : 'Prelimbic area',
-          relationship : 'equals'
-        },{
-          regionName : 'Primary motor area',
-          relationship : 'equals'
-        },{
-          regionName : 'Primary somatosensory area',
-          relationship : 'equals'
-        },{
-          regionName : 'Anteromedial visual area',
-          relationship : 'equals'
-        }])
-      }else if (new RegExp(planeFragment).test(file)){
-        kgID = null
-      }
-    }
-    obj.kgID = kgID
-    return obj
-  })
-  fs.writeFile('./raw/allenTestAggregated.json', JSON.stringify(json), 'utf-8', (err) => {
-    if(err) throw err
-    console.log('finished writing')
-  })
-})
\ No newline at end of file
diff --git a/src/res/images/fzj_black_transparent_svg.svg b/src/res/images/fzj_black_transparent_svg.svg
new file mode 100644
index 0000000000000000000000000000000000000000..9158d333b467ef871dd5f18f4fd89a32561ceede
--- /dev/null
+++ b/src/res/images/fzj_black_transparent_svg.svg
@@ -0,0 +1,5 @@
+<svg id="Ebene_1" data-name="Ebene 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 246.61 136.06">
+  <title>exportieren_als-03</title>
+  <path d="M139.64,82.29H139a.23.23,0,0,0-.23.24v2.81c0,.83-.42,1.28-1.06,1.28s-1-.45-1-1.28V82.53a.25.25,0,0,0-.25-.24h-.63a.24.24,0,0,0-.24.24v2.68c0,1.45.59,2.35,1.81,2.35a1.51,1.51,0,0,0,1.38-.66v.32a.23.23,0,0,0,.23.24h.64a.24.24,0,0,0,.24-.24V82.53A.24.24,0,0,0,139.64,82.29Zm-8-.11a1.58,1.58,0,0,0-1.43.7V80.47a.25.25,0,0,0-.25-.25h-.63a.24.24,0,0,0-.24.25v6.75a.23.23,0,0,0,.24.24H130a.24.24,0,0,0,.25-.24v-2.8c0-.83.45-1.29,1.1-1.29s1.09.46,1.09,1.29v2.8a.24.24,0,0,0,.24.24h.63a.24.24,0,0,0,.25-.24V84.54C133.55,83.13,132.94,82.18,131.67,82.18Zm1.71-28.84h-2.49a.93.93,0,0,0-.93.93V66.15c0,3.09-1.5,4.41-3.63,4.41s-3.57-1.32-3.57-4.41V54.27a.93.93,0,0,0-.93-.93h-2.49a.93.93,0,0,0-.93.93V66.15c0,5.25,3.18,8.49,7.92,8.49s8-3.24,8-8.49V54.27A.93.93,0,0,0,133.38,53.34Zm-17.46,29h-.13a1.57,1.57,0,0,0-1.38.77v-.53a.23.23,0,0,0-.23-.24h-.58a.24.24,0,0,0-.24.24v4.69a.23.23,0,0,0,.24.24h.62a.25.25,0,0,0,.25-.24V84.88c0-1,.44-1.49,1.31-1.49h.14a.24.24,0,0,0,.25-.23v-.63A.25.25,0,0,0,115.92,82.29Zm9.41.84a1.07,1.07,0,0,1,1.08.92.17.17,0,0,0,.17.15h.72a.15.15,0,0,0,.15-.17.32.32,0,0,0,0-.13,2.11,2.11,0,0,0-2.1-1.72,2.19,2.19,0,0,0-2.2,2.36v.67a2.18,2.18,0,0,0,2.2,2.35,2.07,2.07,0,0,0,2.1-1.66,1.28,1.28,0,0,0,0-.17.16.16,0,0,0-.17-.16h-.72a.15.15,0,0,0-.16.14,1,1,0,0,1-1.07.91c-.64,0-1.11-.45-1.11-1.28v-.92C124.22,83.59,124.69,83.13,125.33,83.13Zm-6.63.52c0-.43.39-.57.84-.57a.88.88,0,0,1,1,.64c0,.11.07.16.19.16h.65a.17.17,0,0,0,.17-.18.44.44,0,0,0,0-.13,1.81,1.81,0,0,0-1.93-1.39c-1,0-2,.45-2,1.52,0,2.1,2.94,1.23,2.94,2.31,0,.48-.36.66-1,.66a1,1,0,0,1-1.06-.69c0-.1-.07-.17-.18-.17h-.64a.19.19,0,0,0-.19.17.31.31,0,0,0,0,.14,1.89,1.89,0,0,0,2,1.44c1.07,0,2-.4,2-1.57C121.63,83.92,118.7,84.78,118.7,83.65Zm4.66-32.14a2.16,2.16,0,1,0-2.16-2.16A2,2,0,0,0,123.36,51.51Zm6.3,0a2.16,2.16,0,1,0-2.16-2.16A2,2,0,0,0,129.66,51.51Zm-15.88,2.76a.93.93,0,0,0-.93-.93h-2.49a.93.93,0,0,0-.93.93V67.83a2.54,2.54,0,1,1-5.07,0v-.27a.93.93,0,0,0-.93-.93H101a.93.93,0,0,0-.93.93v.21a6.84,6.84,0,1,0,13.68,0ZM61.62,64.66,69,45.49a22.7,22.7,0,0,0-22.61,12.2.5.5,0,0,1,0,.13l-.32.83c-2.24,5.79,1.18,10.08,4.5,11.36A8.55,8.55,0,0,0,61.62,64.66Zm47.76,17.52a2.2,2.2,0,0,0-2.22,2.36v.67a2.23,2.23,0,1,0,4.46,0v-.67A2.2,2.2,0,0,0,109.38,82.18Zm1.12,3.16c0,.83-.46,1.28-1.12,1.28s-1.1-.45-1.1-1.28v-.92c0-.83.47-1.29,1.1-1.29s1.12.46,1.12,1.29ZM75,69.63C70.6,81.13,60,85.44,50.29,83.78A22.67,22.67,0,1,0,82.06,51.45ZM106,80.22h-4a.24.24,0,0,0-.23.25v6.75a.23.23,0,0,0,.23.24h.63a.24.24,0,0,0,.25-.24V84.57h2.5a.24.24,0,0,0,.24-.24v-.55a.25.25,0,0,0-.24-.25h-2.5V81.26H106a.25.25,0,0,0,.25-.24v-.55A.25.25,0,0,0,106,80.22Zm85.45,2.07h-.63a.24.24,0,0,0-.24.24v2.81c0,.83-.42,1.28-1.06,1.28s-1-.45-1-1.28V82.53a.25.25,0,0,0-.25-.24h-.63a.24.24,0,0,0-.24.24v2.68c0,1.45.59,2.35,1.81,2.35a1.51,1.51,0,0,0,1.38-.66v.32a.23.23,0,0,0,.24.24h.63a.24.24,0,0,0,.24-.24V82.53A.24.24,0,0,0,191.42,82.29ZM180.86,66.84h-3.09c-.6,0-.72.48-.78.93a3.13,3.13,0,0,1-3.42,2.79c-2.19,0-4-1.62-4-4.71v-4c0-3.09,1.77-4.77,4-4.77A3.27,3.27,0,0,1,177,60c.09.6.42.81.75.81h3.06a.63.63,0,0,0,.66-.75A7.55,7.55,0,0,0,173.57,53c-4.8,0-8.31,3.54-8.31,8.79v4c0,5.25,3.51,8.79,8.31,8.79a7.71,7.71,0,0,0,8-7.08A.68.68,0,0,0,180.86,66.84Zm4.6,15.45h-.14a1.54,1.54,0,0,0-1.37.77v-.53a.24.24,0,0,0-.24-.24h-.58a.24.24,0,0,0-.24.24v4.69a.23.23,0,0,0,.24.24h.62a.25.25,0,0,0,.25-.24V84.88c0-1,.44-1.49,1.31-1.49h.15a.23.23,0,0,0,.24-.23v-.63A.24.24,0,0,0,185.46,82.29Zm-4.69,0h-1.05v-1.1a.24.24,0,0,0-.24-.25h-.61a.24.24,0,0,0-.23.25v.45c0,.53-.21.65-.72.65a.24.24,0,0,0-.24.24V83a.24.24,0,0,0,.24.24h.71V85.8c0,1.07.36,1.66,1.6,1.66h.54a.24.24,0,0,0,.24-.24v-.53a.23.23,0,0,0-.24-.23h-.36c-.62,0-.69-.22-.69-.81V83.27h1.05A.24.24,0,0,0,181,83v-.5A.24.24,0,0,0,180.77,82.29Zm18.62-.11a1.81,1.81,0,0,0-1.61.84,1.64,1.64,0,0,0-1.52-.84,1.47,1.47,0,0,0-1.34.7v-.35a.25.25,0,0,0-.25-.24H194a.24.24,0,0,0-.24.24v4.69a.23.23,0,0,0,.24.24h.63a.25.25,0,0,0,.25-.24V84.58c0-.83.16-1.45,1-1.45s1,.51,1,1.45v2.64a.24.24,0,0,0,.24.24h.64a.24.24,0,0,0,.24-.24V84.58c0-.89.21-1.45,1.05-1.45s1,.56,1,1.45v2.64a.23.23,0,0,0,.24.24H201a.25.25,0,0,0,.25-.24V84.69C201.21,83.2,200.91,82.18,199.39,82.18Zm-25,0a1.57,1.57,0,0,0-1.42.71v-.36a.24.24,0,0,0-.24-.24h-.64a.23.23,0,0,0-.23.24v4.69a.23.23,0,0,0,.23.24h.64a.24.24,0,0,0,.24-.24v-2.8c0-.83.46-1.29,1.1-1.29s1.1.46,1.1,1.29v2.8a.23.23,0,0,0,.24.24H176a.24.24,0,0,0,.24-.24V84.54C176.26,83.13,175.64,82.18,174.37,82.18Zm26-28.84h-2.49a.93.93,0,0,0-.93.93v7.5H189.8v-7.5a.93.93,0,0,0-.93-.93h-2.49a.93.93,0,0,0-.93.93V73.41a.93.93,0,0,0,.93.93h2.49a.93.93,0,0,0,.93-.93V65.85h7.11v7.56a.93.93,0,0,0,.93.93h2.49a.93.93,0,0,0,.93-.93V54.27A.93.93,0,0,0,200.33,53.34ZM144.57,82.18a1.57,1.57,0,0,0-1.42.71v-.36a.24.24,0,0,0-.24-.24h-.63a.24.24,0,0,0-.24.24v4.69a.23.23,0,0,0,.24.24h.63a.24.24,0,0,0,.24-.24v-2.8c0-.83.46-1.29,1.1-1.29s1.1.46,1.1,1.29v2.8a.23.23,0,0,0,.24.24h.63a.25.25,0,0,0,.25-.24V84.54C146.47,83.13,145.85,82.18,144.57,82.18Zm6.66,4.28h-1.34c-.35,0-.5-.11-.5-.37a.36.36,0,0,1,.41-.37h1a1.73,1.73,0,0,0,2-1.76V81.84a.24.24,0,0,0-.24-.24H152a.24.24,0,0,0-.24.24v.67a1.87,1.87,0,0,0-1.06-.33h-.26a1.77,1.77,0,0,0-2,1.78,1.4,1.4,0,0,0,.66,1.26.83.83,0,0,0-.7.85.82.82,0,0,0,.47.79,1.26,1.26,0,0,0-.7,1.19A1.61,1.61,0,0,0,150,89.63h1.2a1.6,1.6,0,1,0,0-3.17Zm-.75-3.41h.28a.91.91,0,1,1,0,1.81h-.28a.87.87,0,0,1-1-.9A.88.88,0,0,1,150.48,83.05Zm.54,5.72h-.82c-.7,0-.95-.28-.95-.72s.25-.75.95-.75H151c.71,0,1,.29,1,.75S151.73,88.77,151,88.77Zm4.6-5.12c0-.43.39-.57.84-.57a.89.89,0,0,1,1,.64c0,.11.07.16.18.16h.66a.17.17,0,0,0,.17-.18.44.44,0,0,0,0-.13,1.81,1.81,0,0,0-1.93-1.39c-1,0-2,.45-2,1.52,0,2.1,2.94,1.23,2.94,2.31,0,.48-.36.66-.95.66a1,1,0,0,1-1.06-.69c0-.1-.07-.17-.18-.17h-.65a.18.18,0,0,0-.18.17.31.31,0,0,0,0,.14,1.88,1.88,0,0,0,2.05,1.44c1.07,0,2-.4,2-1.57C158.55,83.92,155.62,84.78,155.62,83.65Zm-3.11-10.24V71.19a.93.93,0,0,0-.93-.93h-8v-16a.93.93,0,0,0-.93-.93h-2.49a.93.93,0,0,0-.93.93V73.41a.93.93,0,0,0,.93.93h11.4A.93.93,0,0,0,152.51,73.41Zm8.25,0V54.27a.93.93,0,0,0-.93-.93h-2.49a.93.93,0,0,0-.93.93V73.41a.93.93,0,0,0,.93.93h2.49A.93.93,0,0,0,160.76,73.41Zm3,8.88h-3.41a.25.25,0,0,0-.25.24V83a.24.24,0,0,0,.25.24h2.35l-2.41,3.08a.56.56,0,0,0-.19.46v.42a.24.24,0,0,0,.25.24h3.41a.23.23,0,0,0,.24-.24v-.47a.24.24,0,0,0-.24-.25h-2.39l2.48-3.07A.53.53,0,0,0,164,83v-.5A.24.24,0,0,0,163.8,82.29Zm4-.11a2.21,2.21,0,0,0-2.24,2.36v.67a2.21,2.21,0,0,0,2.25,2.35,2.12,2.12,0,0,0,2-1.37.64.64,0,0,0,0-.17.17.17,0,0,0-.17-.18h-.67a.3.3,0,0,0-.24.15,1,1,0,0,1-1,.63,1.14,1.14,0,0,1-1.13-1.23v-.14h3.07A.25.25,0,0,0,170,85v-.48A2.2,2.2,0,0,0,167.81,82.18Zm1.12,2.28h-2.24v-.12a1.12,1.12,0,1,1,2.24,0Z" style="fill: #023d6b"/>
+  <rect width="246.61" height="136.06" style="fill: none"/>
+</svg>
diff --git a/src/res/images/fzj_white_transparent_svg.svg b/src/res/images/fzj_white_transparent_svg.svg
new file mode 100644
index 0000000000000000000000000000000000000000..03179278e32db3a60946698f22684eb03c7c434a
--- /dev/null
+++ b/src/res/images/fzj_white_transparent_svg.svg
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   id="Ebene_1"
+   data-name="Ebene 1"
+   viewBox="0 0 246.61 136.06"
+   version="1.1"
+   sodipodi:docname="fzj_white_transparent_svg.svg"
+   inkscape:version="0.92.4 (f8dce91, 2019-08-02)">
+  <metadata
+     id="metadata140">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title>exportieren_als-03</dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs138" />
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1401"
+     inkscape:window-height="770"
+     id="namedview136"
+     showgrid="false"
+     inkscape:zoom="2.8384899"
+     inkscape:cx="83.234789"
+     inkscape:cy="70.350932"
+     inkscape:window-x="275"
+     inkscape:window-y="212"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="Ebene_1" />
+  <title
+     id="title129">exportieren_als-03</title>
+  <path
+     d="M139.64,82.29H139a.23.23,0,0,0-.23.24v2.81c0,.83-.42,1.28-1.06,1.28s-1-.45-1-1.28V82.53a.25.25,0,0,0-.25-.24h-.63a.24.24,0,0,0-.24.24v2.68c0,1.45.59,2.35,1.81,2.35a1.51,1.51,0,0,0,1.38-.66v.32a.23.23,0,0,0,.23.24h.64a.24.24,0,0,0,.24-.24V82.53A.24.24,0,0,0,139.64,82.29Zm-8-.11a1.58,1.58,0,0,0-1.43.7V80.47a.25.25,0,0,0-.25-.25h-.63a.24.24,0,0,0-.24.25v6.75a.23.23,0,0,0,.24.24H130a.24.24,0,0,0,.25-.24v-2.8c0-.83.45-1.29,1.1-1.29s1.09.46,1.09,1.29v2.8a.24.24,0,0,0,.24.24h.63a.24.24,0,0,0,.25-.24V84.54C133.55,83.13,132.94,82.18,131.67,82.18Zm1.71-28.84h-2.49a.93.93,0,0,0-.93.93V66.15c0,3.09-1.5,4.41-3.63,4.41s-3.57-1.32-3.57-4.41V54.27a.93.93,0,0,0-.93-.93h-2.49a.93.93,0,0,0-.93.93V66.15c0,5.25,3.18,8.49,7.92,8.49s8-3.24,8-8.49V54.27A.93.93,0,0,0,133.38,53.34Zm-17.46,29h-.13a1.57,1.57,0,0,0-1.38.77v-.53a.23.23,0,0,0-.23-.24h-.58a.24.24,0,0,0-.24.24v4.69a.23.23,0,0,0,.24.24h.62a.25.25,0,0,0,.25-.24V84.88c0-1,.44-1.49,1.31-1.49h.14a.24.24,0,0,0,.25-.23v-.63A.25.25,0,0,0,115.92,82.29Zm9.41.84a1.07,1.07,0,0,1,1.08.92.17.17,0,0,0,.17.15h.72a.15.15,0,0,0,.15-.17.32.32,0,0,0,0-.13,2.11,2.11,0,0,0-2.1-1.72,2.19,2.19,0,0,0-2.2,2.36v.67a2.18,2.18,0,0,0,2.2,2.35,2.07,2.07,0,0,0,2.1-1.66,1.28,1.28,0,0,0,0-.17.16.16,0,0,0-.17-.16h-.72a.15.15,0,0,0-.16.14,1,1,0,0,1-1.07.91c-.64,0-1.11-.45-1.11-1.28v-.92C124.22,83.59,124.69,83.13,125.33,83.13Zm-6.63.52c0-.43.39-.57.84-.57a.88.88,0,0,1,1,.64c0,.11.07.16.19.16h.65a.17.17,0,0,0,.17-.18.44.44,0,0,0,0-.13,1.81,1.81,0,0,0-1.93-1.39c-1,0-2,.45-2,1.52,0,2.1,2.94,1.23,2.94,2.31,0,.48-.36.66-1,.66a1,1,0,0,1-1.06-.69c0-.1-.07-.17-.18-.17h-.64a.19.19,0,0,0-.19.17.31.31,0,0,0,0,.14,1.89,1.89,0,0,0,2,1.44c1.07,0,2-.4,2-1.57C121.63,83.92,118.7,84.78,118.7,83.65Zm4.66-32.14a2.16,2.16,0,1,0-2.16-2.16A2,2,0,0,0,123.36,51.51Zm6.3,0a2.16,2.16,0,1,0-2.16-2.16A2,2,0,0,0,129.66,51.51Zm-15.88,2.76a.93.93,0,0,0-.93-.93h-2.49a.93.93,0,0,0-.93.93V67.83a2.54,2.54,0,1,1-5.07,0v-.27a.93.93,0,0,0-.93-.93H101a.93.93,0,0,0-.93.93v.21a6.84,6.84,0,1,0,13.68,0ZM61.62,64.66,69,45.49a22.7,22.7,0,0,0-22.61,12.2.5.5,0,0,1,0,.13l-.32.83c-2.24,5.79,1.18,10.08,4.5,11.36A8.55,8.55,0,0,0,61.62,64.66Zm47.76,17.52a2.2,2.2,0,0,0-2.22,2.36v.67a2.23,2.23,0,1,0,4.46,0v-.67A2.2,2.2,0,0,0,109.38,82.18Zm1.12,3.16c0,.83-.46,1.28-1.12,1.28s-1.1-.45-1.1-1.28v-.92c0-.83.47-1.29,1.1-1.29s1.12.46,1.12,1.29ZM75,69.63C70.6,81.13,60,85.44,50.29,83.78A22.67,22.67,0,1,0,82.06,51.45ZM106,80.22h-4a.24.24,0,0,0-.23.25v6.75a.23.23,0,0,0,.23.24h.63a.24.24,0,0,0,.25-.24V84.57h2.5a.24.24,0,0,0,.24-.24v-.55a.25.25,0,0,0-.24-.25h-2.5V81.26H106a.25.25,0,0,0,.25-.24v-.55A.25.25,0,0,0,106,80.22Zm85.45,2.07h-.63a.24.24,0,0,0-.24.24v2.81c0,.83-.42,1.28-1.06,1.28s-1-.45-1-1.28V82.53a.25.25,0,0,0-.25-.24h-.63a.24.24,0,0,0-.24.24v2.68c0,1.45.59,2.35,1.81,2.35a1.51,1.51,0,0,0,1.38-.66v.32a.23.23,0,0,0,.24.24h.63a.24.24,0,0,0,.24-.24V82.53A.24.24,0,0,0,191.42,82.29ZM180.86,66.84h-3.09c-.6,0-.72.48-.78.93a3.13,3.13,0,0,1-3.42,2.79c-2.19,0-4-1.62-4-4.71v-4c0-3.09,1.77-4.77,4-4.77A3.27,3.27,0,0,1,177,60c.09.6.42.81.75.81h3.06a.63.63,0,0,0,.66-.75A7.55,7.55,0,0,0,173.57,53c-4.8,0-8.31,3.54-8.31,8.79v4c0,5.25,3.51,8.79,8.31,8.79a7.71,7.71,0,0,0,8-7.08A.68.68,0,0,0,180.86,66.84Zm4.6,15.45h-.14a1.54,1.54,0,0,0-1.37.77v-.53a.24.24,0,0,0-.24-.24h-.58a.24.24,0,0,0-.24.24v4.69a.23.23,0,0,0,.24.24h.62a.25.25,0,0,0,.25-.24V84.88c0-1,.44-1.49,1.31-1.49h.15a.23.23,0,0,0,.24-.23v-.63A.24.24,0,0,0,185.46,82.29Zm-4.69,0h-1.05v-1.1a.24.24,0,0,0-.24-.25h-.61a.24.24,0,0,0-.23.25v.45c0,.53-.21.65-.72.65a.24.24,0,0,0-.24.24V83a.24.24,0,0,0,.24.24h.71V85.8c0,1.07.36,1.66,1.6,1.66h.54a.24.24,0,0,0,.24-.24v-.53a.23.23,0,0,0-.24-.23h-.36c-.62,0-.69-.22-.69-.81V83.27h1.05A.24.24,0,0,0,181,83v-.5A.24.24,0,0,0,180.77,82.29Zm18.62-.11a1.81,1.81,0,0,0-1.61.84,1.64,1.64,0,0,0-1.52-.84,1.47,1.47,0,0,0-1.34.7v-.35a.25.25,0,0,0-.25-.24H194a.24.24,0,0,0-.24.24v4.69a.23.23,0,0,0,.24.24h.63a.25.25,0,0,0,.25-.24V84.58c0-.83.16-1.45,1-1.45s1,.51,1,1.45v2.64a.24.24,0,0,0,.24.24h.64a.24.24,0,0,0,.24-.24V84.58c0-.89.21-1.45,1.05-1.45s1,.56,1,1.45v2.64a.23.23,0,0,0,.24.24H201a.25.25,0,0,0,.25-.24V84.69C201.21,83.2,200.91,82.18,199.39,82.18Zm-25,0a1.57,1.57,0,0,0-1.42.71v-.36a.24.24,0,0,0-.24-.24h-.64a.23.23,0,0,0-.23.24v4.69a.23.23,0,0,0,.23.24h.64a.24.24,0,0,0,.24-.24v-2.8c0-.83.46-1.29,1.1-1.29s1.1.46,1.1,1.29v2.8a.23.23,0,0,0,.24.24H176a.24.24,0,0,0,.24-.24V84.54C176.26,83.13,175.64,82.18,174.37,82.18Zm26-28.84h-2.49a.93.93,0,0,0-.93.93v7.5H189.8v-7.5a.93.93,0,0,0-.93-.93h-2.49a.93.93,0,0,0-.93.93V73.41a.93.93,0,0,0,.93.93h2.49a.93.93,0,0,0,.93-.93V65.85h7.11v7.56a.93.93,0,0,0,.93.93h2.49a.93.93,0,0,0,.93-.93V54.27A.93.93,0,0,0,200.33,53.34ZM144.57,82.18a1.57,1.57,0,0,0-1.42.71v-.36a.24.24,0,0,0-.24-.24h-.63a.24.24,0,0,0-.24.24v4.69a.23.23,0,0,0,.24.24h.63a.24.24,0,0,0,.24-.24v-2.8c0-.83.46-1.29,1.1-1.29s1.1.46,1.1,1.29v2.8a.23.23,0,0,0,.24.24h.63a.25.25,0,0,0,.25-.24V84.54C146.47,83.13,145.85,82.18,144.57,82.18Zm6.66,4.28h-1.34c-.35,0-.5-.11-.5-.37a.36.36,0,0,1,.41-.37h1a1.73,1.73,0,0,0,2-1.76V81.84a.24.24,0,0,0-.24-.24H152a.24.24,0,0,0-.24.24v.67a1.87,1.87,0,0,0-1.06-.33h-.26a1.77,1.77,0,0,0-2,1.78,1.4,1.4,0,0,0,.66,1.26.83.83,0,0,0-.7.85.82.82,0,0,0,.47.79,1.26,1.26,0,0,0-.7,1.19A1.61,1.61,0,0,0,150,89.63h1.2a1.6,1.6,0,1,0,0-3.17Zm-.75-3.41h.28a.91.91,0,1,1,0,1.81h-.28a.87.87,0,0,1-1-.9A.88.88,0,0,1,150.48,83.05Zm.54,5.72h-.82c-.7,0-.95-.28-.95-.72s.25-.75.95-.75H151c.71,0,1,.29,1,.75S151.73,88.77,151,88.77Zm4.6-5.12c0-.43.39-.57.84-.57a.89.89,0,0,1,1,.64c0,.11.07.16.18.16h.66a.17.17,0,0,0,.17-.18.44.44,0,0,0,0-.13,1.81,1.81,0,0,0-1.93-1.39c-1,0-2,.45-2,1.52,0,2.1,2.94,1.23,2.94,2.31,0,.48-.36.66-.95.66a1,1,0,0,1-1.06-.69c0-.1-.07-.17-.18-.17h-.65a.18.18,0,0,0-.18.17.31.31,0,0,0,0,.14,1.88,1.88,0,0,0,2.05,1.44c1.07,0,2-.4,2-1.57C158.55,83.92,155.62,84.78,155.62,83.65Zm-3.11-10.24V71.19a.93.93,0,0,0-.93-.93h-8v-16a.93.93,0,0,0-.93-.93h-2.49a.93.93,0,0,0-.93.93V73.41a.93.93,0,0,0,.93.93h11.4A.93.93,0,0,0,152.51,73.41Zm8.25,0V54.27a.93.93,0,0,0-.93-.93h-2.49a.93.93,0,0,0-.93.93V73.41a.93.93,0,0,0,.93.93h2.49A.93.93,0,0,0,160.76,73.41Zm3,8.88h-3.41a.25.25,0,0,0-.25.24V83a.24.24,0,0,0,.25.24h2.35l-2.41,3.08a.56.56,0,0,0-.19.46v.42a.24.24,0,0,0,.25.24h3.41a.23.23,0,0,0,.24-.24v-.47a.24.24,0,0,0-.24-.25h-2.39l2.48-3.07A.53.53,0,0,0,164,83v-.5A.24.24,0,0,0,163.8,82.29Zm4-.11a2.21,2.21,0,0,0-2.24,2.36v.67a2.21,2.21,0,0,0,2.25,2.35,2.12,2.12,0,0,0,2-1.37.64.64,0,0,0,0-.17.17.17,0,0,0-.17-.18h-.67a.3.3,0,0,0-.24.15,1,1,0,0,1-1,.63,1.14,1.14,0,0,1-1.13-1.23v-.14h3.07A.25.25,0,0,0,170,85v-.48A2.2,2.2,0,0,0,167.81,82.18Zm1.12,2.28h-2.24v-.12a1.12,1.12,0,1,1,2.24,0Z"
+     style="fill:#ffffff;opacity:1;fill-opacity:1"
+     id="path131" />
+  <rect
+     width="246.61"
+     height="136.06"
+     style="fill:none;opacity:1"
+     id="rect133" />
+</svg>
diff --git a/src/res/populateBigBrainRelatedAreas.js b/src/res/populateBigBrainRelatedAreas.js
deleted file mode 100644
index 1243d1cf8f86410f2120ae22fee0d2865bf97474..0000000000000000000000000000000000000000
--- a/src/res/populateBigBrainRelatedAreas.js
+++ /dev/null
@@ -1,7 +0,0 @@
-const fs = require('fs')
-const path = require('path')
-
-const bigbrain = fs.readFileSync(path.join(__dirname, './ext/bigbrain.json'), 'utf-8')
-const colin = fs.readFileSync(path.join(__dirname, './ext/mni152.json'), 'utf-8')
-
-const bigbrainJson = JSON.parse(bigbrain)
diff --git a/src/res/populateColinKgID.js b/src/res/populateColinKgID.js
deleted file mode 100644
index a45a772cfbfabdd2ee1ff1af3bf081a0861d798a..0000000000000000000000000000000000000000
--- a/src/res/populateColinKgID.js
+++ /dev/null
@@ -1,449 +0,0 @@
-const fs = require('fs')
-
-const dictArr = [
-  {
-    "value": "Probabilistic cytoarchitectonic map of AStr (Amygdala)",
-    "uuid": "7772a4e8-1c35-445a-b7f4-4829a6202ed0",
-    "reference": "Dataset/cbfa0a7ecfab0b8c1b3cf39f19f4643e"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 1 (PostCG)",
-    "uuid": "7951a65c-34f3-435b-93a6-9383e739a8e3",
-    "reference": "Dataset/e278ef40929805586737c78aeb8c4ec6"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 2 (PostCS)",
-    "uuid": "30785c4a-fbc8-4c17-8afb-aa4e263c5904",
-    "reference": "Dataset/9349857d0b9d7f89d5948b0c10c42bcb"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 25 (sACC)",
-    "uuid": "e2a86898-c739-4fd6-a962-ca09b954d066",
-    "reference": "Dataset/4cff63f6a270b19f7f541e100e48913c"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 33 (ACC)",
-    "uuid": "ad3a655a-99b7-4e91-95bd-32ee1c6254fb",
-    "reference": "Dataset/c6aea16fb9af3f9a275ee7fb753573de"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 3a (PostCG)",
-    "uuid": "8f0b31d0-e7c5-4006-8f28-305ded7373de",
-    "reference": "Dataset/3473511a2ea226a636273e76186bac3b"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 3b (PostCG)",
-    "uuid": "c4aaccc0-4eda-4022-a06c-50fc3afccbfd",
-    "reference": "Dataset/db08224bd75c21ece58b145871b5be40"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 44 (IFG)",
-    "uuid": "35591609-651c-4d08-a4b5-92dbfe00e89f",
-    "reference": "Dataset/d0abf7131bc3460ac188632f40bf0748"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 45 (IFG)",
-    "uuid": "b240bd6e-9298-47d4-88b3-288024a4766b",
-    "reference": "Dataset/00748b8d790c0509d78f0c8679017935"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 4a (PreCG)",
-    "uuid": "8f69e5e2-b84e-4884-9bd9-efa787762f0e",
-    "reference": "Dataset/9c861298d842b61f14f0891e4f556cb6"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 4p (PreCG)",
-    "uuid": "5b7756dc-e2ac-4849-b64c-acd1e4405508",
-    "reference": "Dataset/9c8bf7b9620288e37de914e14514a7cb"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 5Ci (SPL)",
-    "uuid": "543e8f39-3193-4c42-bf7c-af0db5a734fa",
-    "reference": "Dataset/925dd675414de23caa52e0367c1a3375"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 5L (SPL)",
-    "uuid": "bfa768fa-0d81-4947-90b9-4e0f5943ce98",
-    "reference": "Dataset/bbe333a7175fa91ca85808525a8f3a95"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 5M (SPL)",
-    "uuid": "62e6f733-e207-4bf4-aa00-a2e8d7be8dfe",
-    "reference": "Dataset/4594e46485d1384a0a1cebd5401b0d02"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 7A (SPL)",
-    "uuid": "2bd849cb-f710-40da-a4cf-b2998a10e69b",
-    "reference": "Dataset/03af25a9e0615b08dd336cf19765b6dd"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 7M (SPL)",
-    "uuid": "d271ca98-bc2c-40d9-bb73-77d749c07d4e",
-    "reference": "Dataset/4246c3fb4cce9f1926f2f137e98bbfdb"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 7P (SPL)",
-    "uuid": "af2a6444-6c51-43e2-8ef7-f82736961815",
-    "reference": "Dataset/b1570fa8c0c775486afad8730acb4400"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area 7PC (SPL)",
-    "uuid": "905cab63-6eeb-4a61-9fd6-b4d0cd90504d",
-    "reference": "Dataset/98c962a9f987f1ac5798bf97c5faa9cf"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area FG1 (FusG)",
-    "uuid": "93872b4e-417c-484e-9df3-76b07feeb34c",
-    "reference": "Dataset/bb9bd9dbcbb1f9172e9aa1c5865a5411"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area FG2 (FusG)",
-    "uuid": "2fd16a43-acdc-4b5c-9548-4a5719905377",
-    "reference": "Dataset/d01f09f2e90f9a856262f0a0c829358f"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area FG3 (FusG)",
-    "uuid": "0a831b02-89e7-4c32-8dc0-cececd6de20a",
-    "reference": "Dataset/67d75cb8a7ae67e9008fde9c6798bd9f"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area FG4 (FusG)",
-    "uuid": "29cc742b-bf4d-4b88-ae1d-eb5dbd17bf73",
-    "reference": "Dataset/c89cb70ede397da7c18dc56793a6d1eb"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area Fo1 (OFC)",
-    "uuid": "cc324e6b-3b50-4d6c-a8ef-b478fd1764b4",
-    "reference": "Dataset/4d6a09d1a8264ec9060d8b658d1a28b7"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area Fo2 (OFC)",
-    "uuid": "68be103f-62fd-4e33-a632-10778b6898cb",
-    "reference": "Dataset/7b8a4c031ef1c753e13b8aacb2cb28a9"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area Fo3 (OFC)",
-    "uuid": "79de7855-a719-4909-9001-0f7bfff57b00",
-    "reference": "Dataset/b370022eaddfce62b33814b2853b8ad6"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area Fp1 (Fpole)",
-    "uuid": "515b269c-dc29-4355-88c5-b4f1e854f9a3",
-    "reference": "Dataset/19e764559ef6e1e11fa7ca0c061b3e1b"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area Fp2 (Fpole)",
-    "uuid": "93ee973c-e997-4707-826d-96c957ae742a",
-    "reference": "Dataset/f147c4445b7fe8c26d110e5aa327dc8c"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area Id1 (Insula)",
-    "uuid": "3e6ae903-5ae5-4203-857a-43b29179a0bc",
-    "reference": "Dataset/3b628033a68b7b2cafd8501706042b3e"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area Ig1 (Insula)",
-    "uuid": "4956bbdb-f9ad-4fd5-a837-f5646aeed55b",
-    "reference": "Dataset/b92753135f125edbf285cdae74a45572"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area Ig2 (Insula)",
-    "uuid": "d5a4e61d-b4ca-432a-9179-fc82a5102294",
-    "reference": "Dataset/d08c85f85353d7d5a03ec3a10ef9566d"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area OP1 (POperc)",
-    "uuid": "c5b9bc94-9024-40d9-b8c7-79e19fe96524",
-    "reference": "Dataset/1ecc35fa2ef043d9026eda54e32ee3c9"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area OP2 (POperc)",
-    "uuid": "a2fe492a-6d17-4699-8cec-09ce9d6a69d3",
-    "reference": "Dataset/3b6e889ba30baf75a016c34c63609caf"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area OP3 (POperc)",
-    "uuid": "b9d7fdb4-6ec6-46f3-ae03-b6640dc0085c",
-    "reference": "Dataset/77bb5b859947674decd96f8886619653"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area OP4 (POperc)",
-    "uuid": "12fde483-c866-49c2-8c8e-fd0195e194e3",
-    "reference": "Dataset/b147c7f329c4d0069fa35e260fafed0e"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area PF (IPL)",
-    "uuid": "f14b9614-cd37-4e0b-8c28-56d171ae2d1e",
-    "reference": "Dataset/e30a06f402f98e4e2e0b80425a569f97"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area PFcm (IPL)",
-    "uuid": "28897f4b-aa46-4830-a17b-a54770931115",
-    "reference": "Dataset/47fcb30b036539ab7c009399bac6b6c1"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area PFm (IPL)",
-    "uuid": "b052fbe0-ae5a-4171-b3be-104aca1e938b",
-    "reference": "Dataset/5f8db801807210e19645d3958668c60d"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area PFop (IPL)",
-    "uuid": "1def1da3-7936-4c64-8777-e632fbc73e0c",
-    "reference": "Dataset/4801fcd1e79382e28902c38471547a0c"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area PFt (IPL)",
-    "uuid": "87d46261-1367-4ba0-b8ee-a353e911dd4b",
-    "reference": "Dataset/be1bde02b8ddca822cace9cdfae221eb"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area PGa (IPL)",
-    "uuid": "411b4c3f-4715-4c25-849d-85f884eece8b",
-    "reference": "Dataset/a27ec0812e3277ec0a93d082bbace351"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area PGp (IPL)",
-    "uuid": "7868eb3b-e05d-41bc-ace5-32d9e6f1af48",
-    "reference": "Dataset/0f761108088e5c6c0f1993a84b85e461"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area TE 1.0 (HESCHL)",
-    "uuid": "769bc7b5-e2c3-41a7-aa2d-c09c229ecbef",
-    "reference": "Dataset/f5dcc725af7fdaef1e184484b495045c"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area TE 1.1 (HESCHL)",
-    "uuid": "7286763b-dad9-40ef-bb49-322041f1c95e",
-    "reference": "Dataset/7e2a5a6921cd568236b7a9d4a1dc1ad7"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area TE 1.2 (HESCHL)",
-    "uuid": "e9603a3b-2e32-4ac3-9476-3289c2ad9f9f",
-    "reference": "Dataset/ef2e9f0aedb49f1ee8a305b7d4397971"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area TE 3 (STG)",
-    "uuid": "942fc925-2e6d-4db4-abc5-df8b4196db5b",
-    "reference": "Dataset/e8a38320b02668ffce3df8b9024163ff"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area hIP1 (IPS)",
-    "uuid": "39158638-4760-4ae7-a94a-6f2222dbdc45",
-    "reference": "Dataset/6af6fa88e660803bfe737d78abfba9c6"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area hIP2 (IPS)",
-    "uuid": "164cc939-be2b-4c15-9e43-1d74916f1a87",
-    "reference": "Dataset/44347ffde2418d102f1fbe3df36ba897"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area hIP3 (IPS)",
-    "uuid": "0b0a5a50-96ca-409f-9fb8-14874f2eb045",
-    "reference": "Dataset/acd2500102705d2865f4a811f863ce18"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area hOc1 (V1, 17, CalcS)",
-    "uuid": "f44feb24-9198-4cd5-9f39-8173a8734865",
-    "reference": "Dataset/a49480ea46ec06a51f839ec6bae404b1"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area hOc2 (V2, 18)",
-    "uuid": "7680a762-08ba-4f5c-aac1-acf5a7773cf1",
-    "reference": "Dataset/4ceee0c2684c257fa7401cd923f44b6a"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area hOc3d (Cuneus)",
-    "uuid": "62e045a6-94d4-4764-befa-229429a5742d",
-    "reference": "Dataset/3f8497d0e7b282c215666f4c216ea2a3"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area hOc3v (LingG)",
-    "uuid": "945e7014-2633-4f9f-8b15-b486285a7e5f",
-    "reference": "Dataset/00f9638f9e81627771ccf3c515c01fac"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area hOc4d (Cuneus)",
-    "uuid": "b7a80af5-6d2b-46b1-ab33-b9405ffb6f6e",
-    "reference": "Dataset/48641ad140c23dc88d4034ab11ecf41e"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area hOc4la (LOC)",
-    "uuid": "5dfa15ad-c814-48b5-ba51-679c0d9c5fbd",
-    "reference": "Dataset/7a99754a1a8f941ce16f2eb9ad106d0f"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area hOc4lp (LOC)",
-    "uuid": "4343b80b-f2e1-4a5c-882d-6f17b7b37bb7",
-    "reference": "Dataset/d5205cc20d9f3e323f537f050e963a1d"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area hOc4v (LingG)",
-    "uuid": "e05ab6d2-c698-4283-bd67-8476b5dabd73",
-    "reference": "Dataset/b692644f1e98a9889a7756f2448dd88a"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area hOc5 (LOC)",
-    "uuid": "61089dcb-52ee-456b-9fe4-a28492281783",
-    "reference": "Dataset/9ec06ecd5945a620414509aaa0e04425"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area s24 (sACC)",
-    "uuid": "de488de5-e84c-450a-a63a-6d7a80858d0f",
-    "reference": "Dataset/64381c2320e4e0a448f20b9e903f647a"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Area s32 (sACC)",
-    "uuid": "84334f98-6db8-4cae-8228-b70ca53ff455",
-    "reference": "Dataset/439d1470b132315451f25156c73a1f01"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of CA1 (Hippocampus)",
-    "uuid": "ea3dd5dd-25dc-4ff7-a15e-5f19382fdec3",
-    "reference": "Dataset/ca2d24694a35504816e7aefa30754f80"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of CA2 (Hippocampus)",
-    "uuid": "094d5664-86a6-4b72-8955-f0a01f4578dd",
-    "reference": "Dataset/c04281360c6236a74876a7c68ea579dc"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of CA3 (Hippocampus)",
-    "uuid": "bbfa2c28-4dc2-4905-81cd-8f1bb217b70e",
-    "reference": "Dataset/0480823e8d127178b0b71d3091ddef1f"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of CM (Amygdala)",
-    "uuid": "393e8395-1fe5-4b0e-b71d-d3642904c947",
-    "reference": "Dataset/76b8f4f9a6dfee5e26ff535db561b3df"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Ch 1-3 (Basal Forebrain)",
-    "uuid": "360866f3-ecf9-4fbf-bddb-5c257b75d9aa",
-    "reference": "Dataset/14ca3b38abd01aaf41a2ec01327425ea"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Ch 4 (Basal Forebrain)",
-    "uuid": "d7f376b1-6a4a-4b60-8d4a-0b33b2caea93",
-    "reference": "Dataset/a4124b731158b0ae9528cb0ca704ed89"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of DG (Hippocampus)",
-    "uuid": "a0c37409-9ab9-475c-b8ca-ac26931e2076",
-    "reference": "Dataset/822002eb2dda15740da5b787289b8bf1"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Dorsal Dentate Nucleus (Cerebellum)",
-    "uuid": "c769c77f-bf7f-4dcc-8dea-17a8490c7de7",
-    "reference": "Dataset/6acab26c0e21a9cfb56bda875401f208"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Entorhinal Cortex",
-    "uuid": "f289487b-e03d-498b-8764-294ca4c3ea2f",
-    "reference": "Dataset/f5b0720e47bf31ecbbdf2f8b4e9b1f62"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Fastigial Nucleus (Cerebellum)",
-    "uuid": "01226dce-dd8a-484f-a683-f9cfc0a73504",
-    "reference": "Dataset/abdf1ae00cd05d8e53f167870ca1f97b"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of HATA (Hippocampus)",
-    "uuid": "123df9a1-db94-4624-85ee-b877343dd8c4",
-    "reference": "Dataset/6beb7234ab5aec18efaf09b8f5f396ef"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Interposed Nucleus (Cerebellum)",
-    "uuid": "33dcfd4a-09ba-493b-8025-3e7d63eea456",
-    "reference": "Dataset/c99a7efffacca3b364c05a7a9345839a"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of LB (Amygdala)",
-    "uuid": "fa4e681b-c76d-4764-8821-8fca40e5af9b",
-    "reference": "Dataset/f35c3cd95c69038c00654368ea4c1d1e"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of SF (Amygdala)",
-    "uuid": "9ab308bc-a5ad-45b8-98cb-2a453d767a95",
-    "reference": "Dataset/7de5bfc9a49adab222aa0496e3b973d2"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Subc (Hippocampus)",
-    "uuid": "b8b96954-1544-405b-ac51-4a12ce54afd9",
-    "reference": "Dataset/4646c5ae8b8020b6737536d03dc11172"
-  },
-  {
-    "value": "Probabilistic cytoarchitectonic map of Ventral Dentate Nucleus (Cerebellum)",
-    "uuid": "58741d45-6d01-4263-9797-e5cd515e650f",
-    "reference": "Dataset/aff5abef8edf16f1bcf637a44233feb6"
-  }
-]
-
-const querySingle = (obj) => new Promise((resolve, reject) => {
-  if(obj.labelIndex){
-    const matchIndex = dictArr.findIndex(entry => `Probabilistic cytoarchitectonic map of ${obj.name}` === entry.value)
-    let kgref
-    if(matchIndex >= 0){
-      
-    }else{
-      if(obj.name === 'Area 2 (PostCG)'){
-        kgref = 'Dataset/9349857d0b9d7f89d5948b0c10c42bcb'
-      }
-      if(obj.name === ''){
-
-      }
-      console.error('could not find a match', obj.name)
-    }
-    resolve(obj)
-  }else{
-    Promise.all(obj.children.map(item => querySingle(item)))
-      .then(children => resolve(
-        Object.assign({}, obj, {children})
-      ))
-      .catch(err => reject(err))
-  }
-})
-
-const getKgItemFromName = (name) => {
-  const foundEntry = dictArr.find(entry => `Probabilistic cytoarchitectonic map of ${name}` === entry.value)
-  return foundEntry
-    ? foundEntry
-    : name === 'Area 2 (PostCG)'
-      ? getKgItemFromName('Area 2 (PostCS)')
-      : name === 'emboliform nucleus, globose nucleus'
-        ? getKgItemFromName('Interposed Nucleus (Cerebellum)')
-        : (console.log('could not find anything, issue', name), null)
-}
-
-const querySingleFlat = (obj) => Object.assign({}, obj, {
-  type : 'Probabilistic cytoarchitectonic map',
-  name : getKgItemFromName(obj.regionName[0].regionName).value,
-  kgID : getKgItemFromName(obj.regionName[0].regionName).reference,
-  uuid : getKgItemFromName(obj.regionName[0].regionName).uuid
-})
-
-fs.readFile('./raw/pmapsAggregatedData.json','utf-8', (err, data) => {
-  if(err) throw err
-  const arr = JSON.parse(data)
-  const newarr = arr.map(querySingleFlat)
-  fs.writeFile('./raw/newPmapsAggregatedData.json', JSON.stringify(newarr), 'utf-8', (err) => {
-    if(err) throw err
-    console.log('done')
-  })
-})
-
-// fetch("https://kg.humanbrainproject.org/api/smartproxy/kg/_search", {
-//   "credentials":"include",
-//   "headers":{},
-//   "referrer":"https://kg.humanbrainproject.org/webapp/?q=area%2044%20%28IFG%29",
-//   "referrerPolicy":"no-referrer-when-downgrade",
-//   "body":"{\"query\":{\"query_string\":{\"query\":\"Area hIP1 (IPS)\"}}}",
-//   "method":"POST",
-//   "mode":"cors"})
-//   .then(res => res.json())
-//   .then(json => {
-//     fs.writeFile('./raw/hip1.json', JSON.stringify(json), 'utf-8', (err) => {
-//       if(err) throw err
-//       console.log('writing finished')
-//     })
-//   })
-//   .catch(console.error)
\ No newline at end of file
diff --git a/src/services/effect/effect.spec.ts b/src/services/effect/effect.spec.ts
index c8bb115fca5e4d06deba3e657583e2443f6a52e7..d62f8d8b0efb499858aa10443d92809c34b94ba1 100644
--- a/src/services/effect/effect.spec.ts
+++ b/src/services/effect/effect.spec.ts
@@ -27,6 +27,13 @@ const hoc1 = {
     -84646549,
     1855106,
   ],
+  originDatasets: [
+    {
+      kgSchema: "minds/core/dataset/v1.0.0",
+      kgId: "5c669b77-c981-424a-858d-fe9f527dbc07",
+      filename: "Area hOc1 (V1, 17, CalcS) [v2.4, Colin 27, left hemisphere]"
+    }
+  ],
 }
 
 describe('effect.ts', () => {
diff --git a/src/services/state/dataStore.store.ts b/src/services/state/dataStore.store.ts
index 5d16c11a604d0d01b6db3913c05c998840dad3bd..07782dfec54b606443feb9c90db5dfc8c44f655d 100644
--- a/src/services/state/dataStore.store.ts
+++ b/src/services/state/dataStore.store.ts
@@ -18,8 +18,6 @@ export interface IStateInterface {
   datasetPreviews: DatasetPreview[]
 }
 
-
-
 export const defaultState = {
   fetchedDataEntries: [],
   favDataEntries: (() => {
@@ -74,6 +72,17 @@ export const getStateStore = ({ state: state = defaultState } = {}) => (prevStat
       })
     }
   }
+  case ACTION_TYPES.CLEAR_PREVIEW_DATASET: {
+    const { payload = {}} = action
+    const { file , dataset } = payload
+    const { fullId } = dataset
+    const { filename } = file
+    return {
+      ...prevState,
+      datasetPreviews: prevState.datasetPreviews
+        .filter(({ datasetId, filename: fName }) => !(datasetId === fullId && fName === filename))
+    }
+  }
   case ACTION_TYPES.CLEAR_PREVIEW_DATASETS: {
     return {
       ...prevState,
@@ -233,6 +242,7 @@ const ACTION_TYPES = {
   UNFAV_DATASET: 'UNFAV_DATASET',
   TOGGLE_FAV_DATASET: 'TOGGLE_FAV_DATASET',
   PREVIEW_DATASET: 'PREVIEW_DATASET',
+  CLEAR_PREVIEW_DATASET: 'CLEAR_PREVIEW_DATASET',
   CLEAR_PREVIEW_DATASETS: 'CLEAR_PREVIEW_DATASETS'
 }
 
diff --git a/src/services/state/ngViewerState.store.ts b/src/services/state/ngViewerState.store.ts
index aaa71a273df6c9c317d53865a247ea8dfbe59ea3..652310cec36afaab699cb29c158c614fa918d704 100644
--- a/src/services/state/ngViewerState.store.ts
+++ b/src/services/state/ngViewerState.store.ts
@@ -6,6 +6,8 @@ import { AtlasViewerConstantsServices } from 'src/atlasViewer/atlasViewer.consta
 import { SNACKBAR_MESSAGE } from './uiState.store';
 import { getNgIds, IavRootStoreInterface, GENERAL_ACTION_TYPES } from '../stateStore.service';
 import { Action, select, Store } from '@ngrx/store'
+import { BACKENDURL } from 'src/util/constants';
+import { HttpClient } from '@angular/common/http';
 
 export const FOUR_PANEL = 'FOUR_PANEL'
 export const V_ONE_THREE = 'V_ONE_THREE'
@@ -78,26 +80,7 @@ export const getStateStore = ({ state = defaultState } = {}) => (prevState: Stat
   case ADD_NG_LAYER:
     return {
       ...prevState,
-
-      /* this configration hides the layer if a non mixable layer already present */
-
-      /* this configuration does not the addition of multiple non mixable layers */
-      // layers : action.layer.mixability === 'nonmixable' && prevState.layers.findIndex(l => l.mixability === 'nonmixable') >= 0
-      //   ? prevState.layers
-      //   : prevState.layers.concat(action.layer)
-
-      /* this configuration allows the addition of multiple non mixables */
-      // layers : prevState.layers.map(l => mapLayer(l, action.layer)).concat(action.layer)
       layers : mixNgLayers(prevState.layers, action.layer),
-
-      // action.layer.constructor === Array
-      //   ? prevState.layers.concat(action.layer)
-      //   : prevState.layers.concat({
-      //     ...action.layer,
-      //     ...( action.layer.mixability === 'nonmixable' && prevState.layers.findIndex(l => l.mixability === 'nonmixable') >= 0
-      //           ? {visible: false}
-      //           : {})
-      //   })
     }
   case REMOVE_NG_LAYERS: {
     const { layers } = action
@@ -198,30 +181,34 @@ export class NgViewerUseEffect implements OnDestroy {
   constructor(
     private actions: Actions,
     private store$: Store<IavRootStoreInterface>,
-    private constantService: AtlasViewerConstantsServices
+    private constantService: AtlasViewerConstantsServices,
+    private http: HttpClient,
   ){
 
     // TODO either split backend user to be more granular, or combine the user config into a single subscription
     this.subscriptions.push(
       this.store$.pipe(
         select('ngViewerState'),
-        distinctUntilChanged(),
         debounceTime(200),
         skip(1),
         // Max frequency save once every second
+
+        // properties to be saved
+        map(({ panelMode, panelOrder }) => {
+          return { panelMode, panelOrder }
+        }),
+        distinctUntilChanged(),
         throttleTime(1000)
-      ).subscribe(({panelMode, panelOrder}) => {
-        fetch(`${this.constantService.backendUrl}user/config`, {
-          method: 'POST',
+      ).subscribe(ngViewerState => {
+        this.http.post(`${BACKENDURL}user/config`, JSON.stringify({ ngViewerState }),  {
           headers: {
             'Content-type': 'application/json'
-          },
-          body: JSON.stringify({ ngViewerState: { panelMode, panelOrder } })
+          }
         })
       })
     )
 
-    this.applySavedUserConfig$ = from(fetch(`${this.constantService.backendUrl}user/config`).then(r => r.json())).pipe(
+    this.applySavedUserConfig$ = this.http.get(`${BACKENDURL}user/config`).pipe(
       catchError((err,caught) => of(null)),
       filter(v => !!v),
       withLatestFrom(this.store$),
@@ -449,6 +436,7 @@ export interface INgLayerInterface {
   name: string
   source: string
   mixability: string // base | mixable | nonmixable
+  annotation?: string //
   visible?: boolean
   shader?: string
   transform?: any
diff --git a/src/services/state/uiState.store.spec.ts b/src/services/state/uiState.store.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..3ee389e6ade78280cd3ac84fbc0991180dc924a2
--- /dev/null
+++ b/src/services/state/uiState.store.spec.ts
@@ -0,0 +1,65 @@
+import { TestBed, async } from "@angular/core/testing"
+import { Component, Inject } from "@angular/core"
+import { getMouseoverSegmentsFactory } from "./uiState.store"
+import { Store } from "@ngrx/store"
+import { provideMockStore } from "@ngrx/store/testing"
+import { defaultRootState } from "../stateStore.service"
+
+const INJECTION_TOKEN = `INJECTION_TOKEN`
+
+@Component({
+  template: ''
+})
+class TestCmp{
+  constructor(
+    @Inject(INJECTION_TOKEN) public getMouseoverSegments: Function
+  ){
+
+  }
+}
+
+const dummySegment = {
+  layer: {
+    name: 'apple'
+  },
+  segment: {
+    hello: 'world'
+  }
+}
+
+describe('getMouseoverSegmentsFactory', () => {
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [
+        TestCmp
+      ],
+      providers: [
+        {
+          provide: INJECTION_TOKEN,
+          useFactory: getMouseoverSegmentsFactory,
+          deps: [ Store ]
+        },
+        provideMockStore({
+          initialState: {
+            ...defaultRootState,
+            uiState: {
+              ...defaultRootState.uiState,
+              mouseOverSegments: [ dummySegment ]
+            }
+          }
+        })
+      ]
+    }).compileComponents()
+  }))
+
+  it('should compile component', () => {
+    const fixture = TestBed.createComponent(TestCmp)
+    expect(fixture).toBeTruthy()
+  })
+
+  it('function should return dummy segment', () => {
+    const fixutre = TestBed.createComponent(TestCmp)
+    const result = fixutre.componentInstance.getMouseoverSegments()
+    expect(result).toEqual([dummySegment])
+  })
+})
\ No newline at end of file
diff --git a/src/services/state/uiState.store.ts b/src/services/state/uiState.store.ts
index f02d626729e0a1265e78ce3a3c5302c6edd7deb2..199cbf3c3c8e21040a31bbfda4f13d464078a11c 100644
--- a/src/services/state/uiState.store.ts
+++ b/src/services/state/uiState.store.ts
@@ -3,7 +3,7 @@ import { Action, select, Store } from '@ngrx/store'
 
 import { Effect, Actions, ofType } from "@ngrx/effects";
 import { Observable, Subscription } from "rxjs";
-import { filter, map, mapTo, scan, startWith } from "rxjs/operators";
+import { filter, map, mapTo, scan, startWith, take } from "rxjs/operators";
 import { COOKIE_VERSION, KG_TOS_VERSION, LOCAL_STORAGE_CONST } from 'src/util/constants'
 import { IavRootStoreInterface } from '../stateStore.service'
 import { MatBottomSheetRef, MatBottomSheet } from '@angular/material/bottom-sheet';
@@ -22,9 +22,6 @@ export const defaultState: StateInterface = {
 
   snackbarMessage: null,
 
-  pluginRegionSelectionEnabled: false,
-  persistentStateNotifierMessage: null,
-
   /**
    * replace with server side logic (?)
    */
@@ -108,21 +105,6 @@ export const getStateStore = ({ state = defaultState } = {}) => (prevState: Stat
       sidePanelCurrentViewContent: 'Dataset',
     }
 
-  case ENABLE_PLUGIN_REGION_SELECTION: {
-    return {
-      ...prevState,
-      pluginRegionSelectionEnabled: true,
-      persistentStateNotifierMessage: action.payload
-    }
-  }
-  case DISABLE_PLUGIN_REGION_SELECTION: {
-    return {
-      ...prevState,
-      pluginRegionSelectionEnabled: false,
-      persistentStateNotifierMessage: null
-    }
-  }
-
   case AGREE_COOKIE: {
     /**
        * TODO replace with server side logic
@@ -177,10 +159,7 @@ export interface StateInterface {
 
   focusedSidePanel: string | null
 
-  snackbarMessage: symbol
-
-  pluginRegionSelectionEnabled: boolean
-  persistentStateNotifierMessage: string
+  snackbarMessage: string
 
   agreedCookies: boolean
   agreedKgTos: boolean
@@ -203,6 +182,20 @@ export interface ActionInterface extends Action {
   payload: any
 }
 
+export const GET_MOUSEOVER_SEGMENTS_TOKEN = `GET_MOUSEOVER_SEGMENTS_TOKEN`
+
+export const getMouseoverSegmentsFactory = (store: Store<IavRootStoreInterface>) => {
+  return () => {
+    let moSegments
+    store.pipe(
+      select('uiState'),
+      select('mouseOverSegments'),
+      take(1)
+    ).subscribe(v => moSegments = v)
+    return moSegments
+  }
+}
+
 @Injectable({
   providedIn: 'root',
 })
@@ -287,9 +280,6 @@ export const HIDE_SIDE_PANEL_CONNECTIVITY = `HIDE_SIDE_PANEL_CONNECTIVITY`
 export const COLLAPSE_SIDE_PANEL_CURRENT_VIEW = `COLLAPSE_SIDE_PANEL_CURRENT_VIEW`
 export const EXPAND_SIDE_PANEL_CURRENT_VIEW = `EXPAND_SIDE_PANEL_CURRENT_VIEW`
 
-export const ENABLE_PLUGIN_REGION_SELECTION = `ENABLE_PLUGIN_REGION_SELECTION`
-export const DISABLE_PLUGIN_REGION_SELECTION = `DISABLE_PLUGIN_REGION_SELECTION`
-
 export const AGREE_COOKIE = `AGREE_COOKIE`
 export const AGREE_KG_TOS = `AGREE_KG_TOS`
 export const SHOW_KG_TOS = `SHOW_KG_TOS`
diff --git a/src/services/stateStore.service.ts b/src/services/stateStore.service.ts
index 45aee75b421a35e660d3060cdd5082ec3150afae..654e6f4395fa22e84724594b9788d3e640b096e2 100644
--- a/src/services/stateStore.service.ts
+++ b/src/services/stateStore.service.ts
@@ -52,7 +52,7 @@ export { userConfigState,  USER_CONFIG_ACTION_TYPES}
 export { ADD_NG_LAYER, FORCE_SHOW_SEGMENT, HIDE_NG_LAYER, REMOVE_NG_LAYER, SHOW_NG_LAYER } from './state/ngViewerState.store'
 export { CHANGE_NAVIGATION, DESELECT_LANDMARKS, FETCHED_TEMPLATE, NEWVIEWER, SELECT_LANDMARKS, SELECT_PARCELLATION, SELECT_REGIONS, USER_LANDMARKS } from './state/viewerState.store'
 export { IDataEntry, IParcellationRegion, FETCHED_DATAENTRIES, FETCHED_SPATIAL_DATA, ILandmark, IOtherLandmarkGeometry, IPlaneLandmarkGeometry, IPointLandmarkGeometry, IProperty, IPublication, IReferenceSpace, IFile, IFileSupplementData } from './state/dataStore.store'
-export { CLOSE_SIDE_PANEL, MOUSE_OVER_LANDMARK, MOUSE_OVER_SEGMENT, OPEN_SIDE_PANEL, SHOW_SIDE_PANEL_CONNECTIVITY, HIDE_SIDE_PANEL_CONNECTIVITY, COLLAPSE_SIDE_PANEL_CURRENT_VIEW, EXPAND_SIDE_PANEL_CURRENT_VIEW, ENABLE_PLUGIN_REGION_SELECTION, DISABLE_PLUGIN_REGION_SELECTION } from './state/uiState.store'
+export { CLOSE_SIDE_PANEL, MOUSE_OVER_LANDMARK, MOUSE_OVER_SEGMENT, OPEN_SIDE_PANEL, SHOW_SIDE_PANEL_CONNECTIVITY, HIDE_SIDE_PANEL_CONNECTIVITY, COLLAPSE_SIDE_PANEL_CURRENT_VIEW, EXPAND_SIDE_PANEL_CURRENT_VIEW } from './state/uiState.store'
 export { UserConfigStateUseEffect } from './state/userConfigState.store'
 
 export const GENERAL_ACTION_TYPES = {
diff --git a/src/services/uiService.service.ts b/src/services/uiService.service.ts
index 26917c95d54f317b74020ef93d04fa36f17425a8..dc6f4dda7ea8c427536f2b567e94ef2b24e726ab 100644
--- a/src/services/uiService.service.ts
+++ b/src/services/uiService.service.ts
@@ -1,7 +1,8 @@
 import { Injectable } from "@angular/core";
-import { AtlasViewerAPIServices } from "src/atlasViewer/atlasViewer.apiService.service";
 import { ToastHandler } from "src/util/pluginHandlerClasses/toastHandler";
 import {MatSnackBar, MatSnackBarConfig} from "@angular/material/snack-bar";
+import { MatDialog } from "@angular/material/dialog";
+import { ActionDialog } from "src/ui/actionDialog/actionDialog.component";
 
 @Injectable({
   providedIn: 'root',
@@ -10,26 +11,34 @@ import {MatSnackBar, MatSnackBarConfig} from "@angular/material/snack-bar";
 export class UIService {
   constructor(
     private snackbar: MatSnackBar,
-    private apiService: AtlasViewerAPIServices,
+    private dialog: MatDialog
   ) {
-    this.apiService.interactiveViewer.uiHandle.getToastHandler = () => {
-      const toasthandler = new ToastHandler()
-      let handle
-      toasthandler.show = () => {
-        handle = this.showMessage(toasthandler.message, null, {
-          duration: toasthandler.timeout,
-        })
-      }
+  }
+
+  public getToastHandler = () => {
+    const toasthandler = new ToastHandler()
+    let handle
+    toasthandler.show = () => {
+      handle = this.showMessage(toasthandler.message, null, {
+        duration: toasthandler.timeout,
+      })
+    }
 
-      toasthandler.hide = () => {
-        if (handle) { handle.dismiss() }
-        handle = null
-      }
-      return toasthandler
+    toasthandler.hide = () => {
+      if (handle) { handle.dismiss() }
+      handle = null
     }
+    return toasthandler
   }
 
   public showMessage(message: string, actionBtnTxt: string = 'Dismiss', config?: Partial<MatSnackBarConfig>) {
     return this.snackbar.open(message, actionBtnTxt, config)
   }
+
+  public showDialog(data, options){
+    return this.dialog.open(ActionDialog, {
+      ...options,
+      data
+    })
+  }
 }
diff --git a/src/share/saneUrl/saneUrl.component.spec.ts b/src/share/saneUrl/saneUrl.component.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..4b830bb1aac5339f3a27cf9963328be5d9cd45c1
--- /dev/null
+++ b/src/share/saneUrl/saneUrl.component.spec.ts
@@ -0,0 +1,315 @@
+import { TestBed, async, fakeAsync, tick, flush } from '@angular/core/testing'
+import { ShareModule } from '../share.module'
+import { SaneUrl } from './saneUrl.component'
+import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'
+import { By } from '@angular/platform-browser'
+import { BACKENDURL } from 'src/util/constants'
+import { NoopAnimationsModule } from '@angular/platform-browser/animations'
+
+const inputCss = `input[aria-label="Custom link"]`
+const submitCss = `button[aria-label="Create custom link"]`
+const copyBtnCss = `button[aria-label="Copy created custom URL to clipboard"]`
+
+describe('> saneUrl.component.ts', () => {
+  describe('> SaneUrl', () => {
+    beforeEach(async(() => {
+      TestBed.configureTestingModule({
+        imports: [
+          ShareModule,
+          HttpClientTestingModule,
+          NoopAnimationsModule,
+        ]
+      }).compileComponents()
+    }))
+
+    afterEach(() => {
+      const ctrl = TestBed.inject(HttpTestingController)
+      ctrl.verify()
+    })
+
+    it('> can be created', () => {
+      const fixture = TestBed.createComponent(SaneUrl)
+      const el = fixture.debugElement.componentInstance
+      expect(el).toBeTruthy()
+    })
+
+    it('> all elements exist', () => {
+      const fixture = TestBed.createComponent(SaneUrl)
+
+      const input = fixture.debugElement.query( By.css( inputCss ) )
+      expect(input).toBeTruthy()
+
+      const submit = fixture.debugElement.query( By.css( submitCss ) )
+      expect(submit).toBeTruthy()
+
+      const cpyBtn = fixture.debugElement.query( By.css( copyBtnCss ) )
+      expect(cpyBtn).toBeFalsy()
+    })
+
+    it('> catches invalid input syncly', fakeAsync(() => {
+
+      const failValue = `test-1`
+
+      // Necessary to detectChanges, or formControl will not initialise properly
+      // See https://stackoverflow.com/a/56600762/6059235
+      const fixture = TestBed.createComponent(SaneUrl)
+      fixture.detectChanges()
+
+      // Set fail value
+      fixture.componentInstance.customUrl.setValue(failValue)
+
+      // Expect validator to fail catch it
+      expect(fixture.componentInstance.customUrl.invalid).toEqual(true)
+
+      // on change detection, UI should catch it
+      fixture.detectChanges()
+
+      const input = fixture.debugElement.query( By.css( inputCss ) )
+      const invalid = input.attributes['aria-invalid']
+      expect(invalid.toString()).toEqual('true')
+
+    }))
+
+    it('> when user inputs valid input, does not not invalidate', () => {
+
+      const successValue = `test_1`
+
+      // Necessary to detectChanges, or formControl will not initialise properly
+      // See https://stackoverflow.com/a/56600762/6059235
+      const fixture = TestBed.createComponent(SaneUrl)
+      fixture.detectChanges()
+
+      // Set fail value
+      fixture.componentInstance.customUrl.setValue(successValue)
+
+      // Expect validator to fail catch it
+      expect(fixture.componentInstance.customUrl.invalid).toEqual(false)
+
+      // on change detection, UI should catch it
+      fixture.detectChanges()
+
+      const input = fixture.debugElement.query( By.css( inputCss ) )
+      const invalid = input.attributes['aria-invalid']
+      expect(invalid.toString()).toEqual('false')
+    })
+
+    it('> on entering string in input, makes debounced GET request', fakeAsync(() => {
+
+      const value = 'test_1'
+
+      const httpTestingController = TestBed.inject(HttpTestingController)
+
+      // Necessary to detectChanges, or formControl will not initialise properly
+      // See https://stackoverflow.com/a/56600762/6059235
+      const fixture = TestBed.createComponent(SaneUrl)
+      fixture.detectChanges()
+
+      // Set value
+      fixture.componentInstance.customUrl.setValue(value)
+
+      tick(500)
+
+      const req = httpTestingController.expectOne(`${BACKENDURL}saneUrl/${value}`)
+      req.flush(200)
+    }))
+
+    it('> on 200 response, show error', fakeAsync(() => {
+      
+      const value = 'test_1'
+
+      const httpTestingController = TestBed.inject(HttpTestingController)
+
+      // Necessary to detectChanges, or formControl will not initialise properly
+      // See https://stackoverflow.com/a/56600762/6059235
+      const fixture = TestBed.createComponent(SaneUrl)
+      fixture.detectChanges()
+
+      // Set value
+      fixture.componentInstance.customUrl.setValue(value)
+
+      tick(500)
+
+      const req = httpTestingController.expectOne(`${BACKENDURL}saneUrl/${value}`)
+      req.flush('OK')
+
+      // Expect validator to fail catch it
+      expect(fixture.componentInstance.customUrl.invalid).toEqual(true)
+
+      // on change detection, UI should catch it
+      fixture.detectChanges()
+
+      const input = fixture.debugElement.query( By.css( inputCss ) )
+      const invalid = input.attributes['aria-invalid']
+      expect(invalid.toString()).toEqual('true')
+
+      const submit = fixture.debugElement.query( By.css( submitCss ) )
+      const disabled = !!submit.attributes['disabled']
+      expect(disabled.toString()).toEqual('true')
+    }))
+
+    it('> on 404 response, show available', fakeAsync(() => {
+
+      const value = 'test_1'
+
+      const httpTestingController = TestBed.inject(HttpTestingController)
+
+      // Necessary to detectChanges, or formControl will not initialise properly
+      // See https://stackoverflow.com/a/56600762/6059235
+      const fixture = TestBed.createComponent(SaneUrl)
+      fixture.detectChanges()
+
+      // Set value
+      fixture.componentInstance.customUrl.setValue(value)
+
+      tick(500)
+
+      const req = httpTestingController.expectOne(`${BACKENDURL}saneUrl/${value}`)
+      req.flush('some reason', { status: 404, statusText: 'Not Found.' })
+
+      // Expect validator to fail catch it
+      expect(fixture.componentInstance.customUrl.invalid).toEqual(false)
+
+      // on change detection, UI should catch it
+      fixture.detectChanges()
+
+      const input = fixture.debugElement.query( By.css( inputCss ) )
+      const invalid = input.attributes['aria-invalid']
+      expect(invalid.toString()).toEqual('false')
+
+      const submit = fixture.debugElement.query( By.css( submitCss ) )
+      const disabled = !!submit.attributes['disabled']
+      expect(disabled.toString()).toEqual('false')
+    }))
+
+    it('> on other error codes, show invalid', fakeAsync(() => {
+
+      const value = 'test_1'
+
+      const httpTestingController = TestBed.inject(HttpTestingController)
+
+      // Necessary to detectChanges, or formControl will not initialise properly
+      // See https://stackoverflow.com/a/56600762/6059235
+      const fixture = TestBed.createComponent(SaneUrl)
+      fixture.detectChanges()
+
+      // Set value
+      fixture.componentInstance.customUrl.setValue(value)
+
+      tick(500)
+
+      const req = httpTestingController.expectOne(`${BACKENDURL}saneUrl/${value}`)
+      req.flush('some reason', { status: 401, statusText: 'Unauthorised.' })
+
+      // Expect validator to fail catch it
+      expect(fixture.componentInstance.customUrl.invalid).toEqual(true)
+
+      // on change detection, UI should catch it
+      fixture.detectChanges()
+
+      const input = fixture.debugElement.query( By.css( inputCss ) )
+      const invalid = input.attributes['aria-invalid']
+      expect(invalid.toString()).toEqual('true')
+
+      const submit = fixture.debugElement.query( By.css( submitCss ) )
+      const disabled = !!submit.attributes['disabled']
+      expect(disabled.toString()).toEqual('true')
+    }))
+
+    it('> on click create link btn calls correct API', fakeAsync(() => {
+
+      const value = 'test_1'
+
+      const httpTestingController = TestBed.inject(HttpTestingController)
+
+      // Necessary to detectChanges, or formControl will not initialise properly
+      // See https://stackoverflow.com/a/56600762/6059235
+      const fixture = TestBed.createComponent(SaneUrl)
+      fixture.detectChanges()
+
+      // Set value
+      fixture.componentInstance.customUrl.setValue(value)
+
+      tick(500)
+
+      const req = httpTestingController.expectOne(`${BACKENDURL}saneUrl/${value}`)
+      req.flush('some reason', { status: 404, statusText: 'Not Found.' })
+
+      fixture.detectChanges()
+      flush()
+
+      const submit = fixture.debugElement.query( By.css( submitCss ) )
+      const disabled = !!submit.attributes['disabled']
+      expect(disabled.toString()).toEqual('false')
+
+      submit.triggerEventHandler('click', {})
+
+      fixture.detectChanges()
+
+      const disabledInProgress = !!submit.attributes['disabled']
+      expect(disabledInProgress.toString()).toEqual('true')
+
+      const req2 = httpTestingController.expectOne({
+        method: 'POST',
+        url: `${BACKENDURL}saneUrl/${value}`
+      })
+      
+      req2.flush({})
+
+      fixture.detectChanges()
+
+      const disabledAfterComplete = !!submit.attributes['disabled']
+      expect(disabledAfterComplete.toString()).toEqual('true')
+
+      const cpyBtn = fixture.debugElement.query( By.css( copyBtnCss ) )
+      expect(cpyBtn).toBeTruthy()
+    }))
+
+    it('> on click create link btn fails show result', fakeAsync(() => {
+
+      const value = 'test_1'
+
+      const httpTestingController = TestBed.inject(HttpTestingController)
+
+      // Necessary to detectChanges, or formControl will not initialise properly
+      // See https://stackoverflow.com/a/56600762/6059235
+      const fixture = TestBed.createComponent(SaneUrl)
+      fixture.detectChanges()
+
+      // Set value
+      fixture.componentInstance.customUrl.setValue(value)
+
+      tick(500)
+
+      const req = httpTestingController.expectOne(`${BACKENDURL}saneUrl/${value}`)
+      req.flush('some reason', { status: 404, statusText: 'Not Found.' })
+
+      fixture.detectChanges()
+      flush()
+
+      const submit = fixture.debugElement.query( By.css( submitCss ) )
+      const disabled = !!submit.attributes['disabled']
+      expect(disabled.toString()).toEqual('false')
+
+      submit.triggerEventHandler('click', {})
+
+      fixture.detectChanges()
+
+      const disabledInProgress = !!submit.attributes['disabled']
+      expect(disabledInProgress.toString()).toEqual('true')
+
+      const req2 = httpTestingController.expectOne({
+        method: 'POST',
+        url: `${BACKENDURL}saneUrl/${value}`
+      })
+      
+      req2.flush('Something went wrong', { statusText: 'Wrong status text', status: 500 })
+
+      fixture.detectChanges()
+
+      const input = fixture.debugElement.query( By.css( inputCss ) )
+      const invalid = input.attributes['aria-invalid']
+      expect(invalid.toString()).toEqual('true')
+
+    }))
+  })
+})
diff --git a/src/share/saneUrl/saneUrl.component.ts b/src/share/saneUrl/saneUrl.component.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c397478f5b62b0a7574d3b4b00a5d95fc8e7253a
--- /dev/null
+++ b/src/share/saneUrl/saneUrl.component.ts
@@ -0,0 +1,189 @@
+import { Component, OnDestroy, Input } from "@angular/core";
+import { HttpClient } from '@angular/common/http'
+import { BACKENDURL } from 'src/util/constants'
+import { Observable, merge, of, Subscription, BehaviorSubject, combineLatest } from "rxjs";
+import { startWith, mapTo, map, debounceTime, switchMap, catchError, shareReplay, filter, tap, takeUntil, distinctUntilChanged } from "rxjs/operators";
+import { FormControl } from "@angular/forms";
+import { ErrorStateMatcher } from "@angular/material/core";
+import { Clipboard } from "@angular/cdk/clipboard";
+import { MatSnackBar } from "@angular/material/snack-bar";
+
+export class SaneUrlErrorStateMatcher implements ErrorStateMatcher{
+  isErrorState(ctrl: FormControl | null){
+    return !!(ctrl && ctrl.invalid)
+  }
+}
+
+enum ESavingProgress {
+  INIT,
+  INPROGRESS,
+  DONE,
+  DEFAULT,
+  ERROR,
+}
+
+enum EBtnTxt {
+  AVAILABLE = 'Available',
+  VERIFYING = 'Verifying ...',
+  CREATING = 'Creating ...',
+  CREATED = 'Created!',
+  DEFAULT = '...',
+}
+
+enum ESavingStatus {
+  PENDING,
+  FREE,
+  NOTFREE,
+}
+
+@Component({
+  selector: 'iav-sane-url',
+  templateUrl: './saneUrl.template.html'
+})
+
+export class SaneUrl implements OnDestroy{
+
+  @Input() stateTobeSaved: any
+
+  private subscriptions: Subscription[] = []
+
+  private validator = (val: string) => /^[a-zA-Z0-9_]+$/.test(val)
+  public customUrl = new FormControl('')
+
+  public matcher = new SaneUrlErrorStateMatcher()
+
+  public createBtnDisabled$: Observable<boolean>
+  public iconClass$: Observable<string>
+
+  public savingStatus$: Observable<ESavingStatus>
+  public btnHintTxt$: Observable<EBtnTxt>
+
+  public savingProgress$: BehaviorSubject<ESavingProgress> = new BehaviorSubject(ESavingProgress.INIT)
+  public saved$: Observable<boolean>
+
+  constructor(
+    private http: HttpClient,
+    private clipboard: Clipboard,
+    private snackbar: MatSnackBar,
+  ){
+
+    const validatedValueInput$ = this.customUrl.valueChanges.pipe(
+      tap(val => {
+        if (!this.validator(val)) {
+          this.customUrl.setErrors({
+            message: 'Shortname must only use the following characters: a-zA-Z0-9_'
+          })
+        }
+      }),
+      filter(this.validator),
+      distinctUntilChanged(),
+      shareReplay(1),
+    )
+
+    const checkAvailable$ = validatedValueInput$.pipe(
+      debounceTime(500),
+      switchMap(val => val === ''
+        ? of(false)
+        : this.http.get(`${this.saneUrlRoot}${val}`).pipe(
+          mapTo(false),
+          catchError((err, obs) => {
+            const { status } = err
+            if (status === 404) return of(true)
+            return of(false)
+          })
+        )
+      ),
+      shareReplay(1)
+    )
+
+    this.savingStatus$ = merge(
+      this.customUrl.valueChanges.pipe(
+        mapTo(ESavingStatus.PENDING)
+      ),
+      checkAvailable$.pipe(
+        map(available => available ? ESavingStatus.FREE : ESavingStatus.NOTFREE)
+      )
+    )
+
+    this.btnHintTxt$ = combineLatest(
+      this.savingStatus$,
+      this.savingProgress$,
+    ).pipe(
+      map(([savingStatus, savingProgress]) => {
+        if (savingProgress === ESavingProgress.DONE) return EBtnTxt.CREATED
+        if (savingProgress === ESavingProgress.INPROGRESS) return EBtnTxt.CREATING
+        if (savingStatus === ESavingStatus.FREE) return EBtnTxt.AVAILABLE
+        if (savingStatus === ESavingStatus.PENDING) return EBtnTxt.VERIFYING
+        return EBtnTxt.DEFAULT
+      })
+    )
+    
+    this.createBtnDisabled$ = this.savingStatus$.pipe(
+      map(val => val !== ESavingStatus.FREE),
+      startWith(true)
+    )
+
+    this.iconClass$ = combineLatest(
+      this.savingStatus$,
+      this.savingProgress$,
+    ).pipe(
+      map(([savingStatus, savingProgress]) => {
+        if (savingProgress === ESavingProgress.DONE) return `fas fa-check`
+        if (savingProgress === ESavingProgress.INPROGRESS) return `fas fa-spinner fa-spin`
+        if (savingStatus === ESavingStatus.FREE) return `fas fa-link`
+        if (savingStatus === ESavingStatus.PENDING) return `fas fa-spinner fa-spin`
+        if (savingStatus === ESavingStatus.NOTFREE) return `fas fa-ban`
+        return EBtnTxt.DEFAULT
+      }),
+      startWith('fas fa-ban'),
+    )
+
+    this.subscriptions.push(
+      checkAvailable$.subscribe(flag => {
+        if (!flag) this.customUrl.setErrors({ message: 'Shortname not available' })
+      })
+    )
+
+    this.saved$ = this.savingProgress$.pipe(
+      map(v => v === ESavingProgress.DONE),
+      startWith(false),
+    )
+  }
+
+  ngOnDestroy(){
+    while(this.subscriptions.length > 0){
+      this.subscriptions.pop().unsubscribe()
+    }
+  }
+
+  saveLink(){
+    this.savingProgress$.next(ESavingProgress.INPROGRESS)
+    this.customUrl.disable()
+    this.http.post(
+      `${this.saneUrlRoot}${this.customUrl.value}`,
+      this.stateTobeSaved
+    ).subscribe(
+      resp => {
+        this.savingProgress$.next(ESavingProgress.DONE)
+      },
+      err => {
+        this.customUrl.enable()
+
+        const { status, error, statusText } = err
+        this.customUrl.setErrors({ message: `${status}: ${error || statusText}` })
+        this.savingProgress$.next(ESavingProgress.INIT)
+      },
+    )
+  }
+
+  copyLinkToClipboard(){
+    const success = this.clipboard.copy(`${this.saneUrlRoot}${this.customUrl.value}`)
+    this.snackbar.open(
+      success ? `Copied URL to clipboard!` : `Failed to copy URL to clipboard!`,
+      null,
+      { duration: 1000 }
+    )
+  }
+
+  public saneUrlRoot = `${BACKENDURL}saneUrl/`
+}
diff --git a/src/share/saneUrl/saneUrl.template.html b/src/share/saneUrl/saneUrl.template.html
new file mode 100644
index 0000000000000000000000000000000000000000..a673dcef78ef91587d47cf9406af51af7de8b151
--- /dev/null
+++ b/src/share/saneUrl/saneUrl.template.html
@@ -0,0 +1,46 @@
+<mat-form-field class="mr-2">
+  <span matPrefix class="text-muted">
+    {{ saneUrlRoot }}
+  </span>
+
+  <input type="text"
+    autocomplete="off"
+    placeholder="my_custom_url"
+    matInput
+    aria-label="Custom link"
+    (keyup.enter)="submitBtn.disabled ? null : saveLink()"
+    [formControl]="customUrl"
+    [errorStateMatcher]="matcher">
+
+  <button mat-icon-button
+    matSuffix
+    aria-label="Copy created custom URL to clipboard"
+    matTooltip="Copy created custom URL to clipboard."
+    (click)="copyLinkToClipboard()"
+    *ngIf="saved$ | async"
+    color="primary">
+    <i class="fas fa-copy"></i>
+  </button>
+
+  <mat-error *ngIf="customUrl.invalid">
+    Error: {{ customUrl.errors.message }}
+  </mat-error>
+
+  <mat-hint>
+    {{ btnHintTxt$ | async }} 
+  </mat-hint>
+
+</mat-form-field>
+
+<button mat-flat-button
+  (click)="saveLink()"
+  color="primary"
+  aria-label="Create custom link"
+  [disabled]="createBtnDisabled$ | async"
+  #submitBtn="matButton">
+
+  <i [class]="iconClass$ | async"></i>
+  <span>
+    {{ (saved$ | async) ? 'Created!' : 'Create' }}
+  </span>
+</button>
diff --git a/src/share/share.module.ts b/src/share/share.module.ts
index 8ef45901e51039c188a604ae49274bb328fb6e67..385e347b9db787e0dafeab49088e9a3d9714796a 100644
--- a/src/share/share.module.ts
+++ b/src/share/share.module.ts
@@ -1,16 +1,26 @@
 import { NgModule } from "@angular/core";
 import { AngularMaterialModule } from "src/ui/sharedModules/angularMaterial.module";
 import { ClipboardCopy } from "./clipboardCopy.directive";
+import { HttpClientModule } from "@angular/common/http";
+import { SaneUrl } from "./saneUrl/saneUrl.component";
+import { CommonModule } from "@angular/common";
+import { ReactiveFormsModule, FormsModule } from "@angular/forms";
 
 @NgModule({
   imports: [
-    AngularMaterialModule
+    AngularMaterialModule,
+    HttpClientModule,
+    CommonModule,
+    FormsModule,
+    ReactiveFormsModule,
   ],
   declarations: [
-    ClipboardCopy
+    ClipboardCopy,
+    SaneUrl,
   ],
   exports: [
-    ClipboardCopy
+    ClipboardCopy,
+    SaneUrl,
   ]
 })
 
diff --git a/src/spotlight/sl-service.service.spec.ts b/src/spotlight/sl-service.service.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f592097debda78c18e4b0a0627b5fd818d2cb2f8
--- /dev/null
+++ b/src/spotlight/sl-service.service.spec.ts
@@ -0,0 +1,9 @@
+import { TestBed } from '@angular/core/testing';
+
+import { SlServiceService } from './sl-service.service';
+import { SpotLightModule } from './spot-light.module';
+
+describe('SlServiceService', () => {
+  // TO BE IMPLEMENTED
+  
+})
diff --git a/src/spotlight/sl-service.service.ts b/src/spotlight/sl-service.service.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c045ebfdbeb4ef5f2e5f1c682bf814cd7718dda1
--- /dev/null
+++ b/src/spotlight/sl-service.service.ts
@@ -0,0 +1,44 @@
+import { Injectable, OnDestroy, ComponentFactoryResolver, Injector, ComponentRef, ApplicationRef, EmbeddedViewRef, TemplateRef, ComponentFactory } from '@angular/core';
+import './sl-style.css'
+import { SpotlightBackdropComponent } from './spotlight-backdrop/spotlight-backdrop.component';
+import { Subject } from 'rxjs';
+
+@Injectable({
+  providedIn: 'root'
+})
+export class SlServiceService implements OnDestroy{
+
+  private backdropRef: ComponentRef<SpotlightBackdropComponent>
+  private dom: HTMLElement
+  private cf: ComponentFactory<SpotlightBackdropComponent>
+  onClick: Subject<MouseEvent> = new Subject()
+  
+  constructor(
+    cfr: ComponentFactoryResolver,
+    private injector: Injector,
+    private appRef: ApplicationRef
+  ) {
+    this.cf = cfr.resolveComponentFactory(SpotlightBackdropComponent)
+  }
+
+  public showBackdrop(tmp?: TemplateRef<any>){
+    this.hideBackdrop()
+
+    this.backdropRef = this.cf.create(this.injector)
+    this.backdropRef.instance.slService = this
+    this.backdropRef.instance.insert = tmp
+
+    this.appRef.attachView(this.backdropRef.hostView)
+    this.dom = (this.backdropRef.hostView as EmbeddedViewRef<any>).rootNodes[0] as HTMLElement
+    document.body.appendChild(this.dom)
+  }
+
+  public hideBackdrop(){
+    this.backdropRef && this.appRef.detachView(this.backdropRef.hostView)
+    this.backdropRef && this.backdropRef.destroy()
+  }
+
+  ngOnDestroy(){
+    this.hideBackdrop()
+  }
+}
diff --git a/src/spotlight/sl-spotlight.directive.spec.ts b/src/spotlight/sl-spotlight.directive.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..b1136f4b95eae2ed872729806e752fdc22ff299f
--- /dev/null
+++ b/src/spotlight/sl-spotlight.directive.spec.ts
@@ -0,0 +1,6 @@
+import { SlSpotlightDirective } from './sl-spotlight.directive';
+
+describe('SlSpotlightDirective', () => {
+  it('should create an instance', () => {
+  });
+});
diff --git a/src/spotlight/sl-spotlight.directive.ts b/src/spotlight/sl-spotlight.directive.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d0d52a596120a131df494ef1b89c8457cc82b1eb
--- /dev/null
+++ b/src/spotlight/sl-spotlight.directive.ts
@@ -0,0 +1,19 @@
+import { Directive, TemplateRef } from '@angular/core';
+import { SlServiceService } from './sl-service.service';
+
+@Directive({
+  selector: '[sl-spotlight]',
+  exportAs: 'sl-spotlight'
+})
+export class SlSpotlightDirective {
+
+  constructor(
+    private slService: SlServiceService
+  ) {
+    
+  }
+
+  showBackdrop(tmpl?: TemplateRef<any>){
+    this.slService.showBackdrop(tmpl)
+  }
+}
diff --git a/src/spotlight/sl-style.css b/src/spotlight/sl-style.css
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/spotlight/spot-light-overlay.directive.spec.ts b/src/spotlight/spot-light-overlay.directive.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..54d258cc55cf301fbf9ae9ced26d2ace346f3ace
--- /dev/null
+++ b/src/spotlight/spot-light-overlay.directive.spec.ts
@@ -0,0 +1,8 @@
+import { SpotLightOverlayDirective } from './spot-light-overlay.directive';
+
+describe('SpotLightOverlayDirective', () => {
+  it('should create an instance', () => {
+    const directive = new SpotLightOverlayDirective();
+    expect(directive).toBeTruthy();
+  });
+});
diff --git a/src/spotlight/spot-light-overlay.directive.ts b/src/spotlight/spot-light-overlay.directive.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e3de43e1441c6f39dc3b234feac6d04f23f4776a
--- /dev/null
+++ b/src/spotlight/spot-light-overlay.directive.ts
@@ -0,0 +1,8 @@
+import { Directive } from '@angular/core';
+
+@Directive({
+  selector: '[sl-spotlight-overlay]'
+})
+export class SpotLightOverlayDirective {
+
+}
diff --git a/src/spotlight/spot-light.module.ts b/src/spotlight/spot-light.module.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6ae55158469a7ac8a575697a4e477d12de6a352e
--- /dev/null
+++ b/src/spotlight/spot-light.module.ts
@@ -0,0 +1,25 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { SlSpotlightDirective } from './sl-spotlight.directive';
+import { SpotlightBackdropComponent } from './spotlight-backdrop/spotlight-backdrop.component';
+import { SpotLightOverlayDirective } from './spot-light-overlay.directive';
+import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
+
+@NgModule({
+  declarations: [
+    SlSpotlightDirective,
+    SpotlightBackdropComponent,
+    SpotLightOverlayDirective
+  ],
+  imports: [
+    BrowserAnimationsModule,
+    CommonModule
+  ],
+  exports:[
+    SlSpotlightDirective
+  ],
+  entryComponents: [
+    SpotlightBackdropComponent
+  ]
+})
+export class SpotLightModule { }
diff --git a/src/spotlight/spotlight-backdrop/spotlight-backdrop.component.css b/src/spotlight/spotlight-backdrop/spotlight-backdrop.component.css
new file mode 100644
index 0000000000000000000000000000000000000000..03e685d3d1605193de0516dfe8540820114e7948
--- /dev/null
+++ b/src/spotlight/spotlight-backdrop/spotlight-backdrop.component.css
@@ -0,0 +1,15 @@
+:host
+{
+  position: absolute;
+  top: 0;
+  left: 0;
+  z-index: 9999;
+  width: 100%;
+  height: 100%;
+  
+  background-color: rgba(128,128,128,0.6);
+  transition: all ease-in-out 200ms;
+
+  pointer-events: all;
+  opacity: 1;
+}
diff --git a/src/spotlight/spotlight-backdrop/spotlight-backdrop.component.html b/src/spotlight/spotlight-backdrop/spotlight-backdrop.component.html
new file mode 100644
index 0000000000000000000000000000000000000000..7a49ecdd0413cfc105885b5f90d11e4f03577869
--- /dev/null
+++ b/src/spotlight/spotlight-backdrop/spotlight-backdrop.component.html
@@ -0,0 +1,3 @@
+<ng-container *ngTemplateOutlet="insert">
+
+</ng-container>
\ No newline at end of file
diff --git a/src/spotlight/spotlight-backdrop/spotlight-backdrop.component.spec.ts b/src/spotlight/spotlight-backdrop/spotlight-backdrop.component.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f18f78f32944c07db9d0e49c82c3774e7ee458fe
--- /dev/null
+++ b/src/spotlight/spotlight-backdrop/spotlight-backdrop.component.spec.ts
@@ -0,0 +1,8 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { SpotlightBackdropComponent } from './spotlight-backdrop.component';
+
+describe('SpotlightBackdropComponent', () => {
+
+  // TO BE IMPLEMENTED
+});
diff --git a/src/spotlight/spotlight-backdrop/spotlight-backdrop.component.ts b/src/spotlight/spotlight-backdrop/spotlight-backdrop.component.ts
new file mode 100644
index 0000000000000000000000000000000000000000..fbf9495a48f4540a456e3b7fb4f9e827f75fae07
--- /dev/null
+++ b/src/spotlight/spotlight-backdrop/spotlight-backdrop.component.ts
@@ -0,0 +1,40 @@
+import { Component, HostListener, TemplateRef, HostBinding } from '@angular/core';
+import { SlServiceService } from '../sl-service.service';
+import { transition, animate, state, style, trigger } from '@angular/animations';
+
+@Component({
+  selector: 'sl-spotlight-backdrop',
+  templateUrl: './spotlight-backdrop.component.html',
+  styleUrls: ['./spotlight-backdrop.component.css'],
+  animations: [
+    trigger('onShownOnDismiss', [
+      state('void', style({
+        opacity: 0.0
+      })),
+      state('*', style({
+        opacity: 1.0
+      })),
+      transition('void => *', [
+        animate('0.5s')
+      ]),
+      transition('* => void', [
+        animate('0.5s')
+      ])
+    ])
+  ]
+})
+export class SpotlightBackdropComponent {
+
+  // TODO use DI for service injection ?
+  public slService: SlServiceService
+
+  @HostBinding('@onShownOnDismiss')
+  animation: string = 'attach'
+
+  @HostListener('click', ['$event'])
+  clickHandler(ev: MouseEvent){
+    this.slService && this.slService.onClick.next(ev)
+  }
+
+  insert: TemplateRef<any>
+}
diff --git a/src/state/index.ts b/src/state/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d5efade12f4641c39c4a808d81c7eb7e531ba31b
--- /dev/null
+++ b/src/state/index.ts
@@ -0,0 +1 @@
+export { StateModule } from './state.module'
diff --git a/src/state/state.module.ts b/src/state/state.module.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2695945ac81aba180b4fc63903a2704640cbf675
--- /dev/null
+++ b/src/state/state.module.ts
@@ -0,0 +1,18 @@
+import { NgModule } from "@angular/core";
+import { StateAggregator } from "./stateAggregator.directive";
+
+// TODO
+// perhaps this should be called StateUtilModule?
+// or alternatively, slowly move all state related components to this module?
+// urlutil should also be at least in this module folder
+
+@NgModule({
+  declarations: [
+    StateAggregator
+  ],
+  exports: [
+    StateAggregator
+  ]
+})
+
+export class StateModule{}
diff --git a/src/state/stateAggregator.directive.ts b/src/state/stateAggregator.directive.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c9fd436c3b8ee3370b4df72acee3174c18769fae
--- /dev/null
+++ b/src/state/stateAggregator.directive.ts
@@ -0,0 +1,38 @@
+import { Directive } from "@angular/core";
+import { Store } from "@ngrx/store";
+import { Observable } from "rxjs";
+import { map, debounceTime, shareReplay } from "rxjs/operators";
+import { IavRootStoreInterface } from "src/services/stateStore.service";
+import { cvtStateToSearchParam } from "src/atlasViewer/atlasViewer.urlUtil";
+
+const jsonVersion = '0.0.1'
+
+interface IJsonifiedState {
+  ver: string
+  queryString: any
+}
+
+@Directive({
+  selector: '[iav-state-aggregator]',
+  exportAs: 'iavStateAggregator'
+})
+
+export class StateAggregator{
+
+  public jsonifiedSstate$: Observable<IJsonifiedState>
+  constructor(
+    private store$: Store<IavRootStoreInterface>
+  ){
+    this.jsonifiedSstate$ = this.store$.pipe(
+      debounceTime(100),
+      map(json => {
+        const queryString = cvtStateToSearchParam(json)
+        return {
+          ver: jsonVersion,
+          queryString: queryString.toString()
+        }
+      }),
+      shareReplay(1)
+    )
+  }
+}
diff --git a/src/theme.scss b/src/theme.scss
index 71c0a7c3daf2b3dcc3be5cc537971efc75e1aecd..abd448e9a7231ea1b22d833665f520a585e9ee54 100644
--- a/src/theme.scss
+++ b/src/theme.scss
@@ -2,6 +2,34 @@
 
 @include  mat-core();
 
+@mixin custom-cmp($theme) {
+  $primary: map-get($theme, primary);
+  $accent: map-get($theme, accent);
+  $warn: map-get($theme, warn);
+
+  [iv-custom-comp],
+  .iv-custom-comp
+  {
+    &[primary],
+    &.primary
+    {
+      color: mat-color($primary);
+    }
+
+    &[accent],
+    &.accent
+    {
+      color: mat-color($accent);
+    }
+
+    &[warn],
+    &.warn
+    {
+      color: mat-color($warn);
+    }
+  }
+}
+
 $iv-theme-primary: mat-palette($mat-indigo);
 $iv-theme-accent: mat-palette($mat-amber);
 $iv-theme-warn: mat-palette($mat-red);
@@ -9,6 +37,7 @@ $iv-theme-warn: mat-palette($mat-red);
 $iv-theme: mat-light-theme($iv-theme-primary, $iv-theme-accent, $iv-theme-warn);
 
 @include angular-material-theme($iv-theme);
+@include custom-cmp($iv-theme);
 
 $iv-dark-theme-primary: mat-palette($mat-blue);
 $iv-dark-theme-accent:  mat-palette($mat-amber, A200, A100, A400);
@@ -18,6 +47,7 @@ $iv-dark-theme:   mat-dark-theme($iv-dark-theme-primary, $iv-dark-theme-accent,
 [darktheme=true]
 {
   @include angular-material-theme($iv-dark-theme);
+  @include custom-cmp($iv-dark-theme);
 }
 
 .iav-dialog-class
diff --git a/src/ui/actionDialog/actionDialog.component.ts b/src/ui/actionDialog/actionDialog.component.ts
new file mode 100644
index 0000000000000000000000000000000000000000..0275f8cf576cf236cfe6878446347144412711c4
--- /dev/null
+++ b/src/ui/actionDialog/actionDialog.component.ts
@@ -0,0 +1,36 @@
+import { Component, Optional, Inject } from "@angular/core";
+import { MAT_DIALOG_DATA } from "@angular/material/dialog";
+
+interface IDialogAction{
+  type: 'mat-button' | 'mat-flat-button' | 'mat-raised-button' | 'mat-stroked-button'
+  color: 'primary' | 'accent' | 'warn' | 'default'
+  dismiss: boolean
+  text: string
+  ariaLabel?: string
+}
+
+@Component({
+  templateUrl: './actionDialog.template.html'
+})
+
+export class ActionDialog{
+
+  public actions: IDialogAction[] = []
+  public content: string
+  public sameLine: boolean = false
+
+  constructor(
+    @Optional() @Inject(MAT_DIALOG_DATA) data: any
+  ){
+    const { config, content, template, actions = [] } = data || {}
+    const { sameLine = false } = config || {}
+
+    this.content = content
+    this.sameLine = sameLine
+    this.actions = actions
+  }
+
+  actionHandler(event: MouseEvent, action: IDialogAction){
+    // TODO fill in the actionHandler
+  }
+}
\ No newline at end of file
diff --git a/src/ui/actionDialog/actionDialog.template.html b/src/ui/actionDialog/actionDialog.template.html
new file mode 100644
index 0000000000000000000000000000000000000000..095b27ee6c147c69f53ac164bb7c3f865fd2a021
--- /dev/null
+++ b/src/ui/actionDialog/actionDialog.template.html
@@ -0,0 +1,63 @@
+<div mat-dialog-content class="d-inline-flex">
+  <div class="flex-grow-1 flex-shrink-1 d-flex align-items-center mr-2">
+    <span>
+      {{ content }}
+    </span>
+  </div>
+
+  <!-- action btn if same line === true -->
+  <div *ngIf="sameLine" class="flex-grow-0 flex-shrink-0">
+    <ng-container *ngTemplateOutlet="actionTemplate">
+    </ng-container>
+  </div>
+</div>
+
+<div *ngIf="!sameLine" mat-dialog-actions>
+
+</div>
+
+<ng-template #actionTemplate>
+  <ng-container *ngFor="let action of actions"
+    [ngSwitch]="action.type">
+
+    <ng-template #textNodeTmpl let-text="text">
+      {{ text }}
+    </ng-template>
+
+    <!-- mat-flat-button -->
+    <button *ngSwitchCase="'mat-flat-button'"
+      mat-flat-button
+      [color]="action.color || 'default'"
+      [mat-dialog-close]="action.dismiss && action"
+      (click)="actionHandler($event, action)">
+      <ng-container *ngTemplateOutlet="textNodeTmpl; context: action"></ng-container>        
+    </button>
+
+    <!-- mat-raised-button -->
+    <button *ngSwitchCase="'mat-raised-button'"
+      mat-raised-button
+      [color]="action.color || 'default'"
+      [mat-dialog-close]="action.dismiss && action"
+      (click)="actionHandler($event, action)">
+      <ng-container *ngTemplateOutlet="textNodeTmpl; context: action"></ng-container>        
+    </button>
+
+    <!-- mat-stroked-button -->
+    <button *ngSwitchCase="'mat-stroked-button'"
+      mat-stroked-button
+      [color]="action.color || 'default'"
+      [mat-dialog-close]="action.dismiss && action"
+      (click)="actionHandler($event, action)">
+      <ng-container *ngTemplateOutlet="textNodeTmpl; context: action"></ng-container>        
+    </button>
+
+    <!-- default / mat-button -->
+    <button *ngSwitchDefault
+      mat-button
+      [color]="action.color || 'default'"
+      [mat-dialog-close]="action.dismiss && action"
+      (click)="actionHandler($event, action)">
+      <ng-container *ngTemplateOutlet="textNodeTmpl; context: action"></ng-container>    
+    </button>
+  </ng-container>
+</ng-template>
diff --git a/src/ui/connectivityBrowser/connectivityBrowser.component.ts b/src/ui/connectivityBrowser/connectivityBrowser.component.ts
index d40fee0933041d63a08b9dad2e5617839721db44..dd6ca5d115b626146e375f10176f82e25a8694aa 100644
--- a/src/ui/connectivityBrowser/connectivityBrowser.component.ts
+++ b/src/ui/connectivityBrowser/connectivityBrowser.component.ts
@@ -23,7 +23,7 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy, A
     public region: string
     public datasetList: any[] = []
     public selectedDataset: any
-    private connectedAreas = []
+    public connectedAreas = []
     public componentHeight: any
 
     private connectivityRegion$: Observable<any>
diff --git a/src/ui/databrowserModule/bulkDownload/bulkDownloadBtn.component.ts b/src/ui/databrowserModule/bulkDownload/bulkDownloadBtn.component.ts
index 28dbf168600ae2902fba295f54b8d0672319237d..0291a5d31e790f0b6aca0303ca144db7817b9994 100644
--- a/src/ui/databrowserModule/bulkDownload/bulkDownloadBtn.component.ts
+++ b/src/ui/databrowserModule/bulkDownload/bulkDownloadBtn.component.ts
@@ -39,11 +39,12 @@ export class BulkDownloadBtn implements OnChanges{
 }
 
 @Pipe({
-  name: 'iavDatamoduleTransformDsToIdPipe'
+  name: 'iavDatamoduleTransformDsToIdPipe',
+  pure: true
 })
 
 export class TransformDatasetToIdPipe implements PipeTransform{
-  public transform(datasets: IDataEntry[]): string[]{
+  public transform(datasets: Partial<IDataEntry>[]): string[]{
     return datasets.map(({ fullId }) => {
       const re = getKgSchemaIdFromFullId(fullId)
       if (re) return re[1]
diff --git a/src/ui/databrowserModule/databrowser.module.ts b/src/ui/databrowserModule/databrowser.module.ts
index c0dd1fd10c3ba6bb94dd8bb61426c9fc09472407..422d9cb01ac65437ccc0fea2d7d730a6153e66b4 100644
--- a/src/ui/databrowserModule/databrowser.module.ts
+++ b/src/ui/databrowserModule/databrowser.module.ts
@@ -1,5 +1,5 @@
 import { CommonModule } from "@angular/common";
-import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
+import { NgModule, CUSTOM_ELEMENTS_SCHEMA, OnDestroy } from "@angular/core";
 import { FormsModule } from "@angular/forms";
 import { ComponentsModule } from "src/components/components.module";
 import { AngularMaterialModule } from 'src/ui/sharedModules/angularMaterial.module'
@@ -28,6 +28,49 @@ import { PreviewFileVisibleInSelectedReferenceTemplatePipe } from "./util/previe
 import { DatasetPreviewList, UnavailableTooltip } from "./singleDataset/datasetPreviews/datasetPreviewsList/datasetPreviewList.component";
 import { PreviewComponentWrapper } from "./preview/previewComponentWrapper/previewCW.component";
 import { BulkDownloadBtn, TransformDatasetToIdPipe } from "./bulkDownload/bulkDownloadBtn.component";
+import { ShowDatasetDialogDirective, IAV_DATASET_SHOW_DATASET_DIALOG_CMP } from "./showDatasetDialog.directive";
+import { PreviewDatasetFile, IAV_DATASET_PREVIEW_DATASET_FN, IAV_DATASET_PREVIEW_ACTIVE } from "./singleDataset/datasetPreviews/previewDatasetFile.directive";
+import { Store, select } from "@ngrx/store";
+import { DATASETS_ACTIONS_TYPES } from "src/services/state/dataStore.store";
+import { startWith, map, take, debounceTime } from "rxjs/operators";
+import { Observable } from "rxjs";
+
+const previewDisplayedFactory = (store: Store<any>) => {
+
+  return (file, dataset) => store.pipe(
+    select('dataStore'),
+    select('datasetPreviews'),
+    startWith([]),
+    map(datasetPreviews => {
+      const { fullId } = dataset || {}
+      const { filename } = file
+      return (datasetPreviews as any[]).findIndex(({ datasetId, filename: fName }) =>
+        datasetId === fullId && fName === filename) >= 0
+    })
+  )
+}
+
+// TODO not too sure if this is the correct place for providing the callback token
+const previewEmitFactory = (store: Store<any>, previewDisplayed: (file,dataset) => Observable<boolean>) => {
+
+  return (file, dataset) => {
+    previewDisplayed(file, dataset).pipe(
+      debounceTime(10),
+      take(1),
+    ).subscribe(flag => 
+      
+      store.dispatch({
+        type: flag
+          ? DATASETS_ACTIONS_TYPES.CLEAR_PREVIEW_DATASET
+          : DATASETS_ACTIONS_TYPES.PREVIEW_DATASET,
+        payload: {
+          file,
+          dataset
+        }
+      })
+    )
+  }
+}
 
 @NgModule({
   imports: [
@@ -47,6 +90,12 @@ import { BulkDownloadBtn, TransformDatasetToIdPipe } from "./bulkDownload/bulkDo
     PreviewComponentWrapper,
     BulkDownloadBtn,
 
+    /**
+     * Directives
+     */
+    ShowDatasetDialogDirective,
+    PreviewDatasetFile,
+
     /**
      * pipes
      */
@@ -76,6 +125,8 @@ import { BulkDownloadBtn, TransformDatasetToIdPipe } from "./bulkDownload/bulkDo
     GetKgSchemaIdFromFullIdPipe,
     BulkDownloadBtn,
     TransformDatasetToIdPipe,
+    ShowDatasetDialogDirective,
+    PreviewDatasetFile,
   ],
   entryComponents: [
     DataBrowser,
@@ -84,6 +135,18 @@ import { BulkDownloadBtn, TransformDatasetToIdPipe } from "./bulkDownload/bulkDo
   ],
   providers: [
     KgSingleDatasetService,
+    {
+      provide: IAV_DATASET_SHOW_DATASET_DIALOG_CMP,
+      useValue: SingleDatasetView
+    },{
+      provide: IAV_DATASET_PREVIEW_DATASET_FN,
+      useFactory: previewEmitFactory,
+      deps: [ Store, IAV_DATASET_PREVIEW_ACTIVE ]
+    },{
+      provide: IAV_DATASET_PREVIEW_ACTIVE,
+      useFactory: previewDisplayedFactory,
+      deps: [ Store ]
+    }
   ],
   schemas: [
     CUSTOM_ELEMENTS_SCHEMA
diff --git a/src/ui/databrowserModule/databrowser.service.ts b/src/ui/databrowserModule/databrowser.service.ts
index 2bb4c828b61241c778a4014834f2390766afc428..b0d6bc256f9f0bd652aa35afca04bdcec4b44c58 100644
--- a/src/ui/databrowserModule/databrowser.service.ts
+++ b/src/ui/databrowserModule/databrowser.service.ts
@@ -47,7 +47,7 @@ function generateToken() {
 export class DatabrowserService implements OnDestroy {
 
   public kgTos$: Observable<any>
-  public favedDataentries$: Observable<IDataEntry[]>
+  public favedDataentries$: Observable<Partial<IDataEntry>[]>
   public darktheme: boolean = false
 
   public instantiatedWidgetUnits: WidgetUnit[] = []
diff --git a/src/ui/databrowserModule/databrowser.useEffect.ts b/src/ui/databrowserModule/databrowser.useEffect.ts
index add27a5bf5e2947a0ebc7bb25764cd7d20bcd6e8..7a55fe649643910505bf5c09e541e1740f6137ab 100644
--- a/src/ui/databrowserModule/databrowser.useEffect.ts
+++ b/src/ui/databrowserModule/databrowser.useEffect.ts
@@ -2,9 +2,9 @@ import { Injectable, OnDestroy } from "@angular/core";
 import { Actions, Effect, ofType } from "@ngrx/effects";
 import { select, Store } from "@ngrx/store";
 import { from, merge, Observable, of, Subscription, forkJoin, combineLatest } from "rxjs";
-import { filter, map, scan, switchMap, withLatestFrom, mapTo, shareReplay, startWith, distinctUntilChanged } from "rxjs/operators";
+import { filter, map, scan, switchMap, withLatestFrom, mapTo, shareReplay, startWith, distinctUntilChanged, concatMap, pairwise } from "rxjs/operators";
 import { LoggingService } from "src/logging";
-import { DATASETS_ACTIONS_TYPES, IDataEntry, ViewerPreviewFile } from "src/services/state/dataStore.store";
+import { DATASETS_ACTIONS_TYPES, IDataEntry, ViewerPreviewFile, DatasetPreview } from "src/services/state/dataStore.store";
 import { IavRootStoreInterface, ADD_NG_LAYER, CHANGE_NAVIGATION } from "src/services/stateStore.service";
 import { LOCAL_STORAGE_CONST, DS_PREVIEW_URL } from "src/util/constants";
 import { KgSingleDatasetService } from "./kgSingleDatasetService.service";
@@ -16,6 +16,9 @@ import { MatDialog } from "@angular/material/dialog";
 import { PreviewComponentWrapper } from "./preview/previewComponentWrapper/previewCW.component";
 import { getKgSchemaIdFromFullId } from "./util/getKgSchemaIdFromFullId.pipe";
 import { HttpClient } from "@angular/common/http";
+import { INgLayerInterface, REMOVE_NG_LAYERS } from "src/services/state/ngViewerState.store";
+
+const DATASET_PREVIEW_ANNOTATION = `DATASET_PREVIEW_ANNOTATION`
 
 @Injectable({
   providedIn: 'root',
@@ -30,6 +33,9 @@ export class DataBrowserUseEffect implements OnDestroy {
   @Effect()
   previewNgLayer$: Observable<any>
 
+  @Effect()
+  removePreviewNgLayers$: Observable<any>
+
   // registerd layers (to be further developed)
   @Effect()
   previewRegisteredVolumes$: Observable<any>
@@ -45,6 +51,8 @@ export class DataBrowserUseEffect implements OnDestroy {
   public previewDatasetFile$: Observable<ViewerPreviewFile>
   private storePreviewDatasetFile$: Observable<{dataset: IDataEntry,file: ViewerPreviewFile}[]>
 
+  private datasetPreviews$: Observable<DatasetPreview[]>
+
   constructor(
     private store$: Store<IavRootStoreInterface>,
     private actions$: Actions<any>,
@@ -55,10 +63,64 @@ export class DataBrowserUseEffect implements OnDestroy {
     private http: HttpClient
   ) {
 
+    const ngViewerStateLayers$ = this.store$.pipe(
+      select('ngViewerState'),
+      select('layers'),
+      startWith([]),
+      shareReplay(1)
+    ) as Observable<INgLayerInterface[]>
+
+    this.datasetPreviews$ = this.store$.pipe(
+      select('dataStore'),
+      select('datasetPreviews'),
+      startWith([]),
+      shareReplay(1),
+    )
+
+    this.removePreviewDataset$ = ngViewerStateLayers$.pipe(
+      distinctUntilChanged(),
+      pairwise(),
+      map(([o, n]: [INgLayerInterface[], INgLayerInterface[]]) => {
+        const nNameSet = new Set(n.map(({ name }) => name))
+        const oNameSet = new Set(o.map(({ name }) => name))
+        return {
+          add: n.filter(({ name: nName }) => !oNameSet.has(nName)),
+          remove: o.filter(({ name: oName }) => !nNameSet.has(oName)),
+        }
+      }),
+      map(({ remove }) => remove),
+      withLatestFrom(
+        this.datasetPreviews$,
+      ),
+      map(([ removedLayers, datasetPreviews ]) => {
+        const removeLayersAnnotation = removedLayers.map(({ annotation }) => annotation)
+        return datasetPreviews.filter(({ filename }) => {
+          return removeLayersAnnotation.findIndex(annnoation => annnoation.indexOf(filename) >= 0) >= 0
+        })
+      }),
+      filter(arr => arr.length > 0),
+      concatMap(arr => from(arr).pipe(
+        map(item => {
+          const { datasetId, filename } = item
+          return {
+            type: DATASETS_ACTIONS_TYPES.CLEAR_PREVIEW_DATASET,
+            payload: {
+              dataset: {
+                fullId: datasetId
+              },
+              file: {
+                filename
+              }
+            }
+          }
+        })
+      ))
+    )
+
+    // TODO this is almost definitely wrong
+    // possibily causing https://github.com/HumanBrainProject/interactive-viewer/issues/502
     this.subscriptions.push(
-      this.store$.pipe(
-        select('dataStore'),
-        select('datasetPreviews'),
+      this.datasetPreviews$.pipe(
         filter(datasetPreviews => datasetPreviews.length > 0),
         map((datasetPreviews) => datasetPreviews[datasetPreviews.length - 1]),
         switchMap(({ datasetId, filename }) =>{
@@ -129,12 +191,24 @@ export class DataBrowserUseEffect implements OnDestroy {
 
     this.previewDatasetFile$ = actions$.pipe(
       ofType(DATASETS_ACTIONS_TYPES.PREVIEW_DATASET),
-      map(actionBody => {
+      concatMap(actionBody => {
+
         const { payload = {} } = actionBody as any
-        const { file = null } = payload as { file: ViewerPreviewFile, dataset: IDataEntry }
-        return file
+        const { file = null, dataset } = payload as { file: ViewerPreviewFile, dataset: IDataEntry }
+        const { fullId } = dataset
+
+        const { filename, ...rest } = file
+        if (Object.keys(rest).length === 0) {
+          const re = /\/([a-f0-9-]+)$/.exec(fullId)
+          if (!re) return of(null)
+          const url = `${DATASET_PREVIEW_URL}/${re[0]}/${encodeURIComponent(filename)}`
+          return this.http.get<ViewerPreviewFile>(url)
+        } else {
+          return of(file)
+        }
       }),
-      shareReplay(1)
+      shareReplay(1),
+      distinctUntilChanged()
     )
 
     this.navigateToPreviewPosition$ = this.previewDatasetFile$.pipe(
@@ -193,16 +267,34 @@ export class DataBrowserUseEffect implements OnDestroy {
       })
     )
 
+    this.removePreviewNgLayers$ = this.datasetPreviews$.pipe(
+      withLatestFrom( ngViewerStateLayers$ ),
+      map(([ datasetPreviews, ngLayers ]) => {
+        const previewingFilesName = datasetPreviews.map(({ filename }) => filename)
+        return ngLayers.filter(({ name, annotation }) =>
+          annotation && annotation.indexOf(DATASET_PREVIEW_ANNOTATION) >= 0
+          && previewingFilesName.indexOf(name) < 0)
+      }),
+      filter(layers => layers.length > 0),
+      map(layers => {
+        return {
+          type: REMOVE_NG_LAYERS,
+          layers
+        }
+      })
+    )
+
     this.previewNgLayer$ = this.previewDatasetFile$.pipe(
       filter(file => 
         determinePreviewFileType(file) === PREVIEW_FILE_TYPES.NIFTI
       ),
-      map(({ url }) => {
+      map(({ url, filename }) => {
         const layer = {
-          name: url,
+          name: filename,
           source : `nifti://${url}`,
           mixability : 'nonmixable',
           shader : GLSL_COLORMAP_JET,
+          annotation: `${DATASET_PREVIEW_ANNOTATION} ${filename}`
         }
         return {
           type: ADD_NG_LAYER,
@@ -333,7 +425,7 @@ export class DataBrowserUseEffect implements OnDestroy {
 
   private savedFav$: Observable<Array<{id: string, name: string}> | null>
 
-  private favDataEntries$: Observable<IDataEntry[]>
+  private favDataEntries$: Observable<Partial<IDataEntry>[]>
 
   @Effect()
   public favDataset$: Observable<any>
@@ -343,4 +435,7 @@ export class DataBrowserUseEffect implements OnDestroy {
 
   @Effect()
   public toggleDataset$: Observable<any>
+
+  @Effect()
+  public removePreviewDataset$: Observable<any>
 }
diff --git a/src/ui/databrowserModule/databrowser/databrowser.component.ts b/src/ui/databrowserModule/databrowser/databrowser.component.ts
index 39cfcff1dcc554485cb3d8ee267af93de7ac69f1..94167944cb254ca6b13435a0b23bcddf2bfcf9af 100644
--- a/src/ui/databrowserModule/databrowser/databrowser.component.ts
+++ b/src/ui/databrowserModule/databrowser/databrowser.component.ts
@@ -43,7 +43,7 @@ export class DataBrowser implements OnChanges, OnDestroy, OnInit {
   @ViewChild(ModalityPicker)
   public modalityPicker: ModalityPicker
 
-  public favDataentries$: Observable<IDataEntry[]>
+  public favDataentries$: Observable<Partial<IDataEntry>[]>
 
   /**
    * TODO
diff --git a/src/ui/databrowserModule/databrowser/databrowser.template.html b/src/ui/databrowserModule/databrowser/databrowser.template.html
index 4f489df1bbf7c701b4e4fa988e345c1a2137eecb..00740907859ab8baf303ce1c34d870c54423e253 100644
--- a/src/ui/databrowserModule/databrowser/databrowser.template.html
+++ b/src/ui/databrowserModule/databrowser/databrowser.template.html
@@ -148,12 +148,3 @@
   </mat-accordion>
 
 </ng-template>
-
-<!-- currently unused -->
-<ng-template #history>
-  <mat-list>
-    <mat-list-item *ngFor="let item of (history$ | async)">
-      Viewed {{ item.file.name }}
-    </mat-list-item>
-  </mat-list>
-</ng-template>
\ No newline at end of file
diff --git a/src/ui/databrowserModule/kgSingleDatasetService.service.ts b/src/ui/databrowserModule/kgSingleDatasetService.service.ts
index 82d26d4089f0cb200e8925243a36d9bd086e13b2..f5abf717d1d08201c99bba3c63fa17c79fe89a28 100644
--- a/src/ui/databrowserModule/kgSingleDatasetService.service.ts
+++ b/src/ui/databrowserModule/kgSingleDatasetService.service.ts
@@ -3,11 +3,10 @@ import { Injectable, OnDestroy, TemplateRef } from "@angular/core";
 import { select, Store } from "@ngrx/store";
 import { Subscription } from "rxjs";
 import { filter } from "rxjs/operators";
-import { AtlasViewerConstantsServices } from "src/atlasViewer/atlasViewer.constantService.service"
 import { IDataEntry, ViewerPreviewFile, DATASETS_ACTIONS_TYPES } from "src/services/state/dataStore.store";
 import { SHOW_BOTTOM_SHEET } from "src/services/state/uiState.store";
 import { IavRootStoreInterface, REMOVE_NG_LAYER } from "src/services/stateStore.service";
-import { GetKgSchemaIdFromFullIdPipe } from "./util/getKgSchemaIdFromFullId.pipe";
+import { BACKENDURL } from "src/util/constants";
 
 @Injectable({ providedIn: 'root' })
 export class KgSingleDatasetService implements OnDestroy {
@@ -16,7 +15,6 @@ export class KgSingleDatasetService implements OnDestroy {
   public ngLayers: Set<string> = new Set()
 
   constructor(
-    private constantService: AtlasViewerConstantsServices,
     private store$: Store<IavRootStoreInterface>,
     private http: HttpClient,
   ) {
@@ -40,14 +38,14 @@ export class KgSingleDatasetService implements OnDestroy {
   // TODO deprecate, in favour of web component
   public datasetHasPreview({ name }: { name: string } = { name: null }) {
     if (!name) { throw new Error('kgSingleDatasetService#datasetHashPreview name must be defined') }
-    const _url = new URL(`datasets/hasPreview`, this.constantService.backendUrl )
+    const _url = new URL(`${BACKENDURL.replace(/\/$/, '')}/datasets/hasPreview`)
     const searchParam = _url.searchParams
     searchParam.set('datasetName', name)
     return this.http.get(_url.toString())
   }
 
   public getInfoFromKg({ kgId, kgSchema = 'minds/core/dataset/v1.0.0' }: Partial<KgQueryInterface>) {
-    const _url = new URL(`datasets/kgInfo`, this.constantService.backendUrl )
+    const _url = new URL(`${BACKENDURL.replace(/\/$/, '')}/datasets/kgInfo`)
     const searchParam = _url.searchParams
     searchParam.set('kgSchema', kgSchema)
     searchParam.set('kgId', kgId)
@@ -59,7 +57,7 @@ export class KgSingleDatasetService implements OnDestroy {
   }
 
   public getDownloadZipFromKgHref({ kgSchema = 'minds/core/dataset/v1.0.0', kgId }) {
-    const _url = new URL(`datasets/downloadKgFiles`, this.constantService.backendUrl)
+    const _url = new URL(`${BACKENDURL.replace(/\/$/, '')}/datasets/downloadKgFiles`)
     const searchParam = _url.searchParams
     searchParam.set('kgSchema', kgSchema)
     searchParam.set('kgId', kgId)
@@ -76,7 +74,7 @@ export class KgSingleDatasetService implements OnDestroy {
     })
   }
 
-  public previewFile(file: ViewerPreviewFile, dataset: IDataEntry) {
+  public previewFile(file: Partial<ViewerPreviewFile>, dataset: Partial<IDataEntry>) {
     this.store$.dispatch({
       type: DATASETS_ACTIONS_TYPES.PREVIEW_DATASET,
       payload: {
diff --git a/src/ui/databrowserModule/showDatasetDialog.directive.spec.ts b/src/ui/databrowserModule/showDatasetDialog.directive.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..18fa8349d210f0f86fdc82ecd8a2af4efaf57db4
--- /dev/null
+++ b/src/ui/databrowserModule/showDatasetDialog.directive.spec.ts
@@ -0,0 +1,162 @@
+import { Component } from "@angular/core";
+import { async, TestBed } from "@angular/core/testing";
+import { AngularMaterialModule } from "../sharedModules/angularMaterial.module";
+import { ShowDatasetDialogDirective, IAV_DATASET_SHOW_DATASET_DIALOG_CMP } from "./showDatasetDialog.directive";
+import { By } from "@angular/platform-browser";
+import { MatDialog } from "@angular/material/dialog";
+import { MatSnackBar } from "@angular/material/snack-bar";
+
+@Component({
+  template: ''
+})
+
+class TestCmp{}
+
+const dummyMatDialog = {
+  open: val => {}
+}
+
+const dummyMatSnackBar = {
+  open: val => {}
+}
+
+class DummyDialogCmp{}
+
+describe('ShowDatasetDialogDirective', () => {
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      imports: [
+        AngularMaterialModule
+      ],
+      declarations: [
+        TestCmp,
+        ShowDatasetDialogDirective,
+      ],
+      providers: [
+        {
+          provide: MatDialog,
+          useValue: dummyMatDialog
+        },
+        {
+          provide: MatSnackBar,
+          useValue: dummyMatSnackBar
+        },
+        {
+          provide: IAV_DATASET_SHOW_DATASET_DIALOG_CMP,
+          useValue: DummyDialogCmp
+        }
+      ]
+    })
+  }))
+
+  it('should be able to test directiv,', () => {
+
+    TestBed.overrideComponent(TestCmp, {
+      set: {
+        template: '<div iav-dataset-show-dataset-dialog></div>'
+      }
+    }).compileComponents()
+
+    const fixutre = TestBed.createComponent(TestCmp)
+    const directive = fixutre.debugElement.query( By.directive( ShowDatasetDialogDirective ) )
+
+    expect(directive).not.toBeNull()
+  })
+
+  it('if neither kgId nor fullId is defined, should not call dialog', () => {
+
+    TestBed.overrideComponent(TestCmp, {
+      set: {
+        template: '<div iav-dataset-show-dataset-dialog></div>'
+      }
+    }).compileComponents()
+
+    const snackbarOpenSpy = spyOn(dummyMatSnackBar, 'open').and.callThrough()
+    const dialogOpenSpy = spyOn(dummyMatDialog, 'open').and.callThrough()
+
+    const fixutre = TestBed.createComponent(TestCmp)
+    fixutre.detectChanges()
+
+    const directive = fixutre.debugElement.query( By.directive( ShowDatasetDialogDirective ) )
+    directive.nativeElement.click()
+
+    expect(snackbarOpenSpy).toHaveBeenCalled()
+    expect(dialogOpenSpy).not.toHaveBeenCalled()
+
+    snackbarOpenSpy.calls.reset()
+    dialogOpenSpy.calls.reset()
+  })
+
+  it('if kgId is defined, should call dialogOpen', () => {
+    
+    TestBed.overrideComponent(TestCmp, {
+      set: {
+        template: `
+        <div iav-dataset-show-dataset-dialog
+          iav-dataset-show-dataset-dialog-kgid="aaa-bbb">
+        </div>
+        `
+      }
+    }).compileComponents()
+
+    const snackbarOpenSpy = spyOn(dummyMatSnackBar, 'open').and.callThrough()
+    const dialogOpenSpy = spyOn(dummyMatDialog, 'open').and.callThrough()
+
+    const fixutre = TestBed.createComponent(TestCmp)
+    fixutre.detectChanges()
+
+    const directive = fixutre.debugElement.query( By.directive( ShowDatasetDialogDirective ) )
+    directive.nativeElement.click()
+
+    expect(snackbarOpenSpy).not.toHaveBeenCalled()
+    const mostRecentCall = dialogOpenSpy.calls.mostRecent()
+    const args = mostRecentCall.args as any[]
+
+    expect(args[0]).toEqual(DummyDialogCmp)
+    expect(args[1]).toEqual({
+      ...ShowDatasetDialogDirective.defaultDialogConfig,
+      data: {
+        fullId: `minds/core/dataset/v1.0.0/aaa-bbb`
+      }
+    })
+
+    snackbarOpenSpy.calls.reset()
+    dialogOpenSpy.calls.reset()
+  })
+
+  it('if fullId is defined, should call dialogOpen', () => {
+
+    TestBed.overrideComponent(TestCmp, {
+      set: {
+        template: `
+        <div iav-dataset-show-dataset-dialog
+          iav-dataset-show-dataset-dialog-fullid="abc/ccc-ddd">
+        </div>
+        `
+      }
+    }).compileComponents()
+
+    const snackbarOpenSpy = spyOn(dummyMatSnackBar, 'open').and.callThrough()
+    const dialogOpenSpy = spyOn(dummyMatDialog, 'open').and.callThrough()
+
+    const fixutre = TestBed.createComponent(TestCmp)
+    fixutre.detectChanges()
+
+    const directive = fixutre.debugElement.query( By.directive( ShowDatasetDialogDirective ) )
+    directive.nativeElement.click()
+
+    expect(snackbarOpenSpy).not.toHaveBeenCalled()
+    const mostRecentCall = dialogOpenSpy.calls.mostRecent()
+    const args = mostRecentCall.args as any[]
+    expect(args[0]).toEqual(DummyDialogCmp)
+    expect(args[1]).toEqual({
+      ...ShowDatasetDialogDirective.defaultDialogConfig,
+      data: {
+        fullId: `abc/ccc-ddd`
+      }
+    })
+
+    snackbarOpenSpy.calls.reset()
+    dialogOpenSpy.calls.reset()
+  })
+})
\ No newline at end of file
diff --git a/src/ui/databrowserModule/showDatasetDialog.directive.ts b/src/ui/databrowserModule/showDatasetDialog.directive.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2d8131e0ab4789738f84c2d1c3c3f8265b86b61d
--- /dev/null
+++ b/src/ui/databrowserModule/showDatasetDialog.directive.ts
@@ -0,0 +1,50 @@
+import { Directive, Input, HostListener, Inject } from "@angular/core";
+import { MatDialog } from "@angular/material/dialog";
+import { MatSnackBar } from "@angular/material/snack-bar";
+
+export const IAV_DATASET_SHOW_DATASET_DIALOG_CMP = 'IAV_DATASET_SHOW_DATASET_DIALOG_CMP'
+export const IAV_DATASET_SHOW_DATASET_DIALOG_CONFIG = `IAV_DATASET_SHOW_DATASET_DIALOG_CONFIG`
+
+@Directive({
+  selector: '[iav-dataset-show-dataset-dialog]',
+  exportAs: 'iavDatasetShowDatasetDialog'
+})
+
+export class ShowDatasetDialogDirective{
+
+  static defaultDialogConfig = {
+    autoFocus: false
+  }
+
+  @Input()
+  kgSchema: string = 'minds/core/dataset/v1.0.0'
+
+  @Input('iav-dataset-show-dataset-dialog-kgid')
+  kgId: string
+
+  @Input('iav-dataset-show-dataset-dialog-fullid')
+  fullId: string
+
+  constructor(
+    private matDialog: MatDialog,
+    private snackbar: MatSnackBar,
+    @Inject(IAV_DATASET_SHOW_DATASET_DIALOG_CMP) private dialogCmp: any
+  ){ }
+
+  @HostListener('click')
+  onClick(){
+
+    if (this.fullId || (this.kgSchema && this.kgId)) {
+
+      this.matDialog.open(this.dialogCmp, {
+        ...ShowDatasetDialogDirective.defaultDialogConfig,
+        data: {
+          fullId: this.fullId || `${this.kgSchema}/${this.kgId}`
+        }
+      })
+
+    } else {
+      this.snackbar.open(`Cannot show dataset. Neither fullId nor kgId provided.`)
+    }
+  }
+}
diff --git a/src/ui/databrowserModule/singleDataset/datasetPreviews/datasetPreviewsList/datasetPreviewList.component.ts b/src/ui/databrowserModule/singleDataset/datasetPreviews/datasetPreviewsList/datasetPreviewList.component.ts
index 7fcdb4ae1b2419b9e664f476654973ee0ffeae9b..fd98090e22bda2d0a23da2a1bb3d66006329d723 100644
--- a/src/ui/databrowserModule/singleDataset/datasetPreviews/datasetPreviewsList/datasetPreviewList.component.ts
+++ b/src/ui/databrowserModule/singleDataset/datasetPreviews/datasetPreviewsList/datasetPreviewList.component.ts
@@ -12,8 +12,6 @@ import { DS_PREVIEW_URL } from 'src/util/constants'
 
 export class DatasetPreviewList{
 
-  @Output() public previewingFile: EventEmitter<ViewerPreviewFile> = new EventEmitter()
-
   public datasetPreviewList: any[] = []
   public loadingDatasetPreviewList: boolean = false
   public selectedTemplateSpace$: Observable<any>
@@ -42,10 +40,6 @@ export class DatasetPreviewList{
 
     this.cdr.markForCheck()
   }
-  public handlePreviewFile(file: ViewerPreviewFile) {
-    
-    this.previewingFile.emit(file)
-  }
 }
 
 @Pipe({
diff --git a/src/ui/databrowserModule/singleDataset/datasetPreviews/datasetPreviewsList/datasetPreviewList.template.html b/src/ui/databrowserModule/singleDataset/datasetPreviews/datasetPreviewsList/datasetPreviewList.template.html
index 25afd1d18921e98c59b6f1c41ecd2449cfeafc6d..3859c93453d7782a3affafbdf80d0cfb872a226e 100644
--- a/src/ui/databrowserModule/singleDataset/datasetPreviews/datasetPreviewsList/datasetPreviewList.template.html
+++ b/src/ui/databrowserModule/singleDataset/datasetPreviews/datasetPreviewsList/datasetPreviewList.template.html
@@ -16,8 +16,12 @@
     <ng-container *ngFor="let file of datasetPreviewList">
 
       <!-- preview available -->
-      <ng-template [ngIf]="(selectedTemplateSpace$ | async | previewFileVisibleInSelectedReferenceTemplatePipe : file)" [ngIfElse]="notAvailalbePreview" >
-        <mat-list-item (click)=" handlePreviewFile(file)">
+      <ng-template [ngIf]="(selectedTemplateSpace$ | async | previewFileVisibleInSelectedReferenceTemplatePipe : file)"
+        [ngIfElse]="notAvailalbePreview" >
+        <mat-list-item
+          [iav-dataset-preview-dataset-file-kgid]="kgId"
+          [iav-dataset-preview-dataset-file]="file">
+          
           <mat-icon
             [fontSet]="(file | previewFileIconPipe).fontSet"
             [fontIcon]="(file | previewFileIconPipe).fontIcon"
diff --git a/src/ui/databrowserModule/singleDataset/datasetPreviews/previewDatasetFile.directive.spec.ts b/src/ui/databrowserModule/singleDataset/datasetPreviews/previewDatasetFile.directive.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..87c32a9fc10be50e370f4b56dfd49f8de30397d7
--- /dev/null
+++ b/src/ui/databrowserModule/singleDataset/datasetPreviews/previewDatasetFile.directive.spec.ts
@@ -0,0 +1,207 @@
+import { Component } from "@angular/core";
+import { async, TestBed } from "@angular/core/testing";
+import { By } from "@angular/platform-browser";
+import { MatSnackBar } from "@angular/material/snack-bar";
+import { AngularMaterialModule } from "src/ui/sharedModules/angularMaterial.module";
+import { PreviewDatasetFile, IAV_DATASET_PREVIEW_DATASET_FN, IAV_DATASET_PREVIEW_ACTIVE } from './previewDatasetFile.directive'
+import { Subject } from "rxjs";
+
+@Component({
+  template: ''
+})
+
+class TestCmp{
+  testmethod(arg) {}
+}
+
+const dummyMatSnackBar = {
+  open: jasmine.createSpy('open')
+}
+
+const previewDatasetFnSpy = jasmine.createSpy('previewDatasetFn')
+const mockDatasetActiveObs = new Subject()
+const getDatasetActiveObs = jasmine.createSpy('getDatasetActive').and.returnValue(mockDatasetActiveObs)
+
+describe('ShowDatasetDialogDirective', () => {
+  let testModule
+  beforeEach(async(() => {
+    testModule = TestBed
+      .configureTestingModule({
+        imports: [
+          AngularMaterialModule
+        ],
+        declarations: [
+          TestCmp,
+          PreviewDatasetFile,
+        ],
+        providers: [
+          {
+            provide: MatSnackBar,
+            useValue: dummyMatSnackBar
+          },
+          {
+            provide: IAV_DATASET_PREVIEW_DATASET_FN,
+            useValue: previewDatasetFnSpy
+          },
+          // {
+          //   provide: IAV_DATASET_PREVIEW_ACTIVE,
+          //   useValue: getDatasetActiveObs
+          // }
+        ]
+      })
+      
+  }))
+
+  afterEach(() => {
+    dummyMatSnackBar.open.calls.reset()
+    previewDatasetFnSpy.calls.reset()
+  })
+
+  it('should be able to test directive', () => {
+
+    TestBed.overrideComponent(TestCmp, {
+      set: {
+        template: '<div iav-dataset-preview-dataset-file></div>',
+      }
+    }).compileComponents()
+
+    const fixutre = TestBed.createComponent(TestCmp)
+    const directive = fixutre.debugElement.query( By.directive( PreviewDatasetFile ) )
+
+    expect(directive).not.toBeNull()
+  })
+
+  describe('> DI', () => {
+    describe(`> ${IAV_DATASET_PREVIEW_ACTIVE}`, () => {
+
+      afterEach(() => {
+        getDatasetActiveObs.calls.reset()
+      })
+
+      describe('> if not provided', () => {
+        beforeEach(() => {
+          TestBed.overrideComponent(TestCmp, {
+            set: {
+              template: `
+              <div iav-dataset-preview-dataset-file
+                (iav-dataset-preview-active-changed)="testmethod($event)"
+                iav-dataset-preview-dataset-file-filename="banana">
+              </div>
+              `,
+            }
+          }).compileComponents()
+        })
+
+
+        it('> should init directive', () => {
+          const fixture = TestBed.createComponent(TestCmp)
+          fixture.detectChanges()
+          const directive = fixture.debugElement.query( By.directive( PreviewDatasetFile ) )
+          expect(directive).toBeTruthy()
+        })
+
+        it('> should not call getDatasetActiveObs', () => {
+
+          const fixture = TestBed.createComponent(TestCmp)
+          fixture.detectChanges()
+          expect(getDatasetActiveObs).not.toHaveBeenCalled()
+        })
+
+        it('> if not provided, on subject next, should not emit active$', () => {
+          
+          const fixture = TestBed.createComponent(TestCmp)
+          const cmp = fixture.debugElement.componentInstance
+
+          const testmethodSpy = spyOn(cmp, 'testmethod')
+
+          fixture.detectChanges()
+          mockDatasetActiveObs.next(true)
+          fixture.detectChanges()
+
+          expect(testmethodSpy).not.toHaveBeenCalled()
+        })
+      })
+
+      describe('> if provided', () => {
+        beforeEach(() => {
+          TestBed.overrideComponent(TestCmp, {
+            set: {
+              template: `
+              <div iav-dataset-preview-dataset-file
+                (iav-dataset-preview-active-changed)="testmethod($event)"
+                iav-dataset-preview-dataset-file-filename="banana">
+              </div>
+              `,
+              providers: [
+                {
+                  provide: IAV_DATASET_PREVIEW_ACTIVE,
+                  useValue: getDatasetActiveObs
+                }
+              ]
+            }
+          }).compileComponents()
+        })
+
+        it('> should call getDatasetObs', () => {
+          const fixture = TestBed.createComponent(TestCmp)
+          fixture.detectChanges()
+          expect(getDatasetActiveObs).toHaveBeenCalled()
+        })
+
+        it('> on obs.next, should emit active$,', () => {
+
+          const fixture = TestBed.createComponent(TestCmp)
+          const cmp = fixture.debugElement.componentInstance
+
+          const testmethodSpy = spyOn(cmp, 'testmethod')
+
+          fixture.detectChanges()
+          mockDatasetActiveObs.next(true)
+          fixture.detectChanges()
+
+          expect(testmethodSpy).toHaveBeenCalledWith(true)
+        })
+      })
+    })
+  })
+
+  it('without providing file or filename, should not call emitFn', () => {
+
+    TestBed.overrideComponent(TestCmp, {
+      set: {
+        template: '<div iav-dataset-preview-dataset-file></div>',
+      }
+    }).compileComponents()
+    
+    const fixutre = TestBed.createComponent(TestCmp)
+    fixutre.detectChanges()
+    const directive = fixutre.debugElement.query( By.directive( PreviewDatasetFile ) )
+    directive.nativeElement.click()
+
+    expect(dummyMatSnackBar.open).toHaveBeenCalled()
+    expect(previewDatasetFnSpy).not.toHaveBeenCalled()
+
+  })
+
+  it('only providing filename, should call emitFn', () => {
+
+    TestBed.overrideComponent(TestCmp, {
+      set: {
+        template: `
+        <div iav-dataset-preview-dataset-file
+          iav-dataset-preview-dataset-file-filename="banana">
+        </div>
+        `,
+      }
+    }).compileComponents()
+    
+    const fixutre = TestBed.createComponent(TestCmp)
+    fixutre.detectChanges()
+    const directive = fixutre.debugElement.query( By.directive( PreviewDatasetFile ) )
+    directive.nativeElement.click()
+
+    expect(dummyMatSnackBar.open).not.toHaveBeenCalled()
+    expect(previewDatasetFnSpy).toHaveBeenCalledWith({ filename: 'banana' }, { fullId: null })
+
+  })
+})
\ No newline at end of file
diff --git a/src/ui/databrowserModule/singleDataset/datasetPreviews/previewDatasetFile.directive.ts b/src/ui/databrowserModule/singleDataset/datasetPreviews/previewDatasetFile.directive.ts
new file mode 100644
index 0000000000000000000000000000000000000000..edc8fae811a1292d1db5c3cedce56a681eb214d4
--- /dev/null
+++ b/src/ui/databrowserModule/singleDataset/datasetPreviews/previewDatasetFile.directive.ts
@@ -0,0 +1,88 @@
+import { Directive, Input, HostListener, Inject, Output, EventEmitter, Optional, OnChanges } from "@angular/core";
+import { MatSnackBar } from "@angular/material/snack-bar";
+import { ViewerPreviewFile, IDataEntry } from 'src/services/state/dataStore.store'
+import { Observable, Subscription } from "rxjs";
+import { distinctUntilChanged } from "rxjs/operators";
+
+export const IAV_DATASET_PREVIEW_DATASET_FN = 'IAV_DATASET_PREVIEW_DATASET_FN'
+export const IAV_DATASET_PREVIEW_ACTIVE = `IAV_DATASET_PREVIEW_ACTIVE`
+
+@Directive({
+  selector: '[iav-dataset-preview-dataset-file]',
+  exportAs: 'iavDatasetPreviewDatasetFile'
+})
+
+export class PreviewDatasetFile implements OnChanges{
+  @Input('iav-dataset-preview-dataset-file')
+  file: ViewerPreviewFile
+
+  @Input('iav-dataset-preview-dataset-file-filename')
+  filename: string
+  
+  @Input('iav-dataset-preview-dataset-file-dataset')
+  dataset: IDataEntry
+
+  @Input('iav-dataset-preview-dataset-file-kgid')
+  kgId: string
+
+  @Input('iav-dataset-preview-dataset-file-kgschema')
+  kgSchema: string = `minds/core/dataset/v1.0.0`
+
+  @Input('iav-dataset-preview-dataset-file-fullid')
+  fullId: string
+
+  @Output('iav-dataset-preview-dataset-file-emit')
+  emitter: EventEmitter<{file: Partial<ViewerPreviewFile>, dataset: Partial<IDataEntry>}> = new EventEmitter()
+
+  @Output('iav-dataset-preview-active-changed')
+  active$: EventEmitter<boolean> = new EventEmitter()
+
+  public active: boolean = false
+
+  private dataActiveObs: Subscription
+  constructor(
+    private snackbar: MatSnackBar,
+    @Optional() @Inject(IAV_DATASET_PREVIEW_DATASET_FN) private emitFn: any,
+    @Optional() @Inject(IAV_DATASET_PREVIEW_ACTIVE) private getDatasetActiveObs: (file, dataset) => Observable<boolean>
+  ){
+    
+  }
+
+  ngOnChanges(){
+    if (this.dataActiveObs) this.dataActiveObs.unsubscribe()
+    
+    if (this.getDatasetActiveObs) this.dataActiveObs = this.getDatasetActiveObs(this.getFile(), this.getDataset()).pipe(
+      distinctUntilChanged()
+    ).subscribe(flag => {
+      this.active = flag
+      this.active$.emit(flag)
+    })
+  }
+
+  private getFile(): Partial<ViewerPreviewFile>{
+    if (!this.file && !this.filename) {
+      return null
+    }
+    return this.file  || {
+      filename: this.filename
+    }
+  }
+
+  private getDataset(): Partial<IDataEntry>{
+    return this.dataset || {
+      fullId: this.fullId || (this.kgSchema && this.kgId && `${this.kgSchema}/${this.kgId}`) || null
+    }
+  }
+
+  @HostListener('click')
+  onClick(){
+    const file = this.getFile()
+    const dataset = this.getDataset()
+    if (!file) {
+      this.snackbar.open(`Cannot preview dataset file. Neither file nor filename are defined.`)
+      return
+    }
+    if (this.emitFn) this.emitFn(file, dataset)
+    this.emitter.emit({ file, dataset })
+  }
+}
diff --git a/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.template.html b/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.template.html
index 993958bec3737b6311782c62075a22da6c962afc..cb0f4bfacec8f35f1a6d42f1eaf6e548a0eb5a03 100644
--- a/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.template.html
+++ b/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.template.html
@@ -26,18 +26,21 @@
   </small>
 
   <!-- publications -->
-  <small class="d-block mb-2"
-    *ngFor="let publication of publications">
-    <a *ngIf="publication.doi; else plainText"
-      iav-stop="click mousedown"
-      [href]="publication.doi | doiParserPipe"
-      target="_blank">
-      {{ publication.cite }}
-    </a>
-    <ng-template #plainText>
-      {{ publication.cite }}
-    </ng-template>
-  </small>
+  <ng-container *ngIf="!strictLocal">
+
+    <small class="d-block mb-2"
+      *ngFor="let publication of publications">
+      <a *ngIf="publication.doi; else plainText"
+        iav-stop="click mousedown"
+        [href]="publication.doi | doiParserPipe"
+        target="_blank">
+        {{ publication.cite }}
+      </a>
+      <ng-template #plainText>
+        {{ publication.cite }}
+      </ng-template>
+    </small>
+  </ng-container>
 </mat-card-content>
 
 
@@ -45,17 +48,20 @@
 <mat-card-actions>
 
   <!-- explore -->
-  <a *ngFor="let kgRef of kgReference"
-    class="m-2"
-    [href]="kgRef | doiParserPipe"
-    target="_blank">
-    <button 
-      mat-raised-button
-      color="primary">
-      Explore
-      <i class="fas fa-external-link-alt"></i>
-    </button>
-  </a>
+  <ng-container *ngIf="!strictLocal">
+
+    <a *ngFor="let kgRef of kgReference"
+      class="m-2"
+      [href]="kgRef | doiParserPipe"
+      target="_blank">
+      <button 
+        mat-raised-button
+        color="primary">
+        Explore
+        <i class="fas fa-external-link-alt"></i>
+      </button>
+    </a>
+  </ng-container>
 
   <!-- pin data -->
   <ng-container *ngIf="downloadEnabled && kgId">
@@ -87,21 +93,24 @@
 
 
   <!-- download -->
-  <a *ngIf="files && files.length > 0"
-    [href]="dlFromKgHref"
-    target="_blank">
-    <button
-      [disabled]="downloadInProgress"
-      [matTooltip]="tooltipText"
-      class="m-2"
-      mat-button
-      color="basic">
-      <span>
-        Download as Zip
-      </span>
-      <i class="ml-1 fas" [ngClass]="!downloadInProgress? 'fa-download' :'fa-spinner fa-pulse'"></i>
-    </button>
-  </a>
+  <ng-container *ngIf="!strictLocal">
+
+    <a *ngIf="files && files.length > 0"
+      [href]="dlFromKgHref"
+      target="_blank">
+      <button
+        [disabled]="downloadInProgress"
+        [matTooltip]="tooltipText"
+        class="m-2"
+        mat-button
+        color="basic">
+        <span>
+          Download as Zip
+        </span>
+        <i class="ml-1 fas" [ngClass]="!downloadInProgress? 'fa-download' :'fa-spinner fa-pulse'"></i>
+      </button>
+    </a>
+  </ng-container>
 
 
   <!-- check if has preview -->
@@ -131,8 +140,7 @@
 
 <ng-template #previewFilesListTemplate>
   <dataset-preview-list
-    [kgId]="kgId"
-    (previewingFile)="handlePreviewFile($event)">
+    [kgId]="kgId">
 
   </dataset-preview-list>
 </ng-template>
diff --git a/src/ui/databrowserModule/singleDataset/listView/singleDatasetListView.component.ts b/src/ui/databrowserModule/singleDataset/listView/singleDatasetListView.component.ts
index be8e778626e3f6d81aaa408e0a6c1c4b0a1e94e8..664c3a1deea97e18e9075fda54f77243bae9fb3d 100644
--- a/src/ui/databrowserModule/singleDataset/listView/singleDatasetListView.component.ts
+++ b/src/ui/databrowserModule/singleDataset/listView/singleDatasetListView.component.ts
@@ -3,8 +3,6 @@ import { Component, ChangeDetectionStrategy, ChangeDetectorRef } from "@angular/
   DatabrowserService,
   KgSingleDatasetService,
 } from "../singleDataset.base";
-import { SingleDatasetView } from "../detailedView/singleDataset.component";
-import {MatDialog} from "@angular/material/dialog";
 import {MatSnackBar} from "@angular/material/snack-bar";
 
 @Component({
@@ -22,18 +20,8 @@ export class SingleDatasetListView extends SingleDatasetBase {
     _dbService: DatabrowserService,
     singleDatasetService: KgSingleDatasetService,
     cdr: ChangeDetectorRef,
-    private dialog: MatDialog,
     snackBar: MatSnackBar,
   ) {
     super(_dbService, singleDatasetService, cdr, snackBar)
   }
-
-  public showDetailInfo() {
-    this.dialog.open(SingleDatasetView, {
-      autoFocus: false,
-      data: {
-        fullId: this.fullId
-      },
-    })
-  }
 }
diff --git a/src/ui/databrowserModule/singleDataset/listView/singleDatasetListView.template.html b/src/ui/databrowserModule/singleDataset/listView/singleDatasetListView.template.html
index b8256849438468a91c3b92ff37ffaca0a81faae0..ea640ed7aa4553d72cfec9128c28fec947af6ab5 100644
--- a/src/ui/databrowserModule/singleDataset/listView/singleDatasetListView.template.html
+++ b/src/ui/databrowserModule/singleDataset/listView/singleDatasetListView.template.html
@@ -1,5 +1,6 @@
 <div mat-ripple
-  (click)="ripple ? showDetailInfo() : null"
+  iav-dataset-show-dataset-dialog
+  [iav-dataset-show-dataset-dialog-fullid]="fullId"
   [iav-stop]="ripple ? 'click' : null"
   [matRippleDisabled]="!ripple"
   class="d-flex flex-row flex-nowrap align-items-center h-100">
@@ -66,21 +67,25 @@
     <button mat-menu-item
       *ngIf="true"
       class="no-focus"
-      (click)="showDetailInfo()">
+      [iav-dataset-show-dataset-dialog-fullid]="fullId"
+      iav-dataset-show-dataset-dialog>
       <mat-icon fontSet="fas" fontIcon="fa-info"></mat-icon>
       Detail
     </button>
   
     <!-- Explore -->
-    <a *ngFor="let kgRef of kgReference"
-      class="no-hover"
-      [href]="kgRef | doiParserPipe"
-      target="_blank"
-      mat-menu-item>
-      <mat-icon fontSet="fas" fontIcon="fa-globe-europe"></mat-icon>
-      Explore
-      <i class="fas fa-external-link-alt"></i>
-    </a>
+    <ng-container *ngIf="!strictLocal">
+
+      <a *ngFor="let kgRef of kgReference"
+        class="no-hover"
+        [href]="kgRef | doiParserPipe"
+        target="_blank"
+        mat-menu-item>
+        <mat-icon fontSet="fas" fontIcon="fa-globe-europe"></mat-icon>
+        Explore
+        <i class="fas fa-external-link-alt"></i>
+      </a>
+    </ng-container>
   
     <!-- preview -->
     <button mat-menu-item
@@ -92,24 +97,26 @@
     </button>
     
     <!-- download -->
-    <a *ngIf="downloadEnabled"
-      [href]="dlFromKgHref"
-      target="_blank"
-      iav-stop="mousedown click">
-      <button mat-menu-item
-        class="no-focus"
-        [disabled]="downloadInProgress">
-        <mat-icon [ngClass]="{'fa-spinner': downloadInProgress}" fontSet="fas" [fontIcon]="!downloadInProgress? 'fa-download' :'fa-pulse'"></mat-icon>
-        Download
-      </button>
-    </a>
+    <ng-container *ngIf="!strictLocal">
+
+      <a *ngIf="downloadEnabled"
+        [href]="dlFromKgHref"
+        target="_blank"
+        iav-stop="mousedown click">
+        <button mat-menu-item
+          class="no-focus"
+          [disabled]="downloadInProgress">
+          <mat-icon [ngClass]="{'fa-spinner': downloadInProgress}" fontSet="fas" [fontIcon]="!downloadInProgress? 'fa-download' :'fa-pulse'"></mat-icon>
+          Download
+        </button>
+      </a>
+    </ng-container>
   </ng-template>
 </mat-menu>
 
 <ng-template #previewFilesListTemplate>
   <dataset-preview-list
-    [kgId]="kgId"
-    (previewingFile)="handlePreviewFile($event)">
+    [kgId]="kgId">
 
   </dataset-preview-list>
 </ng-template>
@@ -117,13 +124,16 @@
 <ng-template #fullIcons>
 
   <!-- references -->
-  <a *ngFor="let kgRef of kgReference"
-    [href]="kgRef | doiParserPipe"
-    target="_blank"
-    iav-stop="click mousedown"
-    mat-icon-button>
-    <mat-icon fontSet="fas" fontIcon="fa-external-link-alt"></mat-icon>
-  </a>
+  <ng-container *ngIf="!strictLocal">
+
+    <a *ngFor="let kgRef of kgReference"
+      [href]="kgRef | doiParserPipe"
+      target="_blank"
+      iav-stop="click mousedown"
+      mat-icon-button>
+      <mat-icon fontSet="fas" fontIcon="fa-external-link-alt"></mat-icon>
+    </a>
+  </ng-container>
 
   <!-- pin dataset -->
   <button mat-icon-button
@@ -136,13 +146,16 @@
   </button>
 
   <!-- download dataset -->
-  <a *ngIf="downloadEnabled"
-    [href]="dlFromKgHref"
-    target="_blank"
-    iav-stop="click mousedown">
-    <button mat-icon-button
-      [disabled]="downloadInProgress">
-      <i class="fas" [ngClass]="!downloadInProgress? 'fa-download' :'fa-spinner fa-pulse'"></i>
-    </button>
-  </a>
+  <ng-container *ngIf="!strictLocal">
+
+    <a *ngIf="downloadEnabled"
+      [href]="dlFromKgHref"
+      target="_blank"
+      iav-stop="click mousedown">
+      <button mat-icon-button
+        [disabled]="downloadInProgress">
+        <i class="fas" [ngClass]="!downloadInProgress? 'fa-download' :'fa-spinner fa-pulse'"></i>
+      </button>
+    </a>
+  </ng-container>
 </ng-template>
\ No newline at end of file
diff --git a/src/ui/databrowserModule/singleDataset/singleDataset.base.ts b/src/ui/databrowserModule/singleDataset/singleDataset.base.ts
index 6d6a530337d3c8caf0c6d77a9eaa554980b349b8..76a9a4f27348aa7817f154663ba6da8c0ff2e0c0 100644
--- a/src/ui/databrowserModule/singleDataset/singleDataset.base.ts
+++ b/src/ui/databrowserModule/singleDataset/singleDataset.base.ts
@@ -50,6 +50,7 @@ export class SingleDatasetBase implements OnInit, OnChanges {
   private humanReadableFileSizePipe: HumanReadableFileSizePipe = new HumanReadableFileSizePipe()
 
   public DS_PREVIEW_URL = DS_PREVIEW_URL
+  public strictLocal: boolean = STRICT_LOCAL
 
   /**
    * sic!
@@ -67,7 +68,7 @@ export class SingleDatasetBase implements OnInit, OnChanges {
 
   public selectedTemplateSpace$: Observable<any>
 
-  public favedDataentries$: Observable<IDataEntry[]>
+  public favedDataentries$: Observable<Partial<IDataEntry>[]>
   constructor(
     private dbService: DatabrowserService,
     private singleDatasetService: KgSingleDatasetService,
@@ -216,10 +217,6 @@ export class SingleDatasetBase implements OnInit, OnChanges {
     this.singleDatasetService.showPreviewList(templateRef)
   }
 
-  public handlePreviewFile(file: ViewerPreviewFile) {
-    this.singleDatasetService.previewFile(file, this.dataset)
-  }
-
   public undoableRemoveFav() {
     this.snackBar.open(`Unpinned dataset: ${this.name}`, 'Undo', {
       duration: 5000,
diff --git a/src/ui/databrowserModule/util/datasetIsFaved.pipe.ts b/src/ui/databrowserModule/util/datasetIsFaved.pipe.ts
index dcb578417f01260b7cd00fbcbd6f6930e6ebc247..2c6c0f8eb0e3a5cbcbaa3d4c65ae83f23cb0df49 100644
--- a/src/ui/databrowserModule/util/datasetIsFaved.pipe.ts
+++ b/src/ui/databrowserModule/util/datasetIsFaved.pipe.ts
@@ -6,7 +6,7 @@ import { getKgSchemaIdFromFullId } from "./getKgSchemaIdFromFullId.pipe";
   name: 'datasetIsFaved',
 })
 export class DatasetIsFavedPipe implements PipeTransform {
-  public transform(favedDataEntry: IDataEntry[], dataentry: IDataEntry): boolean {
+  public transform(favedDataEntry: Partial<IDataEntry>[], dataentry: IDataEntry): boolean {
     if (!dataentry) { return false }
     const re2 = getKgSchemaIdFromFullId(dataentry.fullId)
     if (!re2) return false
diff --git a/src/ui/kgEntryViewer/kgentry.template.html b/src/ui/kgEntryViewer/kgentry.template.html
index 42e95d0156320d1e8e703bcd09364ea95121bc72..cb309ebd9a5bc6fc307968557c3e7357ef8b0faf 100644
--- a/src/ui/kgEntryViewer/kgentry.template.html
+++ b/src/ui/kgEntryViewer/kgentry.template.html
@@ -50,7 +50,7 @@
       License
     </div>
     <div body>
-      <div *ngFor="let l of dataset.licence">
+      <div *ngFor="let l of dataset.license">
         {{ l }}
       </div>
       <div *ngFor="let l of dataset.licenseInfo">
diff --git a/src/ui/layerbrowser/layerbrowser.component.ts b/src/ui/layerbrowser/layerbrowser.component.ts
index cc14ee88c2db83da83bb2e9daa5990a50fd77abc..91121d8f27731c516768eadbc6dc62de728a2c8b 100644
--- a/src/ui/layerbrowser/layerbrowser.component.ts
+++ b/src/ui/layerbrowser/layerbrowser.component.ts
@@ -7,7 +7,7 @@ import { LoggingService } from "src/logging";
 import { NG_VIEWER_ACTION_TYPES } from "src/services/state/ngViewerState.store";
 import { getViewer } from "src/util/fn";
 import { INgLayerInterface } from "../../atlasViewer/atlasViewer.component";
-import { FORCE_SHOW_SEGMENT, getNgIds, isDefined, REMOVE_NG_LAYER, safeFilter, ViewerStateInterface } from "../../services/stateStore.service";
+import { FORCE_SHOW_SEGMENT, getNgIds, isDefined, REMOVE_NG_LAYER, safeFilter, ViewerStateInterface, IavRootStoreInterface } from "../../services/stateStore.service";
 import { MatSliderChange } from "@angular/material/slider";
 
 @Component({
@@ -51,7 +51,7 @@ export class LayerBrowser implements OnInit, OnDestroy {
   private customNgLayers: string[] = ['spatial landmark layer']
 
   constructor(
-    private store: Store<ViewerStateInterface>,
+    private store: Store<IavRootStoreInterface>,
     private constantsService: AtlasViewerConstantsServices,
     private log: LoggingService,
   ) {
@@ -205,10 +205,8 @@ export class LayerBrowser implements OnInit, OnDestroy {
       return
     }
     this.store.dispatch({
-      type : REMOVE_NG_LAYER,
-      layer : {
-        name : layer.name,
-      },
+      type: REMOVE_NG_LAYER,
+      layer
     })
   }
 
diff --git a/src/ui/logoContainer/logoContainer.component.ts b/src/ui/logoContainer/logoContainer.component.ts
index 07d8281943dd0538f709952ca888378c412fdc49..f0b4569eb12a91c6c17f877c021f31bccc80433a 100644
--- a/src/ui/logoContainer/logoContainer.component.ts
+++ b/src/ui/logoContainer/logoContainer.component.ts
@@ -14,7 +14,9 @@ export class LogoContainer {
     ? 'res/image/HBP_Primary_RGB_WhiteText.png'
     : USE_LOGO === 'ebrains'
       ? `res/image/ebrains-logo-light.svg`
-      : null
-
+      : USE_LOGO === 'fzj'
+        ? 'res/image/fzj_black_transparent_svg.svg'
+        : null
+      
   public useLogo = USE_LOGO
 }
diff --git a/src/ui/logoContainer/logoContainer.style.css b/src/ui/logoContainer/logoContainer.style.css
index 91bc7c075edf34d257af94804bfb7b2d33acdb81..5c170a688c2d4e815ffbb5ee4b39564dee9928bc 100644
--- a/src/ui/logoContainer/logoContainer.style.css
+++ b/src/ui/logoContainer/logoContainer.style.css
@@ -18,6 +18,16 @@
   background-image:url('res/image/HBP_Primary_RGB_BlackText.png')
 }
 
+:host-context([darktheme="true"]) [uselogo="fzj"][hbpLogoContainer]
+{
+  background-image:url('res/image/fzj_white_transparent_svg.svg')
+}
+
+:host-context([darktheme="false"]) [uselogo="fzj"][hbpLogoContainer]
+{
+  background-image:url('res/image/fzj_black_transparent_svg.svg')
+}
+
 [hbpLogoContainer]
 {
   display:inline-block;
diff --git a/src/ui/nehubaContainer/mobileOverlay/mobileOverlay.component.ts b/src/ui/nehubaContainer/mobileOverlay/mobileOverlay.component.ts
index df18cdd160fa371af8df8a9d4ac229898b199358..4948b3a38be2f43149491447ec4c79a33237ae36 100644
--- a/src/ui/nehubaContainer/mobileOverlay/mobileOverlay.component.ts
+++ b/src/ui/nehubaContainer/mobileOverlay/mobileOverlay.component.ts
@@ -1,7 +1,20 @@
-import { Component, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output, ViewChild } from "@angular/core";
-import { combineLatest, concat, fromEvent, merge, Observable, of, Subject } from "rxjs";
-import { filter, map, scan, switchMap, takeUntil } from "rxjs/operators";
+import { Component, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output, ViewChild, Inject, TemplateRef, ViewChildren, QueryList } from "@angular/core";
+import { combineLatest, concat, fromEvent, merge, Observable, of, Subject, BehaviorSubject } from "rxjs";
+import { filter, map, scan, switchMap, takeUntil, startWith, pairwise, tap, shareReplay, distinctUntilChanged, switchMapTo, reduce } from "rxjs/operators";
 import { clamp } from "src/util/generator";
+import { DOCUMENT } from "@angular/common";
+
+const TOUCHMOVE_THRESHOLD = 50
+const SUBMENU_IXOBS_CONFIG = {
+
+}
+
+export interface ITunableProp{
+  name: string
+  displayName?: string
+  values: string[]
+  selected?: any
+}
 
 @Component({
   selector : 'mobile-overlay',
@@ -29,15 +42,31 @@ div:not(.active) > span:before
 })
 
 export class MobileOverlay implements OnInit, OnDestroy {
-  @Input() public tunableProperties: string [] = []
-  @Output() public deltaValue: EventEmitter<{delta: number, selectedProp: string}> = new EventEmitter()
+
+  @Input('iav-mobile-overlay-guide-tmpl')
+  public guideTmpl: TemplateRef<any>
+
+  @Input('iav-mobile-overlay-hide-ctrl-btn')
+  public hideCtrlBtn: boolean = false
+
+  @Input('iav-mobile-overlay-ctrl-btn-pos')
+  public ctrlBtnPosition: { left: string, top: string } = { left: '50%', top: '50%' }
+  
+  @Input() public tunableProperties: ITunableProp[] = []
+  
+  @Output() public tunablePropertySelected: EventEmitter<ITunableProp> = new EventEmitter()
+  @Output() public deltaValue: EventEmitter<{delta: number, selectedProp: ITunableProp}> = new EventEmitter()
+  @Output() public valueSelected: EventEmitter<{ value: string, selectedProp: ITunableProp }> = new EventEmitter()
+
   @ViewChild('initiator', {read: ElementRef, static: true}) public initiator: ElementRef
   @ViewChild('mobileMenuContainer', {read: ElementRef, static: true}) public menuContainer: ElementRef
   @ViewChild('intersector', {read: ElementRef, static: true}) public intersector: ElementRef
+  @ViewChild('subMenuObserver', {read: ElementRef, static: false}) public subMenuIx: ElementRef
+  @ViewChild('setValueContainer', { read: ElementRef, static: false }) public setValueContainer?: ElementRef
 
   private _onDestroySubject: Subject<boolean> = new Subject()
 
-  private _focusedProperties: string
+  private _focusedProperties: ITunableProp
   get focusedProperty() {
     return this._focusedProperties
       ? this._focusedProperties
@@ -49,20 +78,37 @@ export class MobileOverlay implements OnInit, OnDestroy {
       : 0
   }
 
+  private initiatorSingleTouchStart$: Observable<any>
+
   public showScreen$: Observable<boolean>
   public showProperties$: Observable<boolean>
   public showDelta$: Observable<boolean>
   public showInitiator$: Observable<boolean>
   private _drag$: Observable<any>
+  private _thresholdDrag$: Observable<any>
   private intersectionObserver: IntersectionObserver
+  private subMenuIxObs: IntersectionObserver
+
+  constructor(
+    @Inject(DOCUMENT) private document: Document
+  ){
+
+  }
 
   public ngOnDestroy() {
     this._onDestroySubject.next(true)
     this._onDestroySubject.complete()
+    this.intersectionObserver && this.intersectionObserver.disconnect()
+    this.subMenuIxObs && this.subMenuIxObs.disconnect()
   }
 
   public ngOnInit() {
 
+    this.initiatorSingleTouchStart$ = fromEvent(this.initiator.nativeElement, 'touchstart').pipe(
+      filter((ev: TouchEvent) => ev.touches.length === 1),
+      shareReplay(1)
+    )
+
     const itemCount = this.tunableProperties.length
 
     const config = {
@@ -79,52 +125,55 @@ export class MobileOverlay implements OnInit, OnDestroy {
 
     this.intersectionObserver.observe(this.menuContainer.nativeElement)
 
-    const scanDragScanAccumulator: (acc: TouchEvent[], item: TouchEvent, idx: number) => TouchEvent[] = (acc, curr) => acc.length < 2
-      ? acc.concat(curr)
-      : acc.slice(1).concat(curr)
-
-    this._drag$ = fromEvent(this.initiator.nativeElement, 'touchmove').pipe(
-      takeUntil(fromEvent(this.initiator.nativeElement, 'touchend').pipe(
+    this._drag$ = fromEvent(this.document, 'touchmove').pipe(
+      filter((ev: TouchEvent) => ev.touches.length === 1),
+      takeUntil(fromEvent(this.document, 'touchend').pipe(
         filter((ev: TouchEvent) => ev.touches.length === 0),
       )),
-      map((ev: TouchEvent) => (ev.preventDefault(), ev.stopPropagation(), ev)),
-      filter((ev: TouchEvent) => ev.touches.length === 1),
-      scan(scanDragScanAccumulator, []),
-      filter(ev => ev.length === 2),
     )
 
-    this.showProperties$ = concat(
-      of(false),
-      fromEvent(this.initiator.nativeElement, 'touchstart').pipe(
-        switchMap(() => concat(
-          this._drag$.pipe(
-            map(double => ({
-              deltaX : double[1].touches[0].screenX - double[0].touches[0].screenX,
-              deltaY : double[1].touches[0].screenY - double[0].touches[0].screenY,
-            })),
-            scan((acc, _curr) => acc),
-            map(v => v.deltaY ** 2 > v.deltaX ** 2),
-          ),
-          of(false),
-        )),
-      ),
+    this._thresholdDrag$ = this._drag$.pipe(
+      distinctUntilChanged((o, n) => {
+        const deltaX = o.touches[0].screenX - n.touches[0].screenX
+        const deltaY = o.touches[0].screenY - n.touches[0].screenY
+        return (deltaX ** 2 + deltaY ** 2) < TOUCHMOVE_THRESHOLD
+      }),
     )
 
-    this.showDelta$ = concat(
-      of(false),
-      fromEvent(this.initiator.nativeElement, 'touchstart').pipe(
-        switchMap(() => concat(
-          this._drag$.pipe(
-            map(double => ({
-              deltaX : double[1].touches[0].screenX - double[0].touches[0].screenX,
-              deltaY : double[1].touches[0].screenY - double[0].touches[0].screenY,
-            })),
-            scan((acc, _curr) => acc),
-            map(v => v.deltaX ** 2 > v.deltaY ** 2),
-          ),
-          of(false),
-        )),
-      ),
+    this.showProperties$ = this.initiatorSingleTouchStart$.pipe(
+      switchMap(() => concat(
+        this._thresholdDrag$.pipe(
+          pairwise(),
+          map(double => ({
+            deltaX : double[1].touches[0].screenX - double[0].touches[0].screenX,
+            deltaY : double[1].touches[0].screenY - double[0].touches[0].screenY,
+          })),
+          map(v => v.deltaY ** 2 > v.deltaX ** 2),
+          scan((acc, _curr) => acc),
+        ),
+        of(false)
+      )),
+      startWith(false),
+      distinctUntilChanged(),
+      shareReplay(1)
+    )
+
+    this.showDelta$ = this.initiatorSingleTouchStart$.pipe(
+      switchMap(() => concat(
+        this._thresholdDrag$.pipe(
+          pairwise(),
+          map(double => ({
+            deltaX : double[1].touches[0].screenX - double[0].touches[0].screenX,
+            deltaY : double[1].touches[0].screenY - double[0].touches[0].screenY,
+          })),
+          scan((acc, _curr) => acc),
+          map(v => v.deltaX ** 2 > v.deltaY ** 2),
+        ),
+        of(false),
+      )),
+      startWith(false),
+      distinctUntilChanged(),
+      shareReplay(1)
     )
 
     this.showInitiator$ = combineLatest(
@@ -144,50 +193,44 @@ export class MobileOverlay implements OnInit, OnDestroy {
       map(([ev, showInitiator]: [TouchEvent, boolean]) => showInitiator && ev.touches.length === 1),
     )
 
-    fromEvent(this.initiator.nativeElement, 'touchstart').pipe(
-      switchMap(() => this._drag$.pipe(
-        map(double => ({
-          deltaX : double[1].touches[0].screenX - double[0].touches[0].screenX,
-          deltaY : double[1].touches[0].screenY - double[0].touches[0].screenY,
-        })),
-        scan((acc, curr: any) => ({
-          pass: acc.pass === null
-            ? curr.deltaX ** 2 > curr.deltaY ** 2
-            : acc.pass,
-          delta: curr.deltaX,
-        }), {
-          pass: null,
-          delta : null,
-        }),
-        filter(ev => ev.pass),
-        map(ev => ev.delta),
+    this.showDelta$.pipe(
+      filter(flag => flag),
+      switchMapTo(this._thresholdDrag$.pipe(
+        pairwise(),
+        map(double => double[1].touches[0].screenX - double[0].touches[0].screenX)
       )),
-      takeUntil(this._onDestroySubject),
-    ).subscribe(ev => this.deltaValue.emit({
-      delta : ev,
-      selectedProp : this.focusedProperty,
-    }))
+      takeUntil(this._onDestroySubject)
+    ).subscribe(ev => {
+      this.deltaValue.emit({
+        delta: ev,
+        selectedProp: this.focusedProperty
+      })
+    })
 
-    const offsetObs$ = fromEvent(this.initiator.nativeElement, 'touchstart').pipe(
-      switchMap(() => concat(
-        this._drag$.pipe(
-          scan((acc, curr) => [acc[0], curr[1]]),
-          map(double => ({
-            deltaX : double[1].touches[0].screenX - double[0].touches[0].screenX,
-            deltaY : double[1].touches[0].screenY - double[0].touches[0].screenY,
-          })),
-        ),
-      )),
+    const offsetObs$ = this.initiatorSingleTouchStart$.pipe(
+      switchMap(() => this._drag$)
     )
+
     combineLatest(
       this.showProperties$,
       offsetObs$,
     ).pipe(
       filter(v => v[0]),
       map(v => v[1]),
+      scan((acc, curr) => {
+        const { startY } = acc
+        const { screenY } = curr.touches[0]
+        return {
+          startY: startY || screenY,
+          totalDeltaY: screenY - (startY || 0)
+        }
+      }, {
+        startY: null,
+        totalDeltaY: 0
+      }),
       takeUntil(this._onDestroySubject),
     ).subscribe(v => {
-      const deltaY = v.deltaY
+      const deltaY = v.totalDeltaY
       const cellHeight = this.menuContainer && this.tunableProperties && this.tunableProperties.length > 0 && this.menuContainer.nativeElement.offsetHeight / this.tunableProperties.length
       const adjHeight = - this.focusedIndex * cellHeight - cellHeight * 0.5
 
@@ -206,8 +249,82 @@ export class MobileOverlay implements OnInit, OnDestroy {
       }
     })
 
+    this.showDelta$.pipe(
+      tap(flag => {
+        this.highlightedSubmenu$.next(this.focusedProperty.values[0])
+        if (!flag && !!this.subMenuIxObs) {
+          this.subMenuIxObs.disconnect()
+          this.subMenuIxObs = null
+        }
+      }),
+      filter(v => !!v),
+      // when options show again, options may have changed, so need to recalculate
+      tap(() => {
+        this.setValueContainerClampStart = null
+        this.setValueContainerWidth = null
+        this.setValueContainerClampEnd = null
+        this.setValueContainerOffset = null
+      }), 
+      switchMapTo(this._drag$.pipe(
+        scan((acc, curr) => {
+          const { startX } = acc
+          const { screenX } = curr.touches[0]
+          return {
+            startX: startX || screenX,
+            totalDeltaX: screenX - (startX  || 0)
+          }
+        }, {
+          startX: null,
+          totalDeltaX: 0
+        })
+      )),
+      takeUntil(this._onDestroySubject)
+    ).subscribe(({ totalDeltaX }) => {
+      if (!this.subMenuIxObs && this.subMenuIx) {
+        this.subMenuIxObs = new IntersectionObserver(ixs => {
+          const ix = ixs.find(({ intersectionRatio }) => intersectionRatio < 0.7)
+          if (!ix) return console.log(ixs)
+          const value = ix.target.getAttribute('data-submenu-value')
+          this.highlightedSubmenu$.next(value)
+        }, {
+          root: this.subMenuIx.nativeElement,
+          threshold: [ 0.1, 0.3, 0.5, 0.7, 0.9 ]
+        })
+
+        for (const btn of this.setValueContainer.nativeElement.children) {
+          this.subMenuIxObs.observe(btn)
+        }
+      }
+      if (!this.setValueContainerWidth) {
+        if (!this.setValueContainer) return
+        if (this.setValueContainer.nativeElement.children.length === 0) return
+        const { children, clientWidth } = this.setValueContainer.nativeElement
+
+        this.setValueContainerWidth = clientWidth
+        const firstChildWidth = children[0].clientWidth
+        const lastChildWidth = children[children.length - 1].clientWidth
+
+        this.setValueContainerOffset = firstChildWidth / -2
+        this.setValueContainerClampStart = firstChildWidth / -2
+        this.setValueContainerClampEnd = lastChildWidth / 2 - clientWidth
+      }
+      const actualDeltaX = clamp(totalDeltaX + this.setValueContainerOffset, this.setValueContainerClampStart, this.setValueContainerClampEnd)
+      this.subMenuTransform = `translate(${actualDeltaX}px , 0px)`
+    })
+
+    this.showDelta$.pipe(
+      takeUntil(this._onDestroySubject),
+      filter(v => !v)
+    ).subscribe(() => this.valueSelected.emit({ selectedProp: this.focusedProperty, value: this.highlightedSubmenu$.value }))
   }
 
+  public highlightedSubmenu$: BehaviorSubject<string> = new BehaviorSubject(null)
+
+  private setValueContainerOffset = null
+  private setValueContainerClampEnd = null
+  private setValueContainerClampStart = null
+  private setValueContainerWidth = null
+  public subMenuTransform = `translate(0px, 0px)`
   public menuTransform = `translate(0px, 0px)`
 
   public focusItemIndex: number = 0
diff --git a/src/ui/nehubaContainer/mobileOverlay/mobileOverlay.style.css b/src/ui/nehubaContainer/mobileOverlay/mobileOverlay.style.css
index a37da10afb7571d0f5a2010aff618cb2b4f223bf..8d548523eaefd725bb5baa490dfc38e3e7abdc2e 100644
--- a/src/ui/nehubaContainer/mobileOverlay/mobileOverlay.style.css
+++ b/src/ui/nehubaContainer/mobileOverlay/mobileOverlay.style.css
@@ -17,11 +17,13 @@
   top: 0;
   left: 0;
   position: absolute;
+  z-index: 99999;
 
   color : black;
   background-color: rgba(255, 255, 255, 0.5);
-}
 
+  transition: all 200ms linear;
+}
 
 :host-context([darktheme="true"]) [screen]
 {
@@ -65,7 +67,44 @@
   background-color: rgba(128, 128, 200, 0.2);
 }
 
-[guide]
+.base-container
+{
+  position: relative;
+  width: 100%;
+  left: 0;
+  top: 50%;
+  height: 0;
+  z-index: 9999;
+}
+
+div[delta]
+{
+  white-space: nowrap
+}
+
+.popup
 {
-  z-index:9999;
+  transition: all 120ms linear;
+  transform-origin: 50% 100%;
 }
+
+.scale-y-0
+{
+  transform: scale(0.5, 0);
+  opacity: 0;
+}
+
+.subMenu
+{
+  bottom: 15px;
+}
+
+.w-50
+{
+  width: 50%;
+}
+
+.sliver
+{
+  width: 1px;
+}
\ No newline at end of file
diff --git a/src/ui/nehubaContainer/mobileOverlay/mobileOverlay.template.html b/src/ui/nehubaContainer/mobileOverlay/mobileOverlay.template.html
index 9770b46d5a6473606f49bd94c70893e50db71c61..791edddf1b9dda7ae39043f7746afa8703f87bef 100644
--- a/src/ui/nehubaContainer/mobileOverlay/mobileOverlay.template.html
+++ b/src/ui/nehubaContainer/mobileOverlay/mobileOverlay.template.html
@@ -7,20 +7,76 @@
         class = "btn btn-default theme-controlled property scrollFocus">
         <!-- scrollFocus class -->
         <span>
-          {{ p }}
+          {{ p.displayName || p.name }}
         </span>
       </div>
     </div>
   </div>
 </div>
 
-<ng-content *ngIf="showDelta$ | async" select="[delta]" guide>
-</ng-content>
+<!-- container class -->
+<div class="d-flex flex-column-reverse flex-nowrap align-items-center base-container position-relative">
 
-<ng-content *ngIf="showScreen$ | async" select="[guide]" guide>
-</ng-content>
+  <!-- ctrl nub -->
+  <div class="h-0 d-inline-flex align-items-center" [hidden]="!(showInitiator$ | async)" #initiator>
+    <div (contextmenu)="$event.stopPropagation(); $event.preventDefault();"
+      [ngStyle]="ctrlBtnPosition"
+      class="pe-all"
+      initiator>
+      <button mat-mini-fab color="primary">
+        <i class="fas fa-globe"></i>
+      </button>
+    </div>
+  </div>
+
+  <!-- guide text -->
+  <mat-card [ngClass]="{ 'scale-y-0': !(showScreen$ | async)  }"
+    class="mb-4 popup muted position-absolute subMenu">
+    <mat-card-content>
+      <ng-container *ngTemplateOutlet="guideTmpl">
+      </ng-container>
+    </mat-card-content>
+  </mat-card>
+
+  <!-- mobile set value -->
+  <div *ngIf="showDelta$ | async" class="position-absolute h-0 w-100 d-flex flex-row justify-content-end align-items-end">
+
+    <!-- intersection observer -->
+    <div class="w-50 d-flex flex-row flex-nowrap" #subMenuObserver>
+    
+      <!-- value selection container -->
+      <div class="position-relative mb-4" [style.transform]="subMenuTransform" #setValueContainer>
+        <!-- value selections -->
+        <ng-container *ngFor="let value of focusedProperty.values">
+          <!-- selected button -->
+          <ng-template
+            [ngIf]="focusedProperty.selected === value"
+            [ngIfElse]="notSelectedTmpl">
+            <button
+              [attr.data-submenu-value]="value"
+              mat-flat-button
+              [ngClass]="{ 'muted': (highlightedSubmenu$ | async) !== value }"
+              color="primary"
+              class="mr-2">
+              {{ value }}
+            </button>
+          </ng-template>
+
+          <!-- not selected button -->
+          <ng-template #notSelectedTmpl>
+            <button
+              [attr.data-submenu-value]="value"
+              mat-flat-button
+              [ngClass]="{ 'muted': (highlightedSubmenu$ | async) !== value }"
+              color="default"
+              class="mr-2">
+              {{ value }}
+            </button>
+          </ng-template>
 
-<div [hidden]="!(showInitiator$ | async)" #initiator>
-  <ng-content select="[initiator]">
-  </ng-content>
-</div>
\ No newline at end of file
+        </ng-container>
+      </div>
+    </div>
+  </div>
+
+</div>
diff --git a/src/ui/nehubaContainer/nehubaContainer.component.ts b/src/ui/nehubaContainer/nehubaContainer.component.ts
index 3122e45d0f3993437ed0346313721b6e6a1938de..1ee340abf89b2ba8295496df670f52e0bb0c9c33 100644
--- a/src/ui/nehubaContainer/nehubaContainer.component.ts
+++ b/src/ui/nehubaContainer/nehubaContainer.component.ts
@@ -16,7 +16,6 @@ import {
   switchMap,
   switchMapTo,
   take,
-  takeUntil,
   tap,
   withLatestFrom,
   delayWhen,
@@ -24,13 +23,14 @@ import {
 import { LoggingService } from "src/logging";
 import { FOUR_PANEL, H_ONE_THREE, NG_VIEWER_ACTION_TYPES, SINGLE_PANEL, V_ONE_THREE } from "src/services/state/ngViewerState.store";
 import { SELECT_REGIONS_WITH_ID, VIEWERSTATE_ACTION_TYPES } from "src/services/state/viewerState.store";
-import { ADD_NG_LAYER, generateLabelIndexId, getMultiNgIdsRegionsLabelIndexMap, getNgIds, ILandmark, IOtherLandmarkGeometry, IPlaneLandmarkGeometry, IPointLandmarkGeometry, isDefined, MOUSE_OVER_LANDMARK, NgViewerStateInterface, REMOVE_NG_LAYER, safeFilter, ViewerStateInterface } from "src/services/stateStore.service";
+import { ADD_NG_LAYER, generateLabelIndexId, getMultiNgIdsRegionsLabelIndexMap, getNgIds, ILandmark, IOtherLandmarkGeometry, IPlaneLandmarkGeometry, IPointLandmarkGeometry, isDefined, MOUSE_OVER_LANDMARK, NgViewerStateInterface, REMOVE_NG_LAYER, safeFilter, ViewerStateInterface, IavRootStoreInterface } from "src/services/stateStore.service";
 import { getExportNehuba, isSame } from "src/util/fn";
-import { AtlasViewerAPIServices, IUserLandmark } from "../../atlasViewer/atlasViewer.apiService.service";
-import { AtlasViewerConstantsServices } from "../../atlasViewer/atlasViewer.constantService.service";
-import { computeDistance, NehubaViewerUnit } from "./nehubaViewer/nehubaViewer.component";
+import { AtlasViewerAPIServices, IUserLandmark } from "src/atlasViewer/atlasViewer.apiService.service";
+import { AtlasViewerConstantsServices } from "src/atlasViewer/atlasViewer.constantService.service";
+import { NehubaViewerUnit } from "./nehubaViewer/nehubaViewer.component";
 import { getFourPanel, getHorizontalOneThree, getSinglePanel, getVerticalOneThree, calculateSliceZoomFactor } from "./util";
 import { NehubaViewerContainerDirective } from "./nehubaViewerInterface/nehubaViewerInterface.directive";
+import { ITunableProp } from "./mobileOverlay/mobileOverlay.component";
 
 const isFirstRow = (cell: HTMLElement) => {
   const { parentElement: row } = cell
@@ -69,6 +69,7 @@ const scanFn: (acc: [boolean, boolean, boolean], curr: CustomEvent) => [boolean,
   styleUrls : [
     `./nehubaContainer.style.css`,
   ],
+  exportAs: 'uiNehubaContainer',
 })
 
 export class NehubaContainer implements OnInit, OnChanges, OnDestroy {
@@ -113,10 +114,7 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy {
 
   public onHoverSegments$: Observable<any[]>
 
-  public spatialResultsVisible$: Observable<boolean>
-  private spatialResultsVisible: boolean = false
-
-  private selectedTemplate: any | null
+  public selectedTemplate: any | null
   private selectedRegionIndexSet: Set<string> = new Set()
   public fetchedSpatialData: ILandmark[] = []
 
@@ -134,7 +132,7 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy {
 
   public nanometersToOffsetPixelsFn: Array<(...arg) => any> = []
 
-  private viewPanels: [HTMLElement, HTMLElement, HTMLElement, HTMLElement] = [null, null, null, null]
+  public viewPanels: [HTMLElement, HTMLElement, HTMLElement, HTMLElement] = [null, null, null, null]
   public panelMode$: Observable<string>
 
   private panelOrder: string
@@ -143,12 +141,10 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy {
 
   public hoveredPanelIndices$: Observable<number>
 
-  private ngPanelTouchMove$: Observable<any>
-
   constructor(
     private constantService: AtlasViewerConstantsServices,
     private apiService: AtlasViewerAPIServices,
-    private store: Store<ViewerStateInterface>,
+    private store: Store<IavRootStoreInterface>,
     private elementRef: ElementRef,
     private log: LoggingService,
     private cdr: ChangeDetectorRef
@@ -223,16 +219,6 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy {
       debounceTime(300),
     )
 
-    this.spatialResultsVisible$ = this.store.pipe(
-      select('spatialSearchState'),
-      map(state => isDefined(state) ?
-        isDefined(state.spatialDataVisible) ?
-          state.spatialDataVisible :
-          true :
-        true),
-      distinctUntilChanged(),
-    )
-
     this.userLandmarks$ = this.store.pipe(
       select('viewerState'),
       select('userLandmarks'),
@@ -292,22 +278,6 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy {
         ? state.layers.findIndex(l => l.mixability === 'nonmixable') >= 0
         : false),
     )
-
-    this.ngPanelTouchMove$ = fromEvent(this.elementRef.nativeElement, 'touchstart').pipe(
-      switchMap((touchStartEv: TouchEvent) => fromEvent(this.elementRef.nativeElement, 'touchmove').pipe(
-        tap((ev: TouchEvent) => ev.preventDefault()),
-        scan((acc, curr: TouchEvent) => [curr, ...acc.slice(0, 1)], []),
-        map((touchMoveEvs: TouchEvent[]) => {
-          return {
-            touchStartEv,
-            touchMoveEvs,
-          }
-        }),
-        takeUntil(fromEvent(this.elementRef.nativeElement, 'touchend').pipe(
-          filter((ev: TouchEvent) => ev.touches.length === 0)),
-        ),
-      )),
-    )
   }
 
   public useMobileUI$: Observable<boolean>
@@ -332,75 +302,6 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy {
 
   public ngOnInit() {
 
-    // translation on mobile
-    this.subscriptions.push(
-      this.ngPanelTouchMove$.pipe(
-        filter(({ touchMoveEvs }) => touchMoveEvs.length > 1 && (touchMoveEvs as TouchEvent[]).every(ev => ev.touches.length === 1)),
-      ).subscribe(({ touchMoveEvs, touchStartEv }) => {
-
-        // get deltaX and deltaY of touchmove
-        const deltaX = touchMoveEvs[1].touches[0].screenX - touchMoveEvs[0].touches[0].screenX
-        const deltaY = touchMoveEvs[1].touches[0].screenY - touchMoveEvs[0].touches[0].screenY
-
-        // figure out the target of touch start
-        const panelIdx = this.findPanelIndex(touchStartEv.target as HTMLElement)
-
-        // translate if panelIdx < 3
-        if (panelIdx >= 0 && panelIdx < 3) {
-          const { position } = this.nehubaViewer.nehubaViewer.ngviewer.navigationState
-          const pos = position.spatialCoordinates
-          this.exportNehuba.vec3.set(pos, deltaX, deltaY, 0)
-          this.exportNehuba.vec3.transformMat4(pos, pos, this.nehubaViewer.viewportToDatas[panelIdx])
-          position.changed.dispatch()
-        } else if (panelIdx === 3) {
-          const {perspectiveNavigationState} = this.nehubaViewer.nehubaViewer.ngviewer
-          const { vec3 } = this.exportNehuba
-          perspectiveNavigationState.pose.rotateRelative(vec3.fromValues(0, 1, 0), -deltaX / 4.0 * Math.PI / 180.0)
-          perspectiveNavigationState.pose.rotateRelative(vec3.fromValues(1, 0, 0), deltaY / 4.0 * Math.PI / 180.0)
-          this.nehubaViewer.nehubaViewer.ngviewer.perspectiveNavigationState.changed.dispatch()
-        } else {
-          this.log.warn(`panelIdx not found`)
-        }
-      }),
-    )
-
-    // perspective reorientation on mobile
-    this.subscriptions.push(
-      this.ngPanelTouchMove$.pipe(
-        filter(({ touchMoveEvs }) => touchMoveEvs.length > 1 && (touchMoveEvs as TouchEvent[]).every(ev => ev.touches.length === 2)),
-      ).subscribe(({ touchMoveEvs, touchStartEv }) => {
-
-        const d1 = computeDistance(
-          [touchMoveEvs[1].touches[0].screenX, touchMoveEvs[1].touches[0].screenY],
-          [touchMoveEvs[1].touches[1].screenX, touchMoveEvs[1].touches[1].screenY],
-        )
-        const d2 = computeDistance(
-          [touchMoveEvs[0].touches[0].screenX, touchMoveEvs[0].touches[0].screenY],
-          [touchMoveEvs[0].touches[1].screenX, touchMoveEvs[0].touches[1].screenY],
-        )
-        const factor = d1 / d2
-
-        // figure out the target of touch start
-        const panelIdx = this.findPanelIndex(touchStartEv.target as HTMLElement)
-
-        // zoom slice view if slice
-        if (panelIdx >= 0 && panelIdx < 3) {
-          this.nehubaViewer.nehubaViewer.ngviewer.navigationState.zoomBy(factor)
-        } else if (panelIdx === 3) {
-          const { minZoom = null, maxZoom = null } = (this.selectedTemplate.nehubaConfig
-            && this.selectedTemplate.nehubaConfig.layout
-            && this.selectedTemplate.nehubaConfig.layout.useNehubaPerspective
-            && this.selectedTemplate.nehubaConfig.layout.useNehubaPerspective.restrictZoomLevel)
-            || {}
-
-          const { zoomFactor } = this.nehubaViewer.nehubaViewer.ngviewer.perspectiveNavigationState
-          if (!!minZoom && zoomFactor.value * factor < minZoom) { return }
-          if (!!maxZoom && zoomFactor.value * factor > maxZoom) { return }
-          zoomFactor.zoomBy(factor)
-        }
-      }),
-    )
-
     this.hoveredPanelIndices$ = fromEvent(this.elementRef.nativeElement, 'mouseover').pipe(
       switchMap((ev: MouseEvent) => merge(
         of(this.findPanelIndex(ev.target as HTMLElement)),
@@ -495,11 +396,10 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy {
     this.subscriptions.push(
       combineLatest(
         this.fetchedSpatialDatasets$,
-        this.spatialResultsVisible$,
-      ).subscribe(([fetchedSpatialData, visible]) => {
+      ).subscribe(([fetchedSpatialData]) => {
         this.fetchedSpatialData = fetchedSpatialData
 
-        if (visible && this.fetchedSpatialData && this.fetchedSpatialData.length > 0) {
+        if (this.fetchedSpatialData && this.fetchedSpatialData.length > 0) {
           this.nehubaViewer.addSpatialSearch3DLandmarks(
             this.fetchedSpatialData
               .map(data => data.geometry.type === 'point'
@@ -532,10 +432,6 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy {
       }),
     )
 
-    this.subscriptions.push(
-      this.spatialResultsVisible$.subscribe(visible => this.spatialResultsVisible = visible),
-    )
-
     this.subscriptions.push(
       this.newViewer$.pipe(
         skip(1),
@@ -613,7 +509,7 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy {
           type : ADD_NG_LAYER,
           layer : dispatchLayers,
         })
-      }),
+      })
     )
 
     this.subscriptions.push(
@@ -823,6 +719,10 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy {
     this.subscriptions.forEach(s => s.unsubscribe())
   }
 
+  public test(){
+    console.log('test')
+  }
+
   public toggleMaximiseMinimise(index: number) {
     this.store.dispatch({
       type: NG_VIEWER_ACTION_TYPES.TOGGLE_MAXIMISE,
@@ -832,26 +732,10 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy {
     })
   }
 
-  public tunableMobileProperties = ['Oblique Rotate X', 'Oblique Rotate Y', 'Oblique Rotate Z', 'Remove extra layers']
-  public selectedProp = null
+  public tunableMobileProperties: ITunableProp[] = []
 
-  public handleMobileOverlayTouchEnd(focusItemIndex) {
-    if (this.tunableMobileProperties[focusItemIndex] === 'Remove extra layers') {
-      this.store.dispatch({
-        type: NG_VIEWER_ACTION_TYPES.REMOVE_ALL_NONBASE_LAYERS,
-      })
-    }
-  }
-
-  public handleMobileOverlayEvent(obj: any) {
-    const {delta, selectedProp} = obj
-    this.selectedProp = selectedProp
-
-    const idx = this.tunableMobileProperties.findIndex(p => p === selectedProp)
-    if (idx === 0) { this.nehubaViewer.obliqueRotateX(delta) }
-    if (idx === 1) { this.nehubaViewer.obliqueRotateY(delta) }
-    if (idx === 2) { this.nehubaViewer.obliqueRotateZ(delta) }
-  }
+  
+  public selectedProp = null
 
   public returnTruePos(quadrant: number, data: any) {
     const pos = quadrant > 2 ?
diff --git a/src/ui/nehubaContainer/nehubaContainer.style.css b/src/ui/nehubaContainer/nehubaContainer.style.css
index 9737b28faebcf1d5c24d7e3ff7be187d708031c5..795c4084b41770f293712671d0709ccb87c23938 100644
--- a/src/ui/nehubaContainer/nehubaContainer.style.css
+++ b/src/ui/nehubaContainer/nehubaContainer.style.css
@@ -101,67 +101,6 @@ div.loadingIndicator div.spinnerAnimationCircle
   color:rgba(255,255,255,0.8);
 }
 
-div[mobileObliqueCtrl]
-{
-  font-size: 200%;
-  position: absolute;
-  top: 50%;
-  left: 50%;
-  width: 0;
-  height: 0;
-
-  display: flex;
-  align-items: center;
-  justify-content: center;
-  pointer-events: all;
-}
-
-div[mobileObliqueScreen]
-{
-  position: absolute;
-  top: 0; 
-  left: 0;
-  width: 100%;
-  height: 100%;
-  background-color:rgba(128,128,128,0.2);
-  transition: all 0.5s linear;
-  pointer-events: all;
-}
-
-div.base
-{
-  position : absolute;
-  top: 50%;
-  left: 50%;
-  width: 0;
-  height: 0;
-  display:flex;
-  flex-direction: column-reverse;
-  align-items: center;
-}
-
-div[delta]
-{
-  white-space: nowrap
-}
-
-div[mobileObliqueGuide]
-{
-  background-color: rgba(250,250,250,0.8);
-}
-
-div[mobileObliqueGuide] > *
-{
-  white-space: nowrap;
-}
-
-:host-context([darktheme="true"]) div[mobileObliqueGuide]
-{
-
-  background-color: rgba(50,50,50,0.8);
-  color: white;
-}
-
 div#scratch-pad
 {
   position: absolute;
diff --git a/src/ui/nehubaContainer/nehubaContainer.template.html b/src/ui/nehubaContainer/nehubaContainer.template.html
index 175c62c6372131e4e3dfe8541e9c1897d1181d2f..b6ecacc3753003334269b2c610ad29a022859704 100644
--- a/src/ui/nehubaContainer/nehubaContainer.template.html
+++ b/src/ui/nehubaContainer/nehubaContainer.template.html
@@ -39,59 +39,52 @@
 <div id="scratch-pad">
 </div>
 
-<!-- mobile nub, allowing for ooblique slicing in mobile -->
+<!-- mobile nub. may be required when more advanced control is required on mobile. for now, disabled -->
 <mobile-overlay
-  *ngIf="(useMobileUI$ | async) && viewerLoaded"
-  (touchend)="handleMobileOverlayTouchEnd(mobileOverlayEl.focusItemIndex)"
+  *ngIf="false && (useMobileUI$ | async) && viewerLoaded"
+  [iav-mobile-overlay-guide-tmpl]="mobileOverlayGuide"
   [tunableProperties]="tunableMobileProperties"
-  (deltaValue)="handleMobileOverlayEvent($event)"
-  #mobileOverlayEl>
-  <div class="base" delta>
-    <div mobileObliqueGuide class="p-2 mb-4 shadow">
-      {{ selectedProp }}
-    </div>
-  </div>
-  <div class="base" guide>
-    <div
-      mobileObliqueGuide
-      class="p-2 mb-4 shadow">
-      <div>
-        <i class="fas fa-arrows-alt-v"></i> oblique mode
-      </div>
-      <div>
-        <i class="fas fa-arrows-alt-h"></i> rotate slice
-      </div>
-    </div>
+  [iav-mobile-overlay-hide-ctrl-btn]="(panelMode$ | async) !== 'SINGLE_PANEL'"
+  [iav-mobile-overlay-ctrl-btn-pos]="panelMode$ | async | mobileControlNubStylePipe">
+
+</mobile-overlay>
+
+<ng-template #mobileOverlayGuide>
+  <div>
+    <i class="fas fa-arrows-alt-v"></i>
+    <span>
+      Select item
+    </span>
   </div>
-  <div
-    (contextmenu)="$event.stopPropagation(); $event.preventDefault();"
-    [ngStyle]="panelMode$ | async | mobileControlNubStylePipe"
-    *ngIf="(panelMode$ | async) !== 'SINGLE_PANEL'"
-    mobileObliqueCtrl
-    initiator>
-    <button mat-mini-fab color="primary">
-      <i class="fas fa-globe"></i>
-    </button>
+  <div>
+    <i class="fas fa-arrows-alt-h"></i>
+    <span>
+      Modify item value
+    </span>
   </div>
-</mobile-overlay>
+</ng-template>
 
 <!-- overlay templates -->
 <!-- inserted using ngTemplateOutlet -->
 <ng-template #overlayi>
   <layout-floating-container pos00 landmarkContainer>
     <nehuba-2dlandmark-unit *ngFor="let spatialData of (selectedPtLandmarks$ | async)"
-      (mouseenter)="handleMouseEnterLandmark(spatialData)" (mouseleave)="handleMouseLeaveLandmark(spatialData)"
+      (mouseenter)="handleMouseEnterLandmark(spatialData)"
+      (mouseleave)="handleMouseLeaveLandmark(spatialData)"
       [highlight]="spatialData.highlight ? spatialData.highlight : false"
       [fasClass]="spatialData.type === 'userLandmark' ? 'fa-chevron-down' : 'fa-map-marker'"
-      [positionX]="getPositionX(0,spatialData)" [positionY]="getPositionY(0,spatialData)"
+      [positionX]="getPositionX(0,spatialData)"
+      [positionY]="getPositionY(0,spatialData)"
       [positionZ]="getPositionZ(0,spatialData)">
     </nehuba-2dlandmark-unit>
 
     <!-- maximise/minimise button -->
     <maximise-panel-button
+      (touchend)="toggleMaximiseMinimise(0)"
       (click)="toggleMaximiseMinimise(0)"
       [ngClass]="{ onHover: (panelOrder$ | async | reorderPanelIndexPipe : ( hoveredPanelIndices$ | async  )) === 0 }"
-      [touch-side-class]="0 " class="pe-all">
+      [touch-side-class]="0"
+      class="pe-all">
     </maximise-panel-button>
     
     <div *ngIf="sliceViewLoading0$ | async" class="loadingIndicator">
@@ -104,44 +97,52 @@
 
 <ng-template #overlayii>
   <layout-floating-container pos01 landmarkContainer>
-      <nehuba-2dlandmark-unit *ngFor="let spatialData of (selectedPtLandmarks$ | async)"
-        (mouseenter)="handleMouseEnterLandmark(spatialData)" (mouseleave)="handleMouseLeaveLandmark(spatialData)"
-        [highlight]="spatialData.highlight ? spatialData.highlight : false"
-        [fasClass]="spatialData.type === 'userLandmark' ? 'fa-chevron-down' : 'fa-map-marker'"
-        [positionX]="getPositionX(1,spatialData)" [positionY]="getPositionY(1,spatialData)"
-        [positionZ]="getPositionZ(1,spatialData)">
-      </nehuba-2dlandmark-unit>
-
-      <!-- maximise/minimise button -->
-      <maximise-panel-button
-        (click)="toggleMaximiseMinimise(1)"
-        [ngClass]="{ onHover: (panelOrder$ | async | reorderPanelIndexPipe : ( hoveredPanelIndices$ | async  )) === 1 }"
-        [touch-side-class]="1 " class="pe-all">
-      </maximise-panel-button>
-
-      <div *ngIf="sliceViewLoading1$ | async" class="loadingIndicator">
-        <div class="spinnerAnimationCircle">
-
-        </div>
+    <nehuba-2dlandmark-unit *ngFor="let spatialData of (selectedPtLandmarks$ | async)"
+      (mouseenter)="handleMouseEnterLandmark(spatialData)"
+      (mouseleave)="handleMouseLeaveLandmark(spatialData)"
+      [highlight]="spatialData.highlight ? spatialData.highlight : false"
+      [fasClass]="spatialData.type === 'userLandmark' ? 'fa-chevron-down' : 'fa-map-marker'"
+      [positionX]="getPositionX(1,spatialData)"
+      [positionY]="getPositionY(1,spatialData)"
+      [positionZ]="getPositionZ(1,spatialData)">
+    </nehuba-2dlandmark-unit>
+
+    <!-- maximise/minimise button -->
+    <maximise-panel-button
+      (touchend)="toggleMaximiseMinimise(1)"
+      (click)="toggleMaximiseMinimise(1)"
+      [ngClass]="{ onHover: (panelOrder$ | async | reorderPanelIndexPipe : ( hoveredPanelIndices$ | async  )) === 1 }"
+      [touch-side-class]="1"
+      class="pe-all">
+    </maximise-panel-button>
+
+    <div *ngIf="sliceViewLoading1$ | async" class="loadingIndicator">
+      <div class="spinnerAnimationCircle">
+
       </div>
-    </layout-floating-container>
+    </div>
+  </layout-floating-container>
 </ng-template>
 
 <ng-template #overlayiii>
   <layout-floating-container pos10 landmarkContainer>
     <nehuba-2dlandmark-unit *ngFor="let spatialData of (selectedPtLandmarks$ | async)"
-      (mouseenter)="handleMouseEnterLandmark(spatialData)" (mouseleave)="handleMouseLeaveLandmark(spatialData)"
+      (mouseenter)="handleMouseEnterLandmark(spatialData)"
+      (mouseleave)="handleMouseLeaveLandmark(spatialData)"
       [highlight]="spatialData.highlight ? spatialData.highlight : false"
       [fasClass]="spatialData.type === 'userLandmark' ? 'fa-chevron-down' : 'fa-map-marker'"
-      [positionX]="getPositionX(2,spatialData)" [positionY]="getPositionY(2,spatialData)"
+      [positionX]="getPositionX(2,spatialData)"
+      [positionY]="getPositionY(2,spatialData)"
       [positionZ]="getPositionZ(2,spatialData)">
     </nehuba-2dlandmark-unit>
 
     <!-- maximise/minimise button -->
     <maximise-panel-button
+      (touchend)="toggleMaximiseMinimise(2)"
       (click)="toggleMaximiseMinimise(2)"
       [ngClass]="{ onHover: (panelOrder$ | async | reorderPanelIndexPipe : ( hoveredPanelIndices$ | async  )) === 2 }"
-      [touch-side-class]="2 " class="pe-all">
+      [touch-side-class]="2"
+      class="pe-all">
     </maximise-panel-button>
 
     <div *ngIf="sliceViewLoading2$ | async" class="loadingIndicator">
@@ -157,9 +158,11 @@
 
     <!-- maximise/minimise button -->
     <maximise-panel-button
+      (touchend)="toggleMaximiseMinimise(3)"
       (click)="toggleMaximiseMinimise(3)"
       [ngClass]="{ onHover: (panelOrder$ | async | reorderPanelIndexPipe : ( hoveredPanelIndices$ | async  )) === 3 }"
-      [touch-side-class]="3 " class="pe-all">
+      [touch-side-class]="3"
+      class="pe-all">
     </maximise-panel-button>
     
     <div *ngIf="perspectiveViewLoading$ | async" class="loadingIndicator">
diff --git a/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.spec.ts b/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..a85e3c733286b7fdbe2c7517fb164a9c1c93bdbc
--- /dev/null
+++ b/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.spec.ts
@@ -0,0 +1,78 @@
+import { TestBed, async } from "@angular/core/testing"
+import { CommonModule, DOCUMENT } from "@angular/common"
+import { NehubaViewerUnit, IMPORT_NEHUBA_INJECT_TOKEN } from "./nehubaViewer.component"
+import { importNehubaFactory } from "../util"
+import { AtlasWorkerService } from "src/atlasViewer/atlasViewer.workerService.service"
+import { LoggingModule } from "src/logging"
+import { APPEND_SCRIPT_TOKEN, appendScriptFactory } from "src/util/constants"
+
+
+describe('nehubaViewer.component,ts', () => {
+  describe('NehubaViewerUnit', () => {
+    beforeEach(async(() => {
+      TestBed.configureTestingModule({
+        imports: [
+          CommonModule,
+          LoggingModule
+        ],
+        declarations: [
+          NehubaViewerUnit
+        ],
+        providers:[
+          {
+            provide: IMPORT_NEHUBA_INJECT_TOKEN,
+            useFactory: importNehubaFactory,
+            deps: [ APPEND_SCRIPT_TOKEN ]
+          },
+          {
+            provide: APPEND_SCRIPT_TOKEN,
+            useFactory: appendScriptFactory,
+            deps: [ DOCUMENT ]
+          },
+          AtlasWorkerService
+        ]
+      }).compileComponents()
+    }))
+
+    it('> creates component', () => {
+      const fixture = TestBed.createComponent(NehubaViewerUnit)
+      expect(fixture.componentInstance).toBeTruthy()
+    })
+
+    describe('> getters', () => {
+      it('> showLayersName is a combination of multiNgIdsLabelIndexMap key values and overrideShowLayers', () => {
+        const fixture = TestBed.createComponent(NehubaViewerUnit)
+        const overrideShowLayers = [
+          `test-1`,
+          `test-2`
+        ]
+        fixture.componentInstance.overrideShowLayers = overrideShowLayers
+        fixture.componentInstance.multiNgIdsLabelIndexMap = new Map([
+          ['test-3', new Map()]
+        ])
+
+        fixture.detectChanges()
+
+        expect(fixture.componentInstance.showLayersName).toEqual([
+          `test-1`,
+          `test-2`,
+          `test-3`
+        ])
+      })
+    })
+
+    describe('> on create', () => {
+      it('> calls onInit lifecycle param properly', () => {
+        const onInitSpy = jasmine.createSpy('onInit')
+        const fixture = TestBed.createComponent(NehubaViewerUnit)
+        fixture.componentInstance.lifecycle = {
+          onInit: onInitSpy
+        }
+
+        fixture.detectChanges()
+
+        expect(onInitSpy).toHaveBeenCalled()
+      })
+    })
+  })
+})
\ No newline at end of file
diff --git a/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts b/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts
index 877f35d636aa30f74da7aa39e04215bec96e06b7..34904988db844bd741a769ce2e185fd109f7c4e8 100644
--- a/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts
+++ b/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts
@@ -1,8 +1,7 @@
-import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, Renderer2 } from "@angular/core";
+import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, Renderer2, Optional, Inject } from "@angular/core";
 import { fromEvent, Subscription, ReplaySubject, Subject, BehaviorSubject } from 'rxjs'
 import { pipeFromArray } from "rxjs/internal/util/pipe";
 import { debounceTime, filter, map, scan } from "rxjs/operators";
-import { AtlasViewerConstantsServices } from "src/atlasViewer/atlasViewer.constantService.service";
 import { AtlasWorkerService } from "src/atlasViewer/atlasViewer.workerService.service";
 import { StateInterface as ViewerConfiguration } from "src/services/state/viewerConfig.store";
 import { getNgIdLabelIndexFromId } from "src/services/stateStore.service";
@@ -10,8 +9,22 @@ import { takeOnePipe } from "../nehubaContainer.component";
 
 import { LoggingService } from "src/logging";
 import { getExportNehuba, getViewer, setNehubaViewer } from "src/util/fn";
-import 'third_party/export_nehuba/chunk_worker.bundle.js'
-import 'third_party/export_nehuba/main.bundle.js'
+
+import '!!file-loader?context=third_party&name=main.bundle.js!export-nehuba/dist/min/main.bundle.js'
+import '!!file-loader?context=third_party&name=chunk_worker.bundle.js!export-nehuba/dist/min/chunk_worker.bundle.js'
+
+const NG_LANDMARK_LAYER_NAME = 'spatial landmark layer'
+const NG_USER_LANDMARK_LAYER_NAME = 'user landmark layer'
+
+/**
+ * optimized for nehubaConfig.layout.useNehubaPerspective.fixedZoomPerspectiveSlices
+ *  sliceZoom
+ *  sliceViewportWidth
+ *  sliceViewportHeight
+ */
+const NG_LANDMARK_CONSTANT = 1e-8
+
+export const IMPORT_NEHUBA_INJECT_TOKEN = `IMPORT_NEHUBA_INJECT_TOKEN`
 
 interface LayerLabelIndex {
   layer: {
@@ -21,6 +34,10 @@ interface LayerLabelIndex {
   labelIndicies: number[]
 }
 
+export interface INehubaLifecycleHook{
+  onInit?: () => void
+}
+
 const scanFn: (acc: LayerLabelIndex[], curr: LayerLabelIndex) => LayerLabelIndex[] = (acc: LayerLabelIndex[], curr: LayerLabelIndex) => {
   const { layer } = curr
   const { name } = layer
@@ -46,6 +63,16 @@ const scanFn: (acc: LayerLabelIndex[], curr: LayerLabelIndex) => LayerLabelIndex
 
 export class NehubaViewerUnit implements OnInit, OnDestroy {
 
+  public overrideShowLayers: string[] = []
+  get showLayersName() {
+    return [
+      ...this.overrideShowLayers,
+      ...Array.from(this.multiNgIdsLabelIndexMap.keys())
+    ]
+  }
+
+  public lifecycle: INehubaLifecycleHook
+
   public viewerPosInVoxel$ = new BehaviorSubject(null)
   public viewerPosInReal$ = new BehaviorSubject(null)
   public mousePosInVoxel$ = new BehaviorSubject(null)
@@ -119,26 +146,18 @@ export class NehubaViewerUnit implements OnInit, OnDestroy {
     this.createNehubaPromiseRs = rs
   })
 
+  public nehubaLoaded: boolean = false
+
   constructor(
-    private rd: Renderer2,
     public elementRef: ElementRef,
     private workerService: AtlasWorkerService,
-    public constantService: AtlasViewerConstantsServices,
     private log: LoggingService,
+    @Inject(IMPORT_NEHUBA_INJECT_TOKEN) getImportNehubaPr: () => Promise<any>
   ) {
 
-    if (!this.constantService.loadExportNehubaPromise) {
-      this.constantService.loadExportNehubaPromise = new Promise((resolve, reject) => {
-        const scriptEl = this.rd.createElement('script')
-        scriptEl.src = 'main.bundle.js'
-        scriptEl.onload = () => resolve(true)
-        scriptEl.onerror = (e) => reject(e)
-        this.rd.appendChild(window.document.head, scriptEl)
-      })
-    }
-
-    this.constantService.loadExportNehubaPromise
+    getImportNehubaPr()
       .then(() => {
+        this.nehubaLoaded = true
         this.exportNehuba = getExportNehuba()
         const fixedZoomPerspectiveSlices = this.config && this.config.layout && this.config.layout.useNehubaPerspective && this.config.layout.useNehubaPerspective.fixedZoomPerspectiveSlices
         if (fixedZoomPerspectiveSlices) {
@@ -186,7 +205,7 @@ export class NehubaViewerUnit implements OnInit, OnDestroy {
       ).subscribe(url => {
         this.removeSpatialSearch3DLandmarks()
         const _ = {}
-        _[this.constantService.ngLandmarkLayerName] = {
+        _[NG_LANDMARK_LAYER_NAME] = {
           type : 'mesh',
           source : `vtk://${url}`,
           shader : FRAGMENT_MAIN_WHITE,
@@ -231,7 +250,7 @@ export class NehubaViewerUnit implements OnInit, OnDestroy {
          */
         if (!url) { return }
         const _ = {}
-        _[this.constantService.ngUserLandmarkLayerName] = {
+        _[NG_USER_LANDMARK_LAYER_NAME] = {
           type : 'mesh',
           source : `vtk://${url}`,
           shader : FRAGMENT_MAIN_WHITE,
@@ -290,7 +309,7 @@ export class NehubaViewerUnit implements OnInit, OnDestroy {
       if (!PRODUCTION) { this.log.warn('setting special landmark selection changed failed ... nehubaViewer is not yet defined') }
       return
     }
-    const landmarkLayer = this.nehubaViewer.ngviewer.layerManager.getLayerByName(this.constantService.ngLandmarkLayerName)
+    const landmarkLayer = this.nehubaViewer.ngviewer.layerManager.getLayerByName(NG_LANDMARK_LAYER_NAME)
     if (!landmarkLayer) {
       if (!PRODUCTION) { this.log.warn('landmark layer could not be found ... will not update colour map') }
       return
@@ -354,10 +373,12 @@ export class NehubaViewerUnit implements OnInit, OnDestroy {
      */
     const managedLayers = this.nehubaViewer.ngviewer.layerManager.managedLayers
     managedLayers.slice(1).forEach(layer => layer.setVisible(false))
-    Array.from(this.multiNgIdsLabelIndexMap.keys()).forEach(ngId => {
-      const layer = this.nehubaViewer.ngviewer.layerManager.getLayerByName(ngId)
-      if (layer) { layer.setVisible(true) } else { this.log.log('layer unavailable', ngId) }
-    })
+
+    for (const layerName of this.showLayersName) {
+      const layer = this.nehubaViewer.ngviewer.layerManager.getLayerByName(layerName)
+      if (layer) { layer.setVisible(true) } else { this.log.log('layer unavailable', layerName) }
+    }
+
     this.redraw()
 
     /* creation of the layout is done on next frame, hence the settimeout */
@@ -407,6 +428,9 @@ export class NehubaViewerUnit implements OnInit, OnDestroy {
         // this.numMeshesToBeLoaded = totalMeshes
       }),
     )
+
+    const { onInit } = this.lifecycle || {}
+    onInit && onInit.call(this)
   }
 
   public ngOnDestroy() {
@@ -421,7 +445,7 @@ export class NehubaViewerUnit implements OnInit, OnDestroy {
     while (this.onDestroyCb.length > 0) {
       this.onDestroyCb.pop()()
     }
-    this.nehubaViewer.dispose()
+    this.nehubaViewer && this.nehubaViewer.dispose()
   }
 
   private onDestroyCb: Array<() => void> = []
@@ -491,20 +515,20 @@ export class NehubaViewerUnit implements OnInit, OnDestroy {
     }
     this.workerService.worker.postMessage({
       type : 'GET_USERLANDMARKS_VTK',
-      scale: Math.min(...this.dim.map(v => v * this.constantService.nehubaLandmarkConstant)),
+      scale: Math.min(...this.dim.map(v => v * NG_LANDMARK_CONSTANT)),
       landmarks : landmarks.map(lm => lm.position.map(coord => coord * 1e6)),
     })
   }
 
   public removeSpatialSearch3DLandmarks() {
     this.removeLayer({
-      name : this.constantService.ngLandmarkLayerName,
+      name : NG_LANDMARK_LAYER_NAME,
     })
   }
 
   public removeuserLandmarks() {
     this.removeLayer({
-      name : this.constantService.ngUserLandmarkLayerName,
+      name : NG_USER_LANDMARK_LAYER_NAME,
     })
   }
 
@@ -513,7 +537,7 @@ export class NehubaViewerUnit implements OnInit, OnDestroy {
     this.workerService.worker.postMessage({
       type : 'GET_LANDMARKS_VTK',
       template : this.templateId,
-      scale: Math.min(...this.dim.map(v => v * this.constantService.nehubaLandmarkConstant)),
+      scale: Math.min(...this.dim.map(v => v * NG_LANDMARK_CONSTANT)),
       landmarks : geometries.map(geometry =>
         geometry === null
           ? null
@@ -786,13 +810,13 @@ export class NehubaViewerUnit implements OnInit, OnDestroy {
     // TODO bug: mouseoverlandmarkemitter does not emit empty for VTK layer when user mouse click
     this.ondestroySubscriptions.push(
       this.nehubaViewer.mouseOver.layer
-        .filter(obj => obj.layer.name === this.constantService.ngLandmarkLayerName)
+        .filter(obj => obj.layer.name === NG_LANDMARK_LAYER_NAME)
         .subscribe(obj => this.mouseoverLandmarkEmitter.emit(obj.value)),
     )
 
     this.ondestroySubscriptions.push(
       this.nehubaViewer.mouseOver.layer
-        .filter(obj => obj.layer.name === this.constantService.ngUserLandmarkLayerName)
+        .filter(obj => obj.layer.name === NG_USER_LANDMARK_LAYER_NAME)
         .subscribe(obj => this.mouseoverUserlandmarkEmitter.emit(obj.value)),
     )
 
diff --git a/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.template.html b/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.template.html
index 4af0dd0b58060aef059d247c7d7c6bac70e30378..3d1b1924fd3e77490b689f373ccd88b92e6b22b8 100644
--- a/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.template.html
+++ b/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.template.html
@@ -1,12 +1,12 @@
-<div id = "neuroglancer-container">
-  <div placeholder *ngIf = "constantService.loadExportNehubaPromise ? !(constantService.loadExportNehubaPromise | async) : true">
-    <h1 tyle = "text-align:center;">
+<div id="neuroglancer-container">
+  <div placeholder *ngIf="nehubaLoaded">
+    <h1 tyle="text-align:center;">
       loading nehuba viewer
     </h1>
     <h1 style = "text-align:center;">
-      <span class = "homeAnimationDots loadingAnimationDots">&bull;</span>
-      <span class = "homeAnimationDots loadingAnimationDots">&bull;</span>
-      <span class = "homeAnimationDots loadingAnimationDots">&bull;</span>
+      <span class="homeAnimationDots loadingAnimationDots">&bull;</span>
+      <span class="homeAnimationDots loadingAnimationDots">&bull;</span>
+      <span class="homeAnimationDots loadingAnimationDots">&bull;</span>
     </h1>
   </div>
 </div>
\ No newline at end of file
diff --git a/src/ui/nehubaContainer/nehubaViewerInterface/nehubaViewerInterface.directive.ts b/src/ui/nehubaContainer/nehubaViewerInterface/nehubaViewerInterface.directive.ts
index 3080792cb1f1d67bef6e3b008c477bdc7917d382..ec990741cab3ab4d6c2e616537ef18597b7f2bf4 100644
--- a/src/ui/nehubaContainer/nehubaViewerInterface/nehubaViewerInterface.directive.ts
+++ b/src/ui/nehubaContainer/nehubaViewerInterface/nehubaViewerInterface.directive.ts
@@ -1,9 +1,9 @@
 import { Directive, ViewContainerRef, ComponentFactoryResolver, ComponentFactory, ComponentRef, OnInit, OnDestroy, Output, EventEmitter } from "@angular/core";
-import { NehubaViewerUnit } from "../nehubaViewer/nehubaViewer.component";
+import { NehubaViewerUnit, INehubaLifecycleHook } from "../nehubaViewer/nehubaViewer.component";
 import { Store, select } from "@ngrx/store";
 import { IavRootStoreInterface } from "src/services/stateStore.service";
 import { Subscription, Observable } from "rxjs";
-import { distinctUntilChanged, filter, switchMap, debounceTime, shareReplay, scan, map, throttleTime } from "rxjs/operators";
+import { distinctUntilChanged, filter, debounceTime, shareReplay, scan, map, throttleTime } from "rxjs/operators";
 import { StateInterface as ViewerConfigStateInterface } from "src/services/state/viewerConfig.store";
 import { getNavigationStateFromConfig } from "../util";
 import { NEHUBA_LAYER_CHANGED, CHANGE_NAVIGATION, VIEWERSTATE_ACTION_TYPES } from "src/services/state/viewerState.store";
@@ -148,10 +148,22 @@ const determineProtocol = (url: string) => {
   return re && re[1]
 }
 
+const getPrecomputedUrl = url => url.replace(/^precomputed:\/\//, '')
+
+const getPrecomputedInfo = async url => {
+  const rootUrl = getPrecomputedUrl(url)
+  return new Promise((rs, rj) => {
+    fetch(`${rootUrl.replace(/\/$/,'')}/info`)
+      .then(res => res.json())
+      .then(rs)
+      .catch(rj)
+  })
+}
+
 interface IProcessedVolume{
   name?: string
   layer: {
-    type: 'image' | 'segmentation'
+    type?: 'image' | 'segmentation'
     source: string
     transform?: any
   }
@@ -163,15 +175,25 @@ const processStandaloneVolume: (url: string) => Promise<IProcessedVolume> = asyn
     return {
       layer: {
         type: 'image',
-        source: url
+        source: url,
+        visible: true
       }
     }
   }
   if (protocol === 'precomputed'){
+    let layerType
+    try {
+      const { type } = await getPrecomputedInfo(url) as any
+      layerType = type
+    } catch (e) {
+      console.warn(`getPrecomputedInfo error:`, e)
+    }
+    
     return {
       layer: {
-        type: 'image', 
-        source: url
+        type: layerType || 'image', 
+        source: url,
+        visible: true
       }
     }
   }
@@ -288,15 +310,21 @@ export class NehubaViewerContainerDirective implements OnInit, OnDestroy{
         distinctUntilChanged()
       ).subscribe(async volumes => {
         const copiedNehubaConfig = JSON.parse(JSON.stringify(defaultNehubaConfig))
+
+        const forceShowLayerNames = []
         for (const idx in volumes){
           try {
             const { name = `layer-${idx}`, layer } = await processStandaloneVolume(volumes[idx])
-            copiedNehubaConfig.dataset.initialNgState.layers[`layer-${idx}`] = layer
+            copiedNehubaConfig.dataset.initialNgState.layers[name] = layer
+            forceShowLayerNames.push(name)
           }catch(e) {
             // TODO catch error
           }
         }
-        this.createNehubaInstance({ nehubaConfig: copiedNehubaConfig })
+        function onInit() {
+          this.overrideShowLayers = forceShowLayerNames
+        }
+        this.createNehubaInstance({ nehubaConfig: copiedNehubaConfig }, { onInit })
       }),
 
       this.viewerPerformanceConfig$.pipe(
@@ -328,13 +356,7 @@ export class NehubaViewerContainerDirective implements OnInit, OnDestroy{
     }
   }
 
-  createNehubaInstance(template: any){
-    
-    this.store$.dispatch({
-      type: NEHUBA_READY,
-      nehubaReady: false,
-    })
-
+  createNehubaInstance(template: any, lifeCycle: INehubaLifecycleHook = {}){
     this.clear()
     this.iavNehubaViewerContainerViewerLoading.emit(true)
     this.cr = this.el.createComponent(this.nehubaViewerFactory)
@@ -352,6 +374,7 @@ export class NehubaViewerContainerDirective implements OnInit, OnDestroy{
     const { gpuLimit = null } = this.viewerConfig
 
     this.nehubaViewerInstance.config = nehubaConfig
+    this.nehubaViewerInstance.lifecycle = lifeCycle
 
     this.oldNavigation = getNavigationStateFromConfig(nehubaConfig)
     this.handleEmittedNavigationChange(this.oldNavigation)
diff --git a/src/ui/nehubaContainer/nehubaViewerInterface/nehubaViewerTouch.directive.ts b/src/ui/nehubaContainer/nehubaViewerInterface/nehubaViewerTouch.directive.ts
new file mode 100644
index 0000000000000000000000000000000000000000..99841bfc0ec082fc6ae98907320141e045b0f2e1
--- /dev/null
+++ b/src/ui/nehubaContainer/nehubaViewerInterface/nehubaViewerTouch.directive.ts
@@ -0,0 +1,257 @@
+import { Directive, ElementRef, Input, HostListener, Output, OnDestroy } from "@angular/core";
+import { Observable, fromEvent, merge, Subscription } from "rxjs";
+import { map, filter, shareReplay, switchMap, pairwise, takeUntil, tap, switchMapTo } from "rxjs/operators";
+import { getExportNehuba } from 'src/util/fn'
+import { computeDistance } from "../nehubaViewer/nehubaViewer.component";
+
+@Directive({
+  selector: '[iav-viewer-touch-interface]',
+  exportAs: 'iavNehubaViewerTouch'
+})
+
+export class NehubaViewerTouchDirective implements OnDestroy{
+
+  @Input('iav-viewer-touch-interface-v-panels')
+  viewerPanels: [HTMLElement, HTMLElement, HTMLElement, HTMLElement]
+
+  @Input('iav-viewer-touch-interface-vp-to-data')
+  viewportToData: [any, any, any, any]
+
+  @Input('iav-viewer-touch-interface-ngviewer')
+  ngViewer: any
+
+  @Input('iav-viewer-touch-interface-nehuba-config')
+  nehubaConfig: any
+
+  private touchMove$: Observable<any>
+  private singleTouchStart$: Observable<TouchEvent>
+  private touchEnd$: Observable<TouchEvent>
+  private multiTouchStart$: Observable<any>
+
+  public translate$: Observable<any>
+
+  private findPanelIndex = (panel: HTMLElement) => this.viewerPanels.indexOf(panel)
+
+  private _exportNehuba: any
+  private get exportNehuba(){
+    if (!this._exportNehuba) {
+      this._exportNehuba = getExportNehuba()
+    }
+    return this._exportNehuba
+  }
+
+  private s: Subscription[] = []
+
+  constructor(
+    private el: ElementRef,
+  ){
+
+    /**
+     * Touchend also needs to be listened to, as user could start
+     * with multitouch, and end up as single touch
+     */
+    const touchStart$ = fromEvent(this.el.nativeElement, 'touchstart').pipe(
+      shareReplay(1),
+    )
+    this.singleTouchStart$ = merge(
+      touchStart$,
+      fromEvent(this.el.nativeElement, 'touchend')
+    ).pipe(
+      filter((ev: TouchEvent) => ev.touches.length === 1),
+      shareReplay(1),
+    )
+
+    this.multiTouchStart$ = touchStart$.pipe(
+      filter((ev: TouchEvent) => ev.touches.length > 1),
+    )
+
+    this.touchEnd$ = fromEvent(this.el.nativeElement, 'touchend').pipe(
+      map(ev => ev as TouchEvent),
+    )
+
+    this.touchMove$ = fromEvent(this.el.nativeElement, 'touchmove')
+
+    const multiTouch$ = this.multiTouchStart$.pipe(
+      // only tracks first 2 touches
+      map((ev: TouchEvent) => [ this.findPanelIndex(ev.touches[0].target as HTMLElement), this.findPanelIndex(ev.touches[0].target as HTMLElement) ]),
+      filter(indicies => indicies[0] >= 0 && indicies[0] === indicies[1]),
+      map(indicies => indicies[0]),
+      switchMap(panelIndex => fromEvent(this.el.nativeElement, 'touchmove').pipe(
+        filter((ev: TouchEvent) => ev.touches.length > 1),
+        pairwise(),
+        map(([ev0, ev1]) => {
+          return {
+            panelIndex,
+            ev0,
+            ev1
+          }
+        }),
+        takeUntil(this.touchEnd$.pipe(
+          filter(ev => ev.touches.length < 2)
+        ))
+      )),
+      shareReplay(1)
+    )
+
+    const multitouchSliceView$ = multiTouch$.pipe(
+      filter(({ panelIndex }) => panelIndex < 3)
+    )
+
+    const multitouchPerspective$ = multiTouch$.pipe(
+      filter(({ panelIndex }) => panelIndex === 3)
+    )
+
+    const rotationByMultiTouch$ = multitouchSliceView$
+
+    const zoomByMultiTouch$ = multitouchSliceView$.pipe(
+      map(({ ev1, ev0 }) => {
+        const d1 = computeDistance(
+          [ev0.touches[0].screenX, ev0.touches[0].screenY],
+          [ev0.touches[1].screenX, ev0.touches[1].screenY],
+        )
+        const d2 = computeDistance(
+          [ev1.touches[0].screenX, ev1.touches[0].screenY],
+          [ev1.touches[1].screenX, ev1.touches[1].screenY],
+        )
+        const factor = d1 / d2
+        return factor
+      })
+    )
+
+    const translateByMultiTouch$ = multitouchSliceView$.pipe(
+      map(({ ev0, ev1, panelIndex }) => {
+
+        const av0X = (ev0.touches[0].screenX + ev0.touches[1].screenX) / 2
+        const av0Y = (ev0.touches[0].screenY + ev0.touches[1].screenY) / 2
+
+        const av1X = (ev1.touches[0].screenX + ev1.touches[1].screenX) / 2
+        const av1Y = (ev1.touches[0].screenY + ev1.touches[1].screenY) / 2
+
+        const deltaX = av0X - av1X
+        const deltaY = av0Y - av1Y
+        return {
+          panelIndex,
+          deltaX,
+          deltaY
+        }
+      }),
+    )
+
+    const translateBySingleTouch$ = this.singleTouchStart$.pipe(
+      map(ev => this.findPanelIndex(ev.target as HTMLElement)),
+      filter(panelIndex => !!this.ngViewer && panelIndex >= 0 && panelIndex < 3),
+      switchMap(panelIndex => this.touchMove$.pipe(
+        pairwise(),
+        map(([ ev0, ev1 ]: [TouchEvent, TouchEvent]) => {
+          const deltaX = ev0.touches[0].screenX - ev1.touches[0].screenX
+          const deltaY = ev0.touches[0].screenY - ev1.touches[0].screenY
+          return {
+            panelIndex,
+            deltaX,
+            deltaY
+          }
+        }),
+        takeUntil(
+          merge(
+            this.touchEnd$,
+            this.multiTouchStart$
+          )
+        )
+      ))
+    )
+
+    const changePerspectiveView$ = this.singleTouchStart$.pipe(
+      map(ev => this.findPanelIndex(ev.target as HTMLElement)),
+      filter(panelIndex => panelIndex === 3 ),
+      switchMapTo(this.touchMove$.pipe(
+        pairwise(),
+        map(([ev0, ev1]) => {
+          return { ev0, ev1 }
+        }),
+        takeUntil(
+          merge(
+            this.touchEnd$,
+            this.multiTouchStart$
+          )
+        ),
+      )),
+    )
+
+    this.s.push(
+      changePerspectiveView$.subscribe(({ ev1, ev0 }) => {
+        const { perspectiveNavigationState } = this.ngViewer
+
+        const { vec3 } = this.exportNehuba
+
+        const deltaX = ev0.touches[0].screenX - ev1.touches[0].screenX
+        const deltaY = ev0.touches[0].screenY - ev1.touches[0].screenY
+        perspectiveNavigationState.pose.rotateRelative(vec3.fromValues(0, 1, 0), -deltaX / 4.0 * Math.PI / 180.0)
+        perspectiveNavigationState.pose.rotateRelative(vec3.fromValues(1, 0, 0), deltaY / 4.0 * Math.PI / 180.0)
+        perspectiveNavigationState.changed.dispatch()
+      }),
+      multitouchPerspective$.subscribe(({ ev1, ev0 }) => {
+        const d1 = computeDistance(
+          [ev0.touches[0].screenX, ev0.touches[0].screenY],
+          [ev0.touches[1].screenX, ev0.touches[1].screenY],
+        )
+        const d2 = computeDistance(
+          [ev1.touches[0].screenX, ev1.touches[0].screenY],
+          [ev1.touches[1].screenX, ev1.touches[1].screenY],
+        )
+        const factor = d1 / d2
+        const { minZoom = null, maxZoom = null } = this.nehubaConfig?.layout?.useNehubaPerspective?.restrictZoomLevel || {}
+        const { zoomFactor } = this.ngViewer.perspectiveNavigationState
+        if (!!minZoom && zoomFactor.value * factor < minZoom) { return }
+        if (!!maxZoom && zoomFactor.value * factor > maxZoom) { return }
+        zoomFactor.zoomBy(factor)
+      }),
+      rotationByMultiTouch$.subscribe(({ panelIndex, ev0, ev1 }) => {
+        
+        const dY0 = ev0.touches[1].screenY - ev0.touches[0].screenY
+        const dX0 = ev0.touches[1].screenX - ev0.touches[0].screenX
+        const m0 = dY0 / dX0
+
+        const dY1 = ev1.touches[1].screenY - ev1.touches[0].screenY
+        const dX1 = ev1.touches[1].screenX - ev1.touches[0].screenX
+        const m1 = dY1 / dX1
+
+        const theta = Math.atan( (m1 - m0) / ( 1 + m1 * m0 ) )
+        if (isNaN(theta)) return
+        
+        const { vec3 } = this.exportNehuba
+
+        const axis = vec3.fromValues(
+          ...[
+            [0, -1, 0],
+            [1, 0, 0],
+            [0, 0, 1]
+          ][panelIndex]
+        )
+
+        this.ngViewer.navigationState.pose.rotateRelative(axis, theta)
+      }),
+      zoomByMultiTouch$.subscribe(factor => {
+        if (isNaN(factor)) return
+        this.ngViewer.navigationState.zoomBy(factor)
+      }),
+      merge(
+        translateBySingleTouch$,
+        translateByMultiTouch$,
+      ).subscribe(({ panelIndex, deltaX, deltaY }) => {
+        if (isNaN(deltaX) || isNaN(deltaX)) return
+        const { position } = this.ngViewer.navigationState
+        const pos = position.spatialCoordinates
+        this.exportNehuba.vec3.set(pos, deltaX, deltaY, 0)
+        this.exportNehuba.vec3.transformMat4(pos, pos, this.viewportToData[panelIndex])
+
+        position.changed.dispatch()
+      })
+    )
+  }
+
+  ngOnDestroy(){
+    while(this.s.length > 0){
+      this.s.pop().unsubscribe()
+    }
+  }
+}
diff --git a/src/ui/nehubaContainer/splashScreen/splashScreen.component.ts b/src/ui/nehubaContainer/splashScreen/splashScreen.component.ts
index 8681248e788a5476e5d0b28abea58b32570b1d29..89c0178b74dc61c3351da5832bb5280630161996 100644
--- a/src/ui/nehubaContainer/splashScreen/splashScreen.component.ts
+++ b/src/ui/nehubaContainer/splashScreen/splashScreen.component.ts
@@ -3,7 +3,7 @@ import { select, Store } from "@ngrx/store";
 import { fromEvent, Observable, Subject, Subscription, combineLatest } from "rxjs";
 import { bufferTime, filter, map, switchMap, take, withLatestFrom, shareReplay, startWith } from 'rxjs/operators'
 import { AtlasViewerConstantsServices } from "src/atlasViewer/atlasViewer.constantService.service";
-import { NEWVIEWER, ViewerStateInterface } from "src/services/stateStore.service";
+import { NEWVIEWER, ViewerStateInterface, IavRootStoreInterface } from "src/services/stateStore.service";
 
 @Component({
   selector : 'ui-splashscreen',
@@ -19,12 +19,12 @@ export class SplashScreen implements AfterViewInit {
   public loadedTemplate$: Observable<any[]>
   @ViewChild('parentContainer', {read: ElementRef})
   private parentContainer: ElementRef
-  private activatedTemplate$: Subject<any> = new Subject()
+  public activatedTemplate$: Subject<any> = new Subject()
 
   private subscriptions: Subscription[] = []
 
   constructor(
-    private store: Store<ViewerStateInterface>,
+    private store: Store<IavRootStoreInterface>,
     private constanceService: AtlasViewerConstantsServices,
   ) {
     this.loadedTemplate$ = this.store.pipe(
diff --git a/src/ui/nehubaContainer/statusCard/statusCard.component.ts b/src/ui/nehubaContainer/statusCard/statusCard.component.ts
index 0adce7701a6b3f819d211055dac29b1b8e36f718..e754370995cbc660dc16ce9bdf2ded98b6ceacac 100644
--- a/src/ui/nehubaContainer/statusCard/statusCard.component.ts
+++ b/src/ui/nehubaContainer/statusCard/statusCard.component.ts
@@ -6,6 +6,8 @@ import { NehubaViewerUnit } from "../nehubaViewer/nehubaViewer.component";
 import { Observable, Subscription, of, combineLatest, BehaviorSubject } from "rxjs";
 import { distinctUntilChanged, shareReplay, map, filter, startWith } from "rxjs/operators";
 import { MatBottomSheet } from "@angular/material/bottom-sheet";
+import { MatDialog } from "@angular/material/dialog";
+import { ARIA_LABELS } from 'common/constants'
 
 @Component({
   selector : 'ui-status-card',
@@ -25,11 +27,17 @@ export class StatusCardComponent implements OnInit, OnChanges{
   public navVal$: Observable<string>
   public mouseVal$: Observable<string>
 
+  public SHARE_BTN_ARIA_LABEL = ARIA_LABELS.SHARE_BTN
+  public COPY_URL_TO_CLIPBOARD_ARIA_LABEL = ARIA_LABELS.SHARE_COPY_URL_CLIPBOARD
+  public SHARE_CUSTOM_URL_ARIA_LABEL = ARIA_LABELS.SHARE_CUSTOM_URL
+  public SHARE_CUSTOM_URL_DIALOG_ARIA_LABEL = ARIA_LABELS.SHARE_CUSTOM_URL_DIALOG
+
   constructor(
     private store: Store<ViewerStateInterface>,
     private log: LoggingService,
     private store$: Store<IavRootStoreInterface>,
-    private bottomSheet: MatBottomSheet
+    private bottomSheet: MatBottomSheet,
+    private dialog: MatDialog,
   ) {
     const viewerState$ = this.store$.pipe(
       select('viewerState'),
@@ -154,4 +162,11 @@ export class StatusCardComponent implements OnInit, OnChanges{
       },
     })
   }
+
+  openDialog(tmpl: TemplateRef<any>, options) {
+    const { ariaLabel } = options
+    this.dialog.open(tmpl, {
+      ariaLabel
+    })
+  }
 }
diff --git a/src/ui/nehubaContainer/statusCard/statusCard.template.html b/src/ui/nehubaContainer/statusCard/statusCard.template.html
index 3af8b0b15405798b77e17054b8f4a58a74b6a7b6..b7baf40610f840a848f737c6c85acef0f6af6808 100644
--- a/src/ui/nehubaContainer/statusCard/statusCard.template.html
+++ b/src/ui/nehubaContainer/statusCard/statusCard.template.html
@@ -67,6 +67,7 @@
       <div class="w-0 position-relative">
         <button
           (click)="showBottomSheet(shareTmpl)"
+          [attr.aria-label]="SHARE_BTN_ARIA_LABEL"
           mat-icon-button
           class="position-absolute share-btn">
           <i class="fas fa-share-square"></i>
@@ -78,7 +79,7 @@
     <mat-form-field *ngIf="!isMobile"
       class="w-100">
       <mat-label>
-        Cursor Pos
+        Cursor Position
       </mat-label>
       <input type="text"
         matInput
@@ -95,15 +96,84 @@
     Share via
   </h4>
   <mat-nav-list>
-    <mat-list-item iav-clipboard-copy>
+    <mat-list-item iav-clipboard-copy
+      [attr.aria-label]="COPY_URL_TO_CLIPBOARD_ARIA_LABEL"
+      [attr.tab-index]="10">
       <mat-icon
         class="mr-4"
         fontSet="fas"
-        fontIcon="fa-link">
+        fontIcon="fa-copy">
       </mat-icon>
       <span>
         Copy link to this view
       </span>
     </mat-list-item>
+    <mat-list-item (click)="openDialog(shareSaneUrl, { ariaLabel: SHARE_CUSTOM_URL_DIALOG_ARIA_LABEL })"
+      [attr.aria-label]="SHARE_CUSTOM_URL_ARIA_LABEL"
+      [attr.tab-index]="10">
+      <mat-icon 
+        class="mr-4"
+        fontSet="fas"
+        fontIcon="fa-link">
+      </mat-icon>
+      
+      <span>
+        Create custom URL
+      </span>
+
+    </mat-list-item>
   </mat-nav-list>
-</ng-template>
\ No newline at end of file
+</ng-template>
+
+<ng-template #shareSaneUrl>
+  <h2 mat-dialog-title>
+    Create custom URL
+  </h2>
+
+  <div mat-dialog-content>
+    <div iav-auth-authState
+      #authState="iavAuthAuthState">
+
+      <!-- Logged in. Explain that links will not expire, offer to logout -->
+      <ng-container *ngIf="authState.user$ | async as user; else otherTmpl">
+        <span>
+          Logged in as {{ user.name }}
+        </span>
+        <button mat-button
+          color="warn"
+          tabindex="-1">
+          <i class="fas fa-sign-in-alt"></i>
+          <span>
+            Logout
+          </span>
+        </button>
+      </ng-container>
+
+      <!-- Not logged in. Offer to login -->
+      <ng-template #otherTmpl>
+        <span>
+          Not logged in
+        </span>
+        <signin-modal></signin-modal>
+      </ng-template>
+    </div>
+
+    <!-- explain links expiration -->
+    <div class="text-muted mat-small">
+      {{ (authState.user$ | async) ? 'Links you generate will not expire' : 'Links you generate will expire after 72 hours' }}
+    </div>
+
+    <iav-sane-url iav-state-aggregator
+      [stateTobeSaved]="stateAggregator.jsonifiedSstate$ | async"
+      #stateAggregator="iavStateAggregator">
+    </iav-sane-url>
+  </div>
+
+  <div mat-dialog-actions
+    class="d-flex justify-content-center">
+    <button mat-button
+      mat-dialog-close>
+      close
+    </button>
+  </div>
+</ng-template>
diff --git a/src/ui/nehubaContainer/util.ts b/src/ui/nehubaContainer/util.ts
index 5455355f2a364f8ae7f6011c1833011eb18c4048..f1fbb9348f338683c81fbabe86680140c2f3fc55 100644
--- a/src/ui/nehubaContainer/util.ts
+++ b/src/ui/nehubaContainer/util.ts
@@ -202,3 +202,15 @@ export const userLmUnchanged = (oldlms, newlms) => {
   return oldlms.every(lm => singleLmUnchanged(lm, newmap as Map<string, [number, number, number]>))
     && newlms.every(lm => singleLmUnchanged(lm, oldmap as Map<string, [number, number, number]>))
 }
+
+export const importNehubaFactory = appendSrc => {
+  let pr: Promise<any>
+  return () => {
+    if ((window as any).export_nehuba) return Promise.resolve()
+
+    if (pr) return pr
+    pr = appendSrc('main.bundle.js')
+
+    return pr
+  }
+}
diff --git a/src/ui/parcellationRegion/region.base.ts b/src/ui/parcellationRegion/region.base.ts
index a9318528241120a14e5918041dd47b8f091f08bf..0b12f98d2af402be9e9369f62555da8f14703286 100644
--- a/src/ui/parcellationRegion/region.base.ts
+++ b/src/ui/parcellationRegion/region.base.ts
@@ -9,6 +9,7 @@ import {
 import { VIEWERSTATE_CONTROLLER_ACTION_TYPES } from "../viewerStateController/viewerState.base";
 import {distinctUntilChanged, shareReplay} from "rxjs/operators";
 import {Observable} from "rxjs";
+import { ARIA_LABELS } from 'common/constants'
 
 export class RegionBase {
 
@@ -150,4 +151,8 @@ export class RegionBase {
     }
   }
 
+  public SHOW_CONNECTIVITY_DATA = ARIA_LABELS.SHOW_CONNECTIVITY_DATA
+  public SHOW_IN_OTHER_REF_SPACE = ARIA_LABELS.SHOW_IN_OTHER_REF_SPACE
+  public SHOW_ORIGIN_DATASET = ARIA_LABELS.SHOW_ORIGIN_DATASET
+  public AVAILABILITY_IN_OTHER_REF_SPACE = ARIA_LABELS.AVAILABILITY_IN_OTHER_REF_SPACE
 }
diff --git a/src/ui/parcellationRegion/regionMenu/regionMenu.style.css b/src/ui/parcellationRegion/regionMenu/regionMenu.style.css
index e9a48a372933a13d21d572ccdc4d8cbf1120fa6b..fd17d0f562db0fc6ada4ee123d1c3778822395de 100644
--- a/src/ui/parcellationRegion/regionMenu/regionMenu.style.css
+++ b/src/ui/parcellationRegion/regionMenu/regionMenu.style.css
@@ -1,10 +1,29 @@
-.regionDescriptionTextClass
+mat-list.sm mat-list-item
 {
-  max-height:100px;
-  transition: max-height 0.15s ease-out;
+  height:36px;
+  font-size: 90%;
+  cursor: default;
 }
-.regionDescriptionTextOpened
+
+mat-icon
 {
-  max-height: 310px;
-  transition: max-height 0.25s ease-in;
+  transform: scale(0.75);
 }
+
+.action-list
+{
+  margin-left: -16px;
+  margin-right: -16px;
+}
+
+.action-list mat-icon
+{
+  padding-left: 0px;
+}
+
+.region-name
+{
+  display: inherit;
+  font-size: 95%;
+  line-height: normal;
+}
\ No newline at end of file
diff --git a/src/ui/parcellationRegion/regionMenu/regionMenu.template.html b/src/ui/parcellationRegion/regionMenu/regionMenu.template.html
index b078e810dfbe977a5427559bcd29ba9391715333..4d538936d97e6f385673e486683d3f263b06ca5f 100644
--- a/src/ui/parcellationRegion/regionMenu/regionMenu.template.html
+++ b/src/ui/parcellationRegion/regionMenu/regionMenu.template.html
@@ -1,6 +1,8 @@
 <mat-card>
   <mat-card-title>
-    {{ region.name }}
+    <div class="position-relative region-name">
+      {{ region.name }}
+    </div>
   </mat-card-title>
   <mat-card-subtitle>
     <i class="fas fa-brain"></i>
@@ -8,61 +10,197 @@
       Brain region
     </span>
   </mat-card-subtitle>
+  
   <mat-card-content>
-    {{ region.description }}
-  </mat-card-content>
-  <div class="d-flex flex-row flex-wrap">
-    <button mat-button
-      (click)="toggleRegionSelected()"
-      [color]="isSelected ? 'primary': 'basic'">
-      <i class="far" [ngClass]="{'fa-check-square': isSelected, 'fa-square': !isSelected}"></i>
-      <span>
-        {{isSelected? 'Deselect' : 'Select'}}
-      </span>
-    </button>
-    <button mat-button (click)="navigateToRegion()">
-      <i class="fas fa-map-marked-alt"></i>
-      <span>
-        Navigate
-      </span>
-    </button>
-    <button *ngIf="hasConnectivity"
-      mat-button
-      [matMenuTriggerFor]="connectivitySourceDatasets"
-      #connectivityMenuButton="matMenuTrigger"
-      iav-captureClickListenerDirective
-      [iav-captureClickListenerDirective-captureDocument]="true"
-      (iav-captureClickListenerDirective-onMousedown)="connectivityMenuButton.closeMenu()">
-      <i class="fab fa-connectdevelop"></i>
-      <span>
-        Connectivity
-      </span>
-      <i class="fas fa-angle-right"></i>
-    </button>
+    <mat-divider></mat-divider>
+    
+    <ng-template #safeHarbour>
+        
+      <!-- enlarged region actions -->
+      <mat-grid-list cols="2" rowHeight="6rem" gutterSize="0px">
 
+        <mat-grid-tile>
+          <iav-v-button
+            class="h-100 w-100"
+            mat-ripple
+            [color]="isSelected ? 'primary' : 'default'"
+            (click)="toggleRegionSelected()">
+            <i iav-v-button-icon class="far" [ngClass]="{'fa-check-square': isSelected, 'fa-square': !isSelected}"></i>
+            <span iav-v-button-text>Select</span>
+          </iav-v-button>
+        </mat-grid-tile>
+  
+        <mat-grid-tile>
+          <iav-v-button
+            class="h-100 w-100"
+            mat-ripple
+            (click)="navigateToRegion()">
+            <i class="fas fa-map-marked-alt" iav-v-button-icon></i>
+            <span iav-v-button-text>Navigate</span>
+          </iav-v-button>
+        </mat-grid-tile>
+  
+        <ng-container *ngFor="let originDataset of (region.originDatasets || [])">
+          <mat-grid-tile class="iv-custom-comp">
+            <iav-v-button
+              iav-dataset-preview-dataset-file
+              [iav-dataset-preview-dataset-file-kgid]="originDataset.kgId"
+              [iav-dataset-preview-dataset-file-filename]="originDataset.filename"
+              #previewDirective="iavDatasetPreviewDatasetFile"
+              class="h-100 w-100"
+              mat-ripple>
+              <i class="far fa-eye" iav-v-button-icon></i>
+              <span iav-v-button-text [class]="previewDirective.active ? 'iv-custom-comp primary' : ''">Probability Map {{ previewDirective.active }}</span>
+            </iav-v-button>
+          </mat-grid-tile>
+        </ng-container> 
+        
+        <mat-grid-tile>
+          <iav-v-button *ngIf="hasConnectivity"
+            class="h-100 w-100"
+            mat-ripple
+            [matMenuTriggerFor]="connectivitySourceDatasets"
+            #connectivityMenuButton="matMenuTrigger"
+            iav-captureClickListenerDirective
+            [iav-captureClickListenerDirective-captureDocument]="true"
+            (iav-captureClickListenerDirective-onMousedown)="connectivityMenuButton.closeMenu()">
+            <i class="fab fa-connectdevelop" iav-v-button-icon></i>
+            <span iav-v-button-text>Connectivity</span>
+            <i class="fas fa-chevron-down" iav-v-button-footer></i>
+          </iav-v-button>
+        </mat-grid-tile>
+  
+        <mat-grid-tile>
+          <iav-v-button *ngIf="sameRegionTemplate.length"
+            class="h-100 w-100"
+            mat-ripple
+            [matMenuTriggerFor]="additionalActions"
+            #changeTmplTrigger="matMenuTrigger"
+            iav-captureClickListenerDirective
+            [iav-captureClickListenerDirective-captureDocument]="true"
+            (iav-captureClickListenerDirective-onMousedown)="changeTmplTrigger.closeMenu()">
+            <i class="fas fa-brain" iav-v-button-icon></i>
+            <span iav-v-button-text>Change template</span>
+            <i class="fas fa-chevron-down" iav-v-button-footer></i>
+          </iav-v-button>
+        </mat-grid-tile> 
+      </mat-grid-list>
+    </ng-template>
 
-
-    <!-- Menu to navigate between template spaces to explore same region -->
-    <div>
-      <button mat-button
-        aria-label="Show availability in other reference spaces"
-        *ngIf="sameRegionTemplate.length"
-        [matMenuTriggerFor]="additionalActions"
-        #changeTmplTrigger="matMenuTrigger"
-        iav-captureClickListenerDirective
-        [iav-captureClickListenerDirective-captureDocument]="true"
-        (iav-captureClickListenerDirective-onMousedown)="changeTmplTrigger.closeMenu()">
-        <i class="fas fa-brain"></i>
-        <span>
-          Change template
-        </span>
-        <i class="fas fa-angle-right"></i>
-      </button>
+    <!-- region desc -->
+    <ng-container *ngIf="region?.description?.length > 0">
+      <mat-divider></mat-divider>
+      <div>
+        {{ region.description }}
     </div>
+    </ng-container>
 
-  </div>
-</mat-card>
+    <mat-divider></mat-divider>
+
+    <mat-list class="action-list sm">
 
+      <!-- selected -->
+      <mat-list-item
+        mat-ripple
+        iv-custom-comp
+        [attr.primary]="isSelected || null"
+        (click)="toggleRegionSelected()">
+        <mat-icon scaled-down="" fontSet="far" [fontIcon]="isSelected ? 'fa-check-square' : 'fa-square'"  mat-list-icon></mat-icon>
+        <div mat-line>
+          Select
+        </div>
+      </mat-list-item>
+      
+      <!-- position -->
+      <mat-list-item *ngIf="region?.position" (click)="navigateToRegion()" mat-ripple>
+        <mat-icon scaled-down fontSet="fas" fontIcon="fa-map-marked-alt" mat-list-icon></mat-icon>
+        <div mat-line>
+          {{ region.position | nmToMm | addUnitAndJoin : 'mm' }}
+        </div>
+      </mat-list-item>
+
+      <!-- originData -->
+      <mat-list-item *ngFor="let originDataset of (region.originDatasets || [])"
+        iav-dataset-preview-dataset-file
+        [iav-dataset-preview-dataset-file-kgid]="originDataset.kgId"
+        [iav-dataset-preview-dataset-file-filename]="originDataset.filename"
+        #previewDirective="iavDatasetPreviewDatasetFile"
+        iv-custom-comp
+        [attr.primary]="previewDirective.active || null"
+        role="switch"
+        [attr.aria-checked]="previewDirective.active"
+        [attr.aria-label]="SHOW_ORIGIN_DATASET"
+        mat-ripple>
+        <mat-icon fontSet="fas" fontIcon="fa-eye" mat-list-icon></mat-icon>
+        <div mat-line>
+          View probability map
+        </div>
+      </mat-list-item>
+
+      <!-- connectivity -->
+      <div iav-switch #connectivitySwitch="iavSwitch">
+
+        <mat-list-item mat-ripple
+          (click)="connectivitySwitch.toggle()"
+          [attr.aria-label]="SHOW_CONNECTIVITY_DATA">
+          <mat-icon fontSet="fab" fontIcon="fa-connectdevelop" mat-list-icon></mat-icon >
+          <div mat-line>
+            <span>
+              Connectivity
+            </span>
+            <span class="muted">
+             ({{ 1 }})
+            </span>
+          </div>
+          <mat-icon fontSet="fas" [fontIcon]="connectivitySwitch.switchState ? 'fa-chevron-up' : 'fa-chevron-down'"></mat-icon>
+        </mat-list-item>
+  
+        <!-- connectivity -->
+        <mat-list-item *ngIf="connectivitySwitch.switchState" mat-ripple (click)="showConnectivity(region.name)">
+          <mat-icon fontSet="fas" fontIcon="fa-none" mat-list-icon></mat-icon>
+          <div mat-line>1000 Brain Study - DTI connectivity</div>
+        </mat-list-item>
+
+      </div>
+
+      <!-- change template -->
+      <div iav-switch #changeTmplSwitch="iavSwitch">
+
+        <mat-list-item *ngIf="sameRegionTemplate.length"
+          mat-ripple
+          [attr.aria-label]="SHOW_IN_OTHER_REF_SPACE"
+          (click)="changeTmplSwitch && changeTmplSwitch.toggle()">
+          <mat-icon fontSet="fas" fontIcon="fa-brain" mat-list-icon></mat-icon>
+          <div mat-line>
+            <span>
+              Explore in other templates
+            </span>
+            <span class="muted">
+              ({{ sameRegionTemplate.length }})
+            </span>
+          </div>
+          <mat-icon fontSet="fas" [fontIcon]="changeTmplSwitch.switchState ? 'fa-chevron-up' : 'fa-chevron-down'"></mat-icon>
+        </mat-list-item>
+
+        <!-- change template items -->
+        <div *ngIf="changeTmplSwitch.switchState"
+          [attr.aria-label]="AVAILABILITY_IN_OTHER_REF_SPACE">
+          <mat-list-item *ngFor="let sameRegion of sameRegionTemplate; let i = index"
+            [attr.aria-label]="SHOW_IN_OTHER_REF_SPACE + ': ' + sameRegion.template.name + (sameRegion.hemisphere ? (' - ' + sameRegion.hemisphere) : '') "
+            (click)="changeView(i)"
+            mat-ripple>
+            <mat-icon fontSet="fas" fontIcon="fa-none" mat-list-icon></mat-icon>
+            <div mat-line>
+              <span class="overflow-x-hidden text-truncate"> {{ sameRegion.template.name }} </span>
+              <span *ngIf="sameRegion.hemisphere"> - {{ sameRegion.hemisphere }}</span>
+            </div>
+          </mat-list-item>
+        </div>
+      
+      </div>
+    </mat-list>
+  </mat-card-content>
+</mat-card>
 
 <!-- ToDo make dynamic with AVAILABLE CONNECTIVITY DATASETS data - get info from atlas viewer core -->
 <mat-menu
@@ -78,7 +216,6 @@
 
 
 <mat-menu
-  [aria-label]="'Availability in other reference spaces'"
   #additionalActions="matMenu"
   xPosition="before"
   hasBackdrop="false">
diff --git a/src/ui/searchSideNav/searchSideNav.component.ts b/src/ui/searchSideNav/searchSideNav.component.ts
index f514928bd44411a8519b740fc31c13f9b83e7fbf..fe9bcb9dcdb15201a97f9664fb9e94823a2084b9 100644
--- a/src/ui/searchSideNav/searchSideNav.component.ts
+++ b/src/ui/searchSideNav/searchSideNav.component.ts
@@ -10,7 +10,6 @@ import {
   EXPAND_SIDE_PANEL_CURRENT_VIEW,
 } from "src/services/state/uiState.store";
 import { IavRootStoreInterface, SELECT_REGIONS } from "src/services/stateStore.service";
-import { LayerBrowser } from "../layerbrowser/layerbrowser.component";
 import { trackRegionBy } from '../viewerStateController/regionHierachy/regionHierarchy.component'
 import { MatDialog, MatDialogRef } from "@angular/material/dialog";
 import { MatSnackBar } from "@angular/material/snack-bar";
@@ -26,8 +25,6 @@ import { MatSnackBar } from "@angular/material/snack-bar";
 export class SearchSideNav implements OnDestroy {
   public availableDatasets: number = 0
 
-  public showLayerBrowser: boolean = true
-
   private subscriptions: Subscription[] = []
   private layerBrowserDialogRef: MatDialogRef<any>
 
diff --git a/src/ui/searchSideNav/searchSideNav.template.html b/src/ui/searchSideNav/searchSideNav.template.html
index 33fb69be3b7c417bd95570eb6c1174912a3bb38e..5335dd86107d514ebb2fe85025f7383b1e3b64fe 100644
--- a/src/ui/searchSideNav/searchSideNav.template.html
+++ b/src/ui/searchSideNav/searchSideNav.template.html
@@ -77,7 +77,10 @@
 </div>
 
 <ng-template #layerBrowserTmpl>
-  <mat-dialog-content [hidden]="!showLayerBrowser">
+  <mat-dialog-content
+    iav-switch
+    #showLayerBrowserSwitch="iavSwitch"
+    [hidden]="!showLayerBrowserSwitch.switchState">
     <div class="d-flex flex-column">
       <layer-browser></layer-browser>
     </div>
@@ -86,12 +89,12 @@
   <div class="d-flex justify-content-center position-static h-0 mt-4">
     <button mat-mini-fab
       aria-label="Toggle expansion state of additional layer browser"
-      [matBadge]="showLayerBrowser ? null : (layerBrowser.nonBaseNgLayers$ | async).length"
+      [matBadge]="showLayerBrowserSwitch.switchState ? null : (layerBrowser.nonBaseNgLayers$ | async).length"
       class="position-absolute layerBrowserToggleBtn"
       matTooltip="Toggle the visiblity of the additional layer browser"
-      [attr.toggle-open]="showLayerBrowser"
-      (click)="showLayerBrowser = !showLayerBrowser">
-      <i class="fas" [ngClass]="{'fa-chevron-down': !showLayerBrowser, 'fa-chevron-up': showLayerBrowser}">
+      [attr.toggle-open]="showLayerBrowserSwitch.switchState"
+      (click)="showLayerBrowserSwitch.toggle()">
+      <i class="fas" [ngClass]="{'fa-chevron-down': !showLayerBrowserSwitch.switchState, 'fa-chevron-up': showLayerBrowserSwitch.switchState}">
       </i>
     </button>
   </div>
diff --git a/src/ui/sharedModules/angularMaterial.module.ts b/src/ui/sharedModules/angularMaterial.module.ts
index 0455c50b110e7ed3dc425acf169a8f7815e3c20f..d5384113b07877cc3d0c0a726387c2c38d5e64bf 100644
--- a/src/ui/sharedModules/angularMaterial.module.ts
+++ b/src/ui/sharedModules/angularMaterial.module.ts
@@ -13,7 +13,7 @@ import {MatSelectModule} from "@angular/material/select";
 import {MatChipsModule} from "@angular/material/chips";
 import {MatAutocompleteModule} from "@angular/material/autocomplete";
 
-import { ScrollingModule as ExperimentalScrollingModule } from '@angular/cdk-experimental/scrolling'
+import { ScrollingModule } from '@angular/cdk/scrolling'
 import {MatInputModule} from "@angular/material/input";
 import {MatSlideToggleModule} from "@angular/material/slide-toggle";
 import {MatListModule} from "@angular/material/list";
@@ -57,7 +57,7 @@ const defaultDialogOption: MatDialogConfig = new MatDialogConfig()
     MatGridListModule,
     MatIconModule,
     MatMenuModule,
-    ExperimentalScrollingModule,
+    ScrollingModule,
     MatToolbarModule,
     ClipboardModule,
   ],
@@ -86,7 +86,7 @@ const defaultDialogOption: MatDialogConfig = new MatDialogConfig()
     MatGridListModule,
     MatIconModule,
     MatMenuModule,
-    ExperimentalScrollingModule,
+    ScrollingModule,
     MatToolbarModule,
     ClipboardModule,
   ],
diff --git a/src/ui/signinBanner/signinBanner.components.ts b/src/ui/signinBanner/signinBanner.components.ts
index 56ec363fe859f8856d44ae9cce700f90f96f420f..5cc4f0f1489921d6343078b4612014e14696107c 100644
--- a/src/ui/signinBanner/signinBanner.components.ts
+++ b/src/ui/signinBanner/signinBanner.components.ts
@@ -10,7 +10,7 @@ import {
 import { select, Store } from "@ngrx/store";
 import { Observable } from "rxjs";
 import { map } from "rxjs/operators";
-import { AuthService, IUser } from "src/services/auth.service";
+import { AuthService } from "src/auth";
 import { IavRootStoreInterface, IDataEntry } from "src/services/stateStore.service";
 import {MatDialog, MatDialogRef} from "@angular/material/dialog";
 import {MatBottomSheet} from "@angular/material/bottom-sheet";
@@ -32,9 +32,9 @@ export class SigninBanner {
 
   @ViewChild('takeScreenshotElement', {read: ElementRef}) takeScreenshotElement: ElementRef
 
-  public user$: Observable<IUser>
+  public user$: Observable<any>
   public userBtnTooltip$: Observable<string>
-  public favDataEntries$: Observable<IDataEntry[]>
+  public favDataEntries$: Observable<Partial<IDataEntry>[]>
 
   public pluginTooltipText: string = `Plugins and Tools`
   public screenshotTooltipText: string = 'Take screenshot'
diff --git a/src/ui/templateParcellationCitations/templateParcellationCitations.component.ts b/src/ui/templateParcellationCitations/templateParcellationCitations.component.ts
index 3a04ab1b33c42badecdcf0dac78e32605ea145e2..c97715d798fbf1345ee5832cd890d2ebcb0ef477 100644
--- a/src/ui/templateParcellationCitations/templateParcellationCitations.component.ts
+++ b/src/ui/templateParcellationCitations/templateParcellationCitations.component.ts
@@ -2,7 +2,7 @@ import { Component } from "@angular/core";
 import { select, Store } from "@ngrx/store";
 import { Observable } from "rxjs";
 import { map, switchMap } from "rxjs/operators";
-import { safeFilter, ViewerStateInterface } from "../../services/stateStore.service";
+import { safeFilter, IavRootStoreInterface } from "../../services/stateStore.service";
 
 @Component({
   selector : 'template-parcellation-citation-container',
@@ -16,7 +16,7 @@ export class TemplateParcellationCitationsContainer {
   public selectedTemplate$: Observable<any>
   public selectedParcellation$: Observable<any>
 
-  constructor(private store: Store<ViewerStateInterface>) {
+  constructor(private store: Store<IavRootStoreInterface>) {
     this.selectedTemplate$ = this.store.pipe(
       select('viewerState'),
       safeFilter('templateSelected'),
diff --git a/src/ui/tryme/tryme.component.ts b/src/ui/tryme/tryme.component.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d5369c352211095b395abf17af814a0c339551e0
--- /dev/null
+++ b/src/ui/tryme/tryme.component.ts
@@ -0,0 +1,30 @@
+import { Component } from "@angular/core";
+import { Observable, interval } from "rxjs";
+import { mapTo, startWith, scan } from "rxjs/operators";
+
+@Component({
+  selector: 'tryme-component',
+  templateUrl: './tryme.template.html',
+  styleUrls: [
+    './tryme.style.css'
+  ]
+})
+
+export class TryMeComponent{
+  public interval$: Observable<any>
+
+  constructor(){
+    this.interval$ = interval(5000).pipe(
+      mapTo(1),
+      startWith(1),
+      scan((acc, curr) => acc + curr)
+    )
+  }
+
+  public texts = [
+    'Try me!',
+    'Touch enabled',
+    'Drag around',
+    'Zoom in / Zoom out'
+  ]
+}
\ No newline at end of file
diff --git a/src/ui/tryme/tryme.style.css b/src/ui/tryme/tryme.style.css
new file mode 100644
index 0000000000000000000000000000000000000000..5ff9257fa7abf4aab2aba7fd28c561eb72157c7f
--- /dev/null
+++ b/src/ui/tryme/tryme.style.css
@@ -0,0 +1,37 @@
+:host
+{
+  width: 100%;
+  height: 100%;
+  display: block;
+}
+
+.finger
+{
+  left: 10%;
+  top: 30%;
+}
+
+@keyframes pointer
+{
+  0% {
+    opacity: 0.0;
+    transform: translateX(-100px);
+  }
+  10% {
+    opacity: 1.0;
+    transform: translateX(-100px);
+  }
+  30% {
+    transform: translateX(100px);
+    opacity: 1.0;
+  }
+  40%, 100% {
+    opacity: 0.0;
+    transform: translateX(100px);
+  }
+}
+
+.tmp
+{
+  animation: pointer 10s ease-in-out infinite both;
+}
diff --git a/src/ui/tryme/tryme.template.html b/src/ui/tryme/tryme.template.html
new file mode 100644
index 0000000000000000000000000000000000000000..0c78224e58bef7f68ef9e001c763073b307d3a55
--- /dev/null
+++ b/src/ui/tryme/tryme.template.html
@@ -0,0 +1,22 @@
+<div class="d-flex flex-column align-items-center justify-content-center w-100 h-100">
+
+  <mat-card>
+    <mat-card-title *ngIf="interval$ | async as indexVal">
+      {{ texts[indexVal % (texts.length)] }}
+    </mat-card-title>
+  </mat-card>
+
+  <div class="tmp d-inline-block position-relative">
+    <button class="d-inline-block"
+      mat-icon-button
+      color="accent">
+      <i class="fas fa-bullseye"></i>
+    </button>
+    
+    <button class="position-absolute finger"
+      mat-icon-button
+      color="accent">
+      <i class="fas fa-hand-point-up fa-2x"></i>
+    </button>
+  </div>
+</div>
diff --git a/src/ui/ui.module.ts b/src/ui/ui.module.ts
index 066031db546e4e53b73137de8696482492c11170..b58d1b66231b6966622ac15e7fd9f6227a310053 100644
--- a/src/ui/ui.module.ts
+++ b/src/ui/ui.module.ts
@@ -1,10 +1,10 @@
-import {CUSTOM_ELEMENTS_SCHEMA, NgModule} from "@angular/core";
+import {CUSTOM_ELEMENTS_SCHEMA, NgModule, Renderer2} from "@angular/core";
 import { ComponentsModule } from "src/components/components.module";
 
 import { FormsModule, ReactiveFormsModule } from "@angular/forms";
 import { LayoutModule } from "src/layouts/layout.module";
 import { NehubaContainer } from "./nehubaContainer/nehubaContainer.component";
-import { NehubaViewerUnit } from "./nehubaContainer/nehubaViewer/nehubaViewer.component";
+import { NehubaViewerUnit, IMPORT_NEHUBA_INJECT_TOKEN } from "./nehubaContainer/nehubaViewer/nehubaViewer.component";
 import { GetTemplateImageSrcPipe, ImgSrcSetPipe, SplashScreen } from "./nehubaContainer/splashScreen/splashScreen.component";
 
 import { FilterRegionDataEntries } from "src/util/pipes/filterRegionDataEntries.pipe";
@@ -47,7 +47,7 @@ import { MobileOverlay } from "./nehubaContainer/mobileOverlay/mobileOverlay.com
 import { MobileControlNubStylePipe } from "./nehubaContainer/pipes/mobileControlNubStyle.pipe";
 import { StatusCardComponent } from "./nehubaContainer/statusCard/statusCard.component";
 import { SigninBanner } from "./signinBanner/signinBanner.components";
-import { SigninModal } from "./signinModal/signinModal.component";
+
 import { TemplateParcellationCitationsContainer } from "./templateParcellationCitations/templateParcellationCitations.component";
 import { FilterNameBySearch } from "./viewerStateController/regionHierachy/filterNameBySearch.pipe";
 
@@ -82,6 +82,15 @@ import { LandmarkUIComponent } from "./landmarkUI/landmarkUI.component";
 import { NehubaModule } from "./nehubaContainer/nehuba.module";
 import { LayerDetailComponent } from "./layerbrowser/layerDetail/layerDetail.component";
 import { ShareModule } from "src/share";
+import { StateModule } from "src/state";
+import { AuthModule } from "src/auth";
+import { FabSpeedDialModule } from "src/components/fabSpeedDial";
+import { ActionDialog } from "./actionDialog/actionDialog.component";
+import { NehubaViewerTouchDirective } from "./nehubaContainer/nehubaViewerInterface/nehubaViewerTouch.directive";
+import { importNehubaFactory } from "./nehubaContainer/util";
+import { APPEND_SCRIPT_TOKEN, appendScriptFactory } from "src/util/constants";
+import { DOCUMENT } from "@angular/common";
+
 
 @NgModule({
   imports : [
@@ -96,6 +105,9 @@ import { ShareModule } from "src/share";
     AngularMaterialModule,
     NehubaModule,
     ShareModule,
+    StateModule,
+    AuthModule,
+    FabSpeedDialModule,
   ],
   declarations : [
     NehubaContainer,
@@ -114,7 +126,7 @@ import { ShareModule } from "src/share";
     HelpComponent,
     ConfigComponent,
     SigninBanner,
-    SigninModal,
+    
     StatusCardComponent,
     CookieAgreement,
     KGToS,
@@ -138,6 +150,8 @@ import { ShareModule } from "src/share";
     RegionListSimpleViewComponent,
     LandmarkUIComponent,
 
+    ActionDialog,
+
     /* pipes */
     GroupDatasetByRegion,
     FilterRegionDataEntries,
@@ -170,6 +184,19 @@ import { ShareModule } from "src/share";
     TouchSideClass,
     ElementOutClickDirective,
     FixedMouseContextualContainerDirective,
+    NehubaViewerTouchDirective,
+  ],
+  providers: [
+    {
+      provide: IMPORT_NEHUBA_INJECT_TOKEN,
+      useFactory: importNehubaFactory,
+      deps: [ APPEND_SCRIPT_TOKEN ]
+    },
+    {
+      provide: APPEND_SCRIPT_TOKEN,
+      useFactory: appendScriptFactory,
+      deps: [ DOCUMENT ]
+    }
   ],
   entryComponents : [
 
@@ -177,6 +204,7 @@ import { ShareModule } from "src/share";
     NehubaViewerUnit,
     LayerBrowser,
     PluginBannerUI,
+    ActionDialog,
   ],
   exports : [
     SubjectViewer,
@@ -192,7 +220,7 @@ import { ShareModule } from "src/share";
     HelpComponent,
     ConfigComponent,
     SigninBanner,
-    SigninModal,
+    
     CookieAgreement,
     KGToS,
     StatusCardComponent,
@@ -201,7 +229,8 @@ import { ShareModule } from "src/share";
     ViewerStateMini,
     RegionMenuComponent,
     FixedMouseContextualContainerDirective,
-    LandmarkUIComponent
+    LandmarkUIComponent,
+    NehubaViewerTouchDirective,
   ],
   schemas: [
     CUSTOM_ELEMENTS_SCHEMA,
diff --git a/src/util/constants.ts b/src/util/constants.ts
index b6f7198ec9bc85453c6a60d4b642ef670564f38a..bfb83d130f37e87b74f201971016e38012127395 100644
--- a/src/util/constants.ts
+++ b/src/util/constants.ts
@@ -1,3 +1,5 @@
+import { HttpHeaders } from "@angular/common/http"
+
 export const LOCAL_STORAGE_CONST = {
   GPU_LIMIT: 'fzj.xg.iv.GPU_LIMIT',
   ANIMATION: 'fzj.xg.iv.ANIMATION_FLAG',
@@ -11,4 +13,57 @@ export const LOCAL_STORAGE_CONST = {
 
 export const COOKIE_VERSION = '0.3.0'
 export const KG_TOS_VERSION = '0.3.0'
-export const DS_PREVIEW_URL = DATASET_PREVIEW_URL
\ No newline at end of file
+export const DS_PREVIEW_URL = DATASET_PREVIEW_URL
+export const BACKENDURL = (() => {
+  if (!BACKEND_URL) return `http://localhost:3000/`
+  if (/^http/.test(BACKEND_URL)) return BACKEND_URL
+
+  const url = new URL(window.location.href)
+  const { protocol, hostname, pathname } = url
+  return `${protocol}//${hostname}${pathname.replace(/\/$/, '')}/${BACKEND_URL}`
+})()
+
+export const MIN_REQ_EXPLAINER = `
+- Interactive atlas viewer requires **webgl2.0**, and the \`EXT_color_buffer_float\` extension enabled.
+- You can check browsers' support of webgl2.0 by visiting <https://caniuse.com/#feat=webgl2>
+- Unfortunately, Safari and iOS devices currently do not support **webgl2.0**: <https://webkit.org/status/#specification-webgl-2>
+`
+
+export const APPEND_SCRIPT_TOKEN = `APPEND_SCRIPT_TOKEN`
+
+export const appendScriptFactory = (document: Document) => {
+  return src => new Promise((rs, rj) => {
+    const scriptEl = document.createElement('script')
+    scriptEl.src = src
+    scriptEl.onload = () => rs(scriptEl)
+    scriptEl.onerror = (e) => rj(e)
+    document.head.appendChild(scriptEl)
+  })
+}
+
+export const REMOVE_SCRIPT_TOKEN = `REMOVE_SCRIPT_TOKEN`
+
+export const removeScriptFactory = (document: Document) => {
+  return (srcEl: HTMLScriptElement) => {
+    document.head.removeChild(srcEl)
+  }
+}
+
+const getScopedReferer = () => {
+  const url = new URL(window.location.href)
+  url.searchParams.delete('regionsSelected')
+  url.searchParams.delete('cRegionsSelected')
+  return url.toString()
+}
+
+export const getFetchOption: () => Partial<RequestInit> = () => {
+  return {
+    referrer: getScopedReferer()
+  }
+}
+
+export const getHttpHeader: () => HttpHeaders = () => {
+  const header = new HttpHeaders()
+  header.set('referrer', getScopedReferer())
+  return header
+}
\ No newline at end of file
diff --git a/src/util/directives/FixedMouseContextualContainerDirective.directive.spec.ts b/src/util/directives/FixedMouseContextualContainerDirective.directive.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..0cf11aeb387d08a01a89f616e7095cc716fb63c5
--- /dev/null
+++ b/src/util/directives/FixedMouseContextualContainerDirective.directive.spec.ts
@@ -0,0 +1,131 @@
+import { Component, ViewChild } from "@angular/core";
+import { TestBed } from "@angular/core/testing";
+import { FixedMouseContextualContainerDirective } from "./FixedMouseContextualContainerDirective.directive";
+import { By } from "@angular/platform-browser";
+
+@Component({
+  template: ''
+})
+
+class TestCmp{
+  @ViewChild(FixedMouseContextualContainerDirective) directive: FixedMouseContextualContainerDirective
+}
+
+describe('FixedMouseContextualContainerDirective', () => {
+  beforeEach(() => {
+    TestBed.configureTestingModule({
+      imports: [
+        
+      ],
+      declarations: [
+        TestCmp,
+        FixedMouseContextualContainerDirective
+      ]
+    })
+  })
+
+  it('> can instantiate directive properly', () => {
+    TestBed.overrideComponent(TestCmp, {
+      set: {
+        template: `
+        <div fixedMouseContextualContainerDirective>
+        </div>
+        `
+      }
+    }).compileComponents()
+
+    const fixture = TestBed.createComponent(TestCmp)
+    fixture.detectChanges()
+    const directive = fixture.debugElement.query( By.directive(FixedMouseContextualContainerDirective) )
+    expect(directive).toBeTruthy()
+
+    expect(fixture.componentInstance.directive).toBeTruthy()
+  })
+
+  describe('> hides if no content', () => {
+    it('> on #show, if content exists, isShown will be true', () => {
+
+      TestBed.overrideComponent(TestCmp, {
+        set: {
+          template: `
+          <div fixedMouseContextualContainerDirective>
+            <span>Hello World</span>
+          </div>
+          `
+        }
+      }).compileComponents()
+
+      const fixture = TestBed.createComponent(TestCmp)
+      fixture.detectChanges()
+
+      const cmp = fixture.componentInstance
+      cmp.directive.show()
+      fixture.detectChanges()
+      expect(cmp.directive.isShown).toBeTrue()
+    })
+
+    it('> on #show, if only comment exists, isShown will be false', () => {
+
+      TestBed.overrideComponent(TestCmp, {
+        set: {
+          template: `
+          <div fixedMouseContextualContainerDirective>
+            <!-- hello world -->
+          </div>
+          `
+        }
+      }).compileComponents()
+
+      const fixture = TestBed.createComponent(TestCmp)
+      fixture.detectChanges()
+
+      const cmp = fixture.componentInstance
+      cmp.directive.show()
+      fixture.detectChanges()
+      expect(cmp.directive.isShown).toBeFalse()
+    })
+
+    it('> on #show, if only text exists, isShown will be false', () => {
+
+      TestBed.overrideComponent(TestCmp, {
+        set: {
+          template: `
+          <div fixedMouseContextualContainerDirective>
+            hello world
+          </div>
+          `
+        }
+      }).compileComponents()
+
+      const fixture = TestBed.createComponent(TestCmp)
+      fixture.detectChanges()
+
+      const cmp = fixture.componentInstance
+      cmp.directive.show()
+      fixture.detectChanges()
+      expect(cmp.directive.isShown).toBeFalse()
+    })
+
+    it('> on #show, if nothing exists, isShown will be false', () => {
+
+      TestBed.overrideComponent(TestCmp, {
+        set: {
+          template: `
+          <div fixedMouseContextualContainerDirective>
+          </div>
+          `
+        }
+      }).compileComponents()
+
+      const fixture = TestBed.createComponent(TestCmp)
+      fixture.detectChanges()
+
+      const cmp = fixture.componentInstance
+      cmp.directive.show()
+      fixture.detectChanges()
+      expect(cmp.directive.isShown).toBeFalse()
+    })
+  })
+
+  // TODO complete tests for FixedMouseContextualContainerDirective
+})
\ No newline at end of file
diff --git a/src/util/directives/FixedMouseContextualContainerDirective.directive.ts b/src/util/directives/FixedMouseContextualContainerDirective.directive.ts
index bf2293466e960dd98bb05020759f9ab0ddce9e8f..d7fbf0905efa08166e8f864f45cf375a97950102 100644
--- a/src/util/directives/FixedMouseContextualContainerDirective.directive.ts
+++ b/src/util/directives/FixedMouseContextualContainerDirective.directive.ts
@@ -20,7 +20,7 @@ export class FixedMouseContextualContainerDirective implements AfterContentCheck
   public onHide: EventEmitter<null> = new EventEmitter()
 
   constructor(
-    private el: ElementRef,
+    public el: ElementRef,
     private cdr: ChangeDetectorRef,
   ) {
   }
@@ -43,6 +43,9 @@ export class FixedMouseContextualContainerDirective implements AfterContentCheck
   }
 
   ngAfterContentChecked(){
+    if (this.el.nativeElement.childElementCount === 0) {
+      this.hide()
+    }
     this.recalculatePosition()
     this.cdr.markForCheck()
   }
diff --git a/src/util/directives/captureClickListener.directive.ts b/src/util/directives/captureClickListener.directive.ts
index e10bb4dc96c32389868b75b986556aae7d7e04ba..c432afde0a1b8aac18960e1e4a05b3cc509269ed 100644
--- a/src/util/directives/captureClickListener.directive.ts
+++ b/src/util/directives/captureClickListener.directive.ts
@@ -1,6 +1,6 @@
 import { Directive, ElementRef, EventEmitter, OnDestroy, OnInit, Output, Input, Inject } from "@angular/core";
 import { fromEvent, Subscription } from "rxjs";
-import { switchMapTo, takeUntil } from "rxjs/operators";
+import { switchMapTo, takeUntil, filter } from "rxjs/operators";
 import { DOCUMENT } from "@angular/common";
 
 @Directive({
@@ -43,7 +43,7 @@ export class CaptureClickListenerDirective implements OnInit, OnDestroy {
         ),
       ).subscribe(event => {
         this.mapClicked.emit(event)
-      }),
+      })
     )
   }
 
diff --git a/src/util/directives/elementOutClick.directive.ts b/src/util/directives/elementOutClick.directive.ts
index a690c8d6524aff6e43154f2078a90a384afb160f..93f3b1d64a66ac2c3a400e30c36fed474cbe26b4 100644
--- a/src/util/directives/elementOutClick.directive.ts
+++ b/src/util/directives/elementOutClick.directive.ts
@@ -1,19 +1,22 @@
 import {Directive, ElementRef, EventEmitter, HostListener, Output} from "@angular/core";
 
 @Directive({
-  selector: '[elementOutClick]',
+  selector: '[iav-onclick-outside]',
 })
 export class ElementOutClickDirective {
   constructor(private elRef: ElementRef) { }
 
-    @Output() public outsideClick = new EventEmitter()
+  @Output('iav-onclick-outside')
+  public outsideClick = new EventEmitter()
 
-    @HostListener('document:click', ['$event', '$event.target'])
-    public onclick(event: MouseEvent, targetElement: HTMLElement): void {
-      if (!targetElement) {
-        return
-      }
-
-      this.outsideClick.emit(!this.elRef.nativeElement.contains(targetElement))
+  @HostListener('document:click', ['$event', '$event.target'])
+  public onclick(event: MouseEvent, targetElement: HTMLElement): void {
+    if (!targetElement) {
+      return
+    }
+    if (this.elRef.nativeElement.contains(targetElement)) {
+      return
     }
+    this.outsideClick.emit(event)
+  }
 }
diff --git a/src/util/directives/switch.directive.ts b/src/util/directives/switch.directive.ts
new file mode 100644
index 0000000000000000000000000000000000000000..adcb6a707b8c34109811b77ff23b233cc18f265b
--- /dev/null
+++ b/src/util/directives/switch.directive.ts
@@ -0,0 +1,21 @@
+import { Directive, Input } from "@angular/core";
+
+@Directive({
+  selector: '[iav-switch]',
+  exportAs: 'iavSwitch'
+})
+export class SwitchDirective{
+  @Input('iav-switch-initstate') switchState: boolean = false
+  
+  toggle(){
+    this.switchState = !this.switchState
+  }
+
+  close(){
+    this.switchState = false
+  }
+
+  open(){
+    this.switchState = true
+  }
+}
\ No newline at end of file
diff --git a/src/util/pipes/addUnitAndJoin.pipe.ts b/src/util/pipes/addUnitAndJoin.pipe.ts
new file mode 100644
index 0000000000000000000000000000000000000000..000e245daa5f2f949c6f3e351be48c08c757a4e1
--- /dev/null
+++ b/src/util/pipes/addUnitAndJoin.pipe.ts
@@ -0,0 +1,12 @@
+import { Pipe, PipeTransform } from "@angular/core";
+
+@Pipe({
+  name: 'addUnitAndJoin',
+  pure: true
+})
+
+export class AddUnitAndJoin implements PipeTransform{
+  public transform(arr: (string | number)[], unit: string, separator: string = ', '): string {
+    return arr.map(v => `${v}${unit}`).join(separator)
+  }
+}
\ No newline at end of file
diff --git a/src/util/pipes/numbers.pipe.ts b/src/util/pipes/numbers.pipe.ts
new file mode 100644
index 0000000000000000000000000000000000000000..0390ea90d1a526faa421629fbe01911a5e6832a1
--- /dev/null
+++ b/src/util/pipes/numbers.pipe.ts
@@ -0,0 +1,12 @@
+import { Pipe, PipeTransform } from "@angular/core";
+
+@Pipe({
+  name: 'nmToMm',
+  pure: true
+})
+
+export class NmToMm implements PipeTransform{
+  public transform(nums: number[], decimal: number = 2): number[] {
+    return nums.map(num => (num / 1e6).toFixed(decimal)).map(Number)
+  }
+}
\ No newline at end of file
diff --git a/src/util/util.module.ts b/src/util/util.module.ts
index 0675aa46ccf623dda7b28d0b3e5e34a5351f9740..47d094f5f79dd9dd608ccf816afe3143d9eb49cf 100644
--- a/src/util/util.module.ts
+++ b/src/util/util.module.ts
@@ -8,6 +8,9 @@ import { FilterNullPipe } from "./pipes/filterNull.pipe";
 import { IncludesPipe } from "./pipes/includes.pipe";
 import { SafeResourcePipe } from "./pipes/safeResource.pipe";
 import { CaptureClickListenerDirective } from "./directives/captureClickListener.directive";
+import { AddUnitAndJoin } from "./pipes/addUnitAndJoin.pipe";
+import { NmToMm } from "./pipes/numbers.pipe";
+import { SwitchDirective } from "./directives/switch.directive";
 
 @NgModule({
   declarations: [
@@ -22,6 +25,9 @@ import { CaptureClickListenerDirective } from "./directives/captureClickListener
     IncludesPipe,
     SafeResourcePipe,
     CaptureClickListenerDirective,
+    AddUnitAndJoin,
+    NmToMm,
+    SwitchDirective,
   ],
   exports: [
     FilterNullPipe,
@@ -35,8 +41,9 @@ import { CaptureClickListenerDirective } from "./directives/captureClickListener
     IncludesPipe,
     SafeResourcePipe,
     CaptureClickListenerDirective,
-  ],
-  providers: [
+    AddUnitAndJoin,
+    NmToMm,
+    SwitchDirective,
   ]
 })
 
diff --git a/third_party/catchSyntaxError.js b/third_party/catchSyntaxError.js
new file mode 100644
index 0000000000000000000000000000000000000000..4b6ef2f0d3cc71ef3677c946ff34e390e3052dc4
--- /dev/null
+++ b/third_party/catchSyntaxError.js
@@ -0,0 +1,18 @@
+(() => {
+  window.onerror = e => {
+    if (/^SyntaxError/.test(e)) {
+      console.log('Caught SyntaxError')
+
+      const warning = 'Your browser cannot display the interactive viewer. Please use either Chrome >= 56 and/or Firefox >= 51'
+      console.log(warning)
+      
+      const warningEl = document.createElement('h4')
+      warningEl.innerHTML = warning
+      const el = document.getElementById('iav-inner')
+      while(el.childNodes.length > 0){
+        el.removeChild(el.childNodes[0])
+      }
+      el.appendChild(warningEl)
+    }
+  }
+})()
diff --git a/third_party/export_nehuba/chunk_worker.bundle.js b/third_party/export_nehuba/chunk_worker.bundle.js
deleted file mode 100644
index dca8721f6457e65b9bbfbd0fcc813c0439f27792..0000000000000000000000000000000000000000
--- a/third_party/export_nehuba/chunk_worker.bundle.js
+++ /dev/null
@@ -1,782 +0,0 @@
-/*
-
- 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 2018 Google Inc.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- Copyright 2017 Google Inc.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- Copyright 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.
-*/
-var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(p,e,m){p!=Array.prototype&&p!=Object.prototype&&(p[e]=m.value)};$jscomp.getGlobal=function(p){return"undefined"!=typeof window&&window===p?p:"undefined"!=typeof global&&null!=global?global:p};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
-$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(p){return $jscomp.SYMBOL_PREFIX+(p||"")+$jscomp.symbolCounter_++};
-$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var p=$jscomp.global.Symbol.iterator;p||(p=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[p]&&$jscomp.defineProperty(Array.prototype,p,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(p){var e=0;return $jscomp.iteratorPrototype(function(){return e<p.length?{done:!1,value:p[e++]}:{done:!0}})};
-$jscomp.iteratorPrototype=function(p){$jscomp.initSymbolIterator();p={next:p};p[$jscomp.global.Symbol.iterator]=function(){return this};return p};$jscomp.makeIterator=function(p){$jscomp.initSymbolIterator();$jscomp.initSymbol();$jscomp.initSymbolIterator();var e=p[Symbol.iterator];return e?e.call(p):$jscomp.arrayIterator(p)};$jscomp.arrayFromIterator=function(p){for(var e,m=[];!(e=p.next()).done;)m.push(e.value);return m};$jscomp.arrayFromIterable=function(p){return p instanceof Array?p:$jscomp.arrayFromIterator($jscomp.makeIterator(p))};
-$jscomp.owns=function(p,e){return Object.prototype.hasOwnProperty.call(p,e)};$jscomp.polyfill=function(p,e,m,k){if(e){m=$jscomp.global;p=p.split(".");for(k=0;k<p.length-1;k++){var f=p[k];f in m||(m[f]={});m=m[f]}p=p[p.length-1];k=m[p];e=e(k);e!=k&&null!=e&&$jscomp.defineProperty(m,p,{configurable:!0,writable:!0,value:e})}};
-$jscomp.polyfill("WeakMap",function(p){function e(a){$jscomp.owns(a,k)||$jscomp.defineProperty(a,k,{value:{}})}function m(a){var b=Object[a];b&&(Object[a]=function(a){e(a);return b(a)})}if(function(){if(!p||!Object.seal)return!1;try{var a=Object.seal({}),b=Object.seal({}),c=new p([[a,2],[b,3]]);if(2!=c.get(a)||3!=c.get(b))return!1;c.delete(a);c.set(b,4);return!c.has(a)&&4==c.get(b)}catch(n){return!1}}())return p;var k="$jscomp_hidden_"+Math.random().toString().substring(2);m("freeze");m("preventExtensions");
-m("seal");var f=0,c=function(a){this.id_=(f+=Math.random()+1).toString();if(a){$jscomp.initSymbol();$jscomp.initSymbolIterator();a=$jscomp.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}};c.prototype.set=function(a,b){e(a);if(!$jscomp.owns(a,k))throw Error("WeakMap key fail: "+a);a[k][this.id_]=b;return this};c.prototype.get=function(a){return $jscomp.owns(a,k)?a[k][this.id_]:void 0};c.prototype.has=function(a){return $jscomp.owns(a,k)&&$jscomp.owns(a[k],this.id_)};c.prototype.delete=
-function(a){return $jscomp.owns(a,k)&&$jscomp.owns(a[k],this.id_)?delete a[k][this.id_]:!1};return c},"es6","es3");$jscomp.MapEntry=function(){};
-$jscomp.polyfill("Map",function(p){if(!$jscomp.ASSUME_NO_NATIVE_MAP&&function(){if(!p||!p.prototype.entries||"function"!=typeof Object.seal)return!1;try{var a=Object.seal({x:4}),c=new p($jscomp.makeIterator([[a,"s"]]));if("s"!=c.get(a)||1!=c.size||c.get({x:4})||c.set({x:4},"t")!=c||2!=c.size)return!1;var n=c.entries(),l=n.next();if(l.done||l.value[0]!=a||"s"!=l.value[1])return!1;l=n.next();return l.done||4!=l.value[0].x||"t"!=l.value[1]||!n.next().done?!1:!0}catch(g){return!1}}())return p;$jscomp.initSymbol();
-$jscomp.initSymbolIterator();var e=new WeakMap,m=function(a){this.data_={};this.head_=c();this.size=0;if(a){a=$jscomp.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}};m.prototype.set=function(a,c){var b=k(this,a);b.list||(b.list=this.data_[b.id]=[]);b.entry?b.entry.value=c:(b.entry={next:this.head_,previous:this.head_.previous,head:this.head_,key:a,value:c},b.list.push(b.entry),this.head_.previous.next=b.entry,this.head_.previous=b.entry,this.size++);return this};m.prototype.delete=
-function(a){a=k(this,a);return a.entry&&a.list?(a.list.splice(a.index,1),a.list.length||delete this.data_[a.id],a.entry.previous.next=a.entry.next,a.entry.next.previous=a.entry.previous,a.entry.head=null,this.size--,!0):!1};m.prototype.clear=function(){this.data_={};this.head_=this.head_.previous=c();this.size=0};m.prototype.has=function(a){return!!k(this,a).entry};m.prototype.get=function(a){return(a=k(this,a).entry)&&a.value};m.prototype.entries=function(){return f(this,function(a){return[a.key,
-a.value]})};m.prototype.keys=function(){return f(this,function(a){return a.key})};m.prototype.values=function(){return f(this,function(a){return a.value})};m.prototype.forEach=function(a,c){for(var b=this.entries(),d;!(d=b.next()).done;)d=d.value,a.call(c,d[1],d[0],this)};m.prototype[Symbol.iterator]=m.prototype.entries;var k=function(b,c){var d=c&&typeof c;"object"==d||"function"==d?e.has(c)?d=e.get(c):(d=""+ ++a,e.set(c,d)):d="p_"+c;var l=b.data_[d];if(l&&$jscomp.owns(b.data_,d))for(b=0;b<l.length;b++){var g=
-l[b];if(c!==c&&g.key!==g.key||c===g.key)return{id:d,list:l,index:b,entry:g}}return{id:d,list:l,index:-1,entry:void 0}},f=function(a,c){var b=a.head_;return $jscomp.iteratorPrototype(function(){if(b){for(;b.head!=a.head_;)b=b.previous;for(;b.next!=b.head;)return b=b.next,{done:!1,value:c(b)};b=null}return{done:!0,value:void 0}})},c=function(){var a={};return a.previous=a.next=a.head=a},a=0;return m},"es6","es3");
-$jscomp.iteratorFromArray=function(p,e){$jscomp.initSymbolIterator();p instanceof String&&(p+="");var m=0,k={next:function(){if(m<p.length){var f=m++;return{value:e(f,p[f]),done:!1}}k.next=function(){return{done:!0,value:void 0}};return k.next()}};k[Symbol.iterator]=function(){return k};return k};$jscomp.polyfill("Array.prototype.values",function(p){return p?p:function(){return $jscomp.iteratorFromArray(this,function(e,m){return m})}},"es6","es3");
-$jscomp.polyfill("Number.isNaN",function(p){return p?p:function(e){return"number"===typeof e&&isNaN(e)}},"es6","es3");$jscomp.polyfill("Number.isFinite",function(p){return p?p:function(e){return"number"!==typeof e?!1:!isNaN(e)&&Infinity!==e&&-Infinity!==e}},"es6","es3");$jscomp.polyfill("Array.prototype.keys",function(p){return p?p:function(){return $jscomp.iteratorFromArray(this,function(e){return e})}},"es6","es3");
-$jscomp.polyfill("Number.isInteger",function(p){return p?p:function(e){return Number.isFinite(e)?e===Math.floor(e):!1}},"es6","es3");$jscomp.polyfill("Array.from",function(p){return p?p:function(e,m,k){$jscomp.initSymbolIterator();m=null!=m?m:function(a){return a};var f=[],c=e[Symbol.iterator];if("function"==typeof c)for(e=c.call(e);!(c=e.next()).done;)f.push(m.call(k,c.value));else{c=e.length;for(var a=0;a<c;a++)f.push(m.call(k,e[a]))}return f}},"es6","es3");
-$jscomp.checkStringArgs=function(p,e,m){if(null==p)throw new TypeError("The 'this' value for String.prototype."+m+" must not be null or undefined");if(e instanceof RegExp)throw new TypeError("First argument to String.prototype."+m+" must not be a regular expression");return p+""};
-$jscomp.polyfill("String.prototype.startsWith",function(p){return p?p:function(e,m){var k=$jscomp.checkStringArgs(this,e,"startsWith");e+="";var f=k.length,c=e.length;m=Math.max(0,Math.min(m|0,k.length));for(var a=0;a<c&&m<f;)if(k[m++]!=e[a++])return!1;return a>=c}},"es6","es3");$jscomp.polyfill("Math.log2",function(p){return p?p:function(e){return Math.log(e)/Math.LN2}},"es6","es3");
-$jscomp.polyfill("String.prototype.repeat",function(p){return p?p:function(e){var m=$jscomp.checkStringArgs(this,null,"repeat");if(0>e||1342177279<e)throw new RangeError("Invalid count value");e|=0;for(var k="";e;)if(e&1&&(k+=m),e>>>=1)m+=m;return k}},"es6","es3");
-$jscomp.polyfill("Set",function(p){if(!$jscomp.ASSUME_NO_NATIVE_SET&&function(){if(!p||!p.prototype.entries||"function"!=typeof Object.seal)return!1;try{var e=Object.seal({x:4}),k=new p($jscomp.makeIterator([e]));if(!k.has(e)||1!=k.size||k.add(e)!=k||1!=k.size||k.add({x:4})!=k||2!=k.size)return!1;var f=k.entries(),c=f.next();if(c.done||c.value[0]!=e||c.value[1]!=e)return!1;c=f.next();return c.done||c.value[0]==e||4!=c.value[0].x||c.value[1]!=c.value[0]?!1:f.next().done}catch(a){return!1}}())return p;
-$jscomp.initSymbol();$jscomp.initSymbolIterator();var e=function(e){this.map_=new Map;if(e){e=$jscomp.makeIterator(e);for(var k;!(k=e.next()).done;)this.add(k.value)}this.size=this.map_.size};e.prototype.add=function(e){this.map_.set(e,e);this.size=this.map_.size;return this};e.prototype.delete=function(e){e=this.map_.delete(e);this.size=this.map_.size;return e};e.prototype.clear=function(){this.map_.clear();this.size=0};e.prototype.has=function(e){return this.map_.has(e)};e.prototype.entries=function(){return this.map_.entries()};
-e.prototype.values=function(){return this.map_.values()};e.prototype.keys=e.prototype.values;e.prototype[Symbol.iterator]=e.prototype.values;e.prototype.forEach=function(e,k){var f=this;this.map_.forEach(function(c){return e.call(k,c,c,f)})};return e},"es6","es3");$jscomp.FORCE_POLYFILL_PROMISE=!1;
-$jscomp.polyfill("Promise",function(p){function e(){this.batch_=null}function m(a){return a instanceof f?a:new f(function(b,c){b(a)})}if(p&&!$jscomp.FORCE_POLYFILL_PROMISE)return p;e.prototype.asyncExecute=function(a){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(a);return this};e.prototype.asyncExecuteBatch_=function(){var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})};var k=$jscomp.global.setTimeout;e.prototype.asyncExecuteFunction=function(a){k(a,
-0)};e.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=this.batch_;this.batch_=[];for(var b=0;b<a.length;++b){var c=a[b];delete a[b];try{c()}catch(n){this.asyncThrow_(n)}}}this.batch_=null};e.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var f=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(d){b.reject(d)}};f.prototype.createResolveAndReject_=
-function(){function a(a){return function(d){c||(c=!0,a.call(b,d))}}var b=this,c=!1;return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};f.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof f)this.settleSameAsPromise_(a);else{a:switch(typeof a){case "object":var b=null!=a;break a;case "function":b=!0;break a;default:b=!1}b?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};f.prototype.resolveToNonPromiseObj_=function(a){var b=
-void 0;try{b=a.then}catch(d){this.reject_(d);return}"function"==typeof b?this.settleSameAsThenable_(b,a):this.fulfill_(a)};f.prototype.reject_=function(a){this.settle_(2,a)};f.prototype.fulfill_=function(a){this.settle_(1,a)};f.prototype.settle_=function(a,b){if(0!=this.state_)throw Error("Cannot settle("+a+", "+b|"): Promise already settled in state"+this.state_);this.state_=a;this.result_=b;this.executeOnSettledCallbacks_()};f.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=
-this.onSettledCallbacks_,b=0;b<a.length;++b)a[b].call(),a[b]=null;this.onSettledCallbacks_=null}};var c=new e;f.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};f.prototype.settleSameAsThenable_=function(a,b){var c=this.createResolveAndReject_();try{a.call(b,c.resolve,c.reject)}catch(n){c.reject(n)}};f.prototype.then=function(a,b){function c(a,b){return"function"==typeof a?function(b){try{n(a(b))}catch(h){l(h)}}:b}var n,l,g=new f(function(a,
-b){n=a;l=b});this.callWhenSettled_(c(a,n),c(b,l));return g};f.prototype.catch=function(a){return this.then(void 0,a)};f.prototype.callWhenSettled_=function(a,b){function d(){switch(n.state_){case 1:a(n.result_);break;case 2:b(n.result_);break;default:throw Error("Unexpected state: "+n.state_);}}var n=this;null==this.onSettledCallbacks_?c.asyncExecute(d):this.onSettledCallbacks_.push(function(){c.asyncExecute(d)})};f.resolve=m;f.reject=function(a){return new f(function(b,c){c(a)})};f.race=function(a){return new f(function(b,
-c){for(var d=$jscomp.makeIterator(a),l=d.next();!l.done;l=d.next())m(l.value).callWhenSettled_(b,c)})};f.all=function(a){var b=$jscomp.makeIterator(a),c=b.next();return c.done?m([]):new f(function(a,d){function g(b){return function(c){r[b]=c;l--;0==l&&a(r)}}var r=[],l=0;do r.push(void 0),l++,m(c.value).callWhenSettled_(g(r.length-1),d),c=b.next();while(!c.done)})};return f},"es6","es3");
-$jscomp.polyfill("Object.assign",function(p){return p?p:function(e,m){for(var k=1;k<arguments.length;k++){var f=arguments[k];if(f)for(var c in f)$jscomp.owns(f,c)&&(e[c]=f[c])}return e}},"es6","es3");$jscomp.polyfill("Array.prototype.entries",function(p){return p?p:function(){return $jscomp.iteratorFromArray(this,function(e,m){return[e,m]})}},"es6","es3");
-$jscomp.polyfill("Array.prototype.fill",function(p){return p?p:function(e,m,k){var f=this.length||0;0>m&&(m=Math.max(0,f+m));if(null==k||k>f)k=f;k=Number(k);0>k&&(k=Math.max(0,f+k));for(m=Number(m||0);m<k;m++)this[m]=e;return this}},"es6","es3");
-$jscomp.polyfill("Array.prototype.copyWithin",function(p){return p?p:function(e,m,k){var f=this.length;e=Number(e);m=Number(m);k=Number(null!=k?k:f);if(e<m)for(k=Math.min(k,f);m<k;)m in this?this[e++]=this[m++]:(delete this[e++],m++);else for(k=Math.min(k,f+m-e),e+=k-m;k>m;)--k in this?this[--e]=this[k]:delete this[e];return this}},"es6","es3");
-(function(p,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports.exportNehuba=e():p.exportNehuba=e()})("undefined"!==typeof self?self:this,function(){return function(p){function e(k){if(m[k])return m[k].exports;var f=m[k]={i:k,l:!1,exports:{}};p[k].call(f.exports,f,f.exports,e);f.l=!0;return f.exports}var m={};e.m=p;e.c=m;e.d=function(k,f,c){e.o(k,f)||Object.defineProperty(k,f,{configurable:!1,
-enumerable:!0,get:c})};e.n=function(k){var f=k&&k.__esModule?function(){return k["default"]}:function(){return k};e.d(f,"a",f);return f};e.o=function(k,f){return Object.prototype.hasOwnProperty.call(k,f)};e.p="";return e(e.s=54)}([function(p,e,m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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 c(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){r.set(a,b)}function b(a,b,c){c=void 0===c?{}:c;null!=b&&a.initializeSharedObject(b,c.id)}e.f=a;e.e=function(b,c){a(b,function(a){var b=this,t=a.id,h=new d.b;a=c.call(this,
-a,h);this.set(t,{promise:a,cancellationToken:h});a.then(function(a){var q=a.value;a=a.transfers;b.delete(t);b.invoke("rpc.promise.response",{id:t,value:q},a)},function(a){b.delete(t);b.invoke("rpc.promise.response",{id:t,error:a.message,errorName:a.name})})})};m.d(e,"a",function(){return h});m.d(e,"b",function(){return B});e.d=b;m.d(e,"c",function(){return I});e.h=function(a){return function(b){b.prototype.RPC_TYPE_ID=a}};e.g=function(a){return function(b){if(void 0!==a)b.prototype.RPC_TYPE_ID=a;
-else if(a=b.prototype.RPC_TYPE_ID,void 0===a)throw Error("RPC_TYPE_ID should have already been defined");u.set(a,b)}};var d=m(12);p=m(13);var n=function J(a,b,c){null===a&&(a=Function.prototype);var t=Object.getOwnPropertyDescriptor(a,b);if(void 0===t){if(a=Object.getPrototypeOf(a),null!==a)return J(a,b,c)}else{if("value"in t)return t.value;b=t.get;return void 0===b?void 0:b.call(c)}},l=function(){function a(a,b){for(var c=0;c<b.length;c++){var h=b[c];h.enumerable=h.enumerable||!1;h.configurable=
-!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}return function(b,c,h){c&&a(b.prototype,c);h&&a(b,h);return b}}(),g=!("undefined"!==typeof Window&&self instanceof Window),r=new Map,C=function(a){function b(a,c){k(this,b);var h=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,c));h.name=a;h.message=c;return h}c(b,a);return b}(Error);a("rpc.promise.cancel",function(a){this.get(a.id).cancellationToken.cancel()});a("rpc.promise.response",function(a){var b=a.id,c=this.get(b),
-h=c.resolve;c=c.reject;this.delete(b);a.hasOwnProperty("value")?h(a.value):a.errorName===d.a.name?c(d.a):c(new C(a.errorName,a.error))});var w=g?-1:0,h=function(){function a(b){var c=this;k(this,a);this.target=b;this.objects=new Map;this.nextId=w;b.onmessage=function(a){a=a.data;r.get(a.functionName).call(c,a)}}l(a,[{key:"set",value:function(a,b){this.objects.set(a,b)}},{key:"delete",value:function(a){this.objects.delete(a)}},{key:"get",value:function(a){return this.objects.get(a)}},{key:"getRef",
-value:function(a){var b=this.get(a.id);b.referencedGeneration=a.gen;b.addRef();return b}},{key:"invoke",value:function(a,b,c){b.functionName=a;this.target.postMessage(b,c)}},{key:"promiseInvoke",value:function(a,b,c,h){var t=this;c=void 0===c?d.e:c;return Object(d.d)(c,function(c,g,d){var q=b.id=t.newId();t.set(q,{resolve:c,reject:g});t.invoke(a,b,h);d.add(function(){t.invoke("rpc.promise.cancel",{id:q})})})}},{key:"newId",value:function(){return g?this.nextId--:this.nextId++}},{key:"numObjects",
-get:function(){return this.objects.size}}]);return a}(),B=function(a){function b(){k(this,b);var a=f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.rpc=null;a.rpcId=null;return a}c(b,a);l(b,[{key:"initializeSharedObject",value:function(a,b){b=void 0===b?a.newId():b;this.rpc=a;this.rpcId=b;this.isOwner=!1;a.set(b,this)}},{key:"initializeCounterpart",value:function(a,b){b=void 0===b?{}:b;this.initializeSharedObject(a);this.referencedGeneration=this.unreferencedGeneration=0;this.isOwner=
-!0;b.id=this.rpcId;b.type=this.RPC_TYPE_ID;a.invoke("SharedObject.new",b)}},{key:"dispose",value:function(){n(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"dispose",this).call(this)}},{key:"addCounterpartRef",value:function(){return{id:this.rpcId,gen:++this.referencedGeneration}}},{key:"refCountReachedZero",value:function(){!0===this.isOwner?this.referencedGeneration===this.unreferencedGeneration&&this.ownerDispose():!1===this.isOwner?this.rpc.invoke("SharedObject.refCountReachedZero",
-{id:this.rpcId,gen:this.referencedGeneration}):n(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"refCountReachedZero",this).call(this)}},{key:"ownerDispose",value:function(){var a=this.rpc,c=this.rpcId;n(b.prototype.__proto__||Object.getPrototypeOf(b.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 b}(p.a),I=function(a){function h(a,c){c=void 0===c?{}:c;k(this,h);var g=f(this,(h.__proto__||Object.getPrototypeOf(h)).call(this));b(g,a,c);return g}c(h,a);return h}(B);a("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});a("SharedObject.refCountReachedZero",function(a){this.get(a.id).counterpartRefCountReachedZero(a.gen)});
-var u=new Map;a("SharedObject.new",function(a){--(new (u.get(a.type))(this,a)).refCount})},function(p,e,m){function k(a,c){var b=Math.abs(a[c]),d=Math.abs(a[c+1]),g=Math.abs(a[c+2]),r=Math.max(b,d,g);1E-4>b/r&&(a[c]=0);1E-4>d/r&&(a[c+1]=0);1E-4>g/r&&(a[c+2]=0)}function f(b){b=b.and(a[0]);for(var c=1;c<a.length;++c)b=b.xor(b.rshift(Math.pow(2,c))).and(a[c]);return b}e.i=function(a){return a[0]*a[1]*a[2]};e.n=function(a){return a[0]+","+a[1]+","+a[2]};e.k=function(a){k(a,0);k(a,4);k(a,8)};e.l=function(a,
-c,n){var b=c[0],g=c[1];c=c[2];a[0]=n[0]*b+n[4]*g+n[8]*c;a[1]=n[1]*b+n[5]*g+n[9]*c;a[2]=n[2]*b+n[6]*g+n[10]*c;return a};e.b=function(a,c){var b=c[0],l=c[1],g=c[2],r=c[4],d=c[5],w=c[6],h=c[8],B=c[9];c=c[10];a[0]=Math.sqrt(b*b+l*l+g*g);a[1]=Math.sqrt(r*r+d*d+w*w);a[2]=Math.sqrt(h*h+B*B+c*c);return a};e.a=function(a){if(a.high)throw Error("Fragment ids >= 2^32 not supported yet");var b=f(a.rshift(0)),n=f(a.rshift(1));a=f(a.rshift(2));return c.c.clone([b.low,n.low,a.low])};var c=m(32);p=m(5);m.d(e,"h",
-function(){return c.a});m.d(e,"j",function(){return c.b});m.d(e,"m",function(){return c.c});m=c.a.create();e.c=m;m=[c.c.fromValues(1,0,0),c.c.fromValues(0,1,0),c.c.fromValues(0,0,1)];e.d=m;m=c.c.fromValues(0,0,0);e.g=m;m=c.c.fromValues(1,1,1);e.f=m;m=c.c.fromValues(Infinity,Infinity,Infinity);e.e=m;c.b.create();var a=[new p.a(1227133513,306783378),new p.a(3272356035,818089008),new p.a(251719695,4027515120),new p.a(4278190335,16711680),new p.a(65535,16711680),new p.a(2097151,0)]},function(p,e,m){function k(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 f(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){if(!(a instanceof
-b))throw new TypeError("Cannot call a class as a function");}function a(a){var b=a.downloadCancellationToken=new l.b;a.source.download(a,b).then(function(){a.downloadCancellationToken===b&&(a.downloadCancellationToken=void 0,a.downloadSucceeded())},function(c){a.downloadCancellationToken===b&&(a.downloadCancellationToken=void 0,a.downloadFailed(c),console.log("Error retrieving chunk "+a+": "+c))})}function b(a){return new t(new h.a(a),r.a)}function d(a,b,c,q,h,g){for(;1>b.availableItems||b.availableSize<
-a;){var t=h.next().value;if(void 0===t)return!1;var r=t.priorityTier;if(r<c||r===c&&t.priority>=q)return!1;g(t)}return!0}Object.defineProperty(e,"__esModule",{value:!0});m.d(e,"Chunk",function(){return J});m.d(e,"ChunkSourceBase",function(){return v});m.d(e,"ChunkSource",function(){return A});m.d(e,"ChunkQueueManager",function(){return H});m.d(e,"ChunkManager",function(){return q});e.WithParameters=function(a,b){a=function(a){function b(a){for(var q=[],h=0;h<arguments.length;++h)q[h-0]=arguments[h];
-c(this,b);var g;h=k(this,(g=b.__proto__||Object.getPrototypeOf(b)).call.apply(g,[].concat([this],$jscomp.arrayFromIterable(q))));h.parameters=q[1].parameters;return h}f(b,a);return b}(a);return a=x([Object(I.h)(b.RPC_ID)],a)};e.withChunkManager=function(a){return function(a){function b(a){for(var q=[],h=0;h<arguments.length;++h)q[h-0]=arguments[h];c(this,b);var g;h=k(this,(g=b.__proto__||Object.getPrototypeOf(b)).call.apply(g,[].concat([this],$jscomp.arrayFromIterable(q))));h.chunkManager=q[0].get(q[1].chunkManager);
-return h}f(b,a);return b}(a)};var n=m(7),l=m(12);p=m(13);var g=m(56),r=m(57),C=m(31),w=m(63),h=m(64),B=m(8),I=m(0),u=function(){function a(a,b){for(var c=0;c<b.length;c++){var q=b[c];q.enumerable=q.enumerable||!1;q.configurable=!0;"value"in q&&(q.writable=!0);Object.defineProperty(a,q.key,q)}}return function(b,c,q){c&&a(b.prototype,c);q&&a(b,q);return b}}(),x=this&&this.__decorate||function(a,b,c,q){var h=arguments.length,g=3>h?b:null===q?q=Object.getOwnPropertyDescriptor(b,c):q,t;if("object"===typeof Reflect&&
-"function"===typeof Reflect.decorate)g=Reflect.decorate(a,b,c,q);else for(var r=a.length-1;0<=r;r--)if(t=a[r])g=(3>h?t(g):3<h?t(b,c,g):t(b,c))||g;return 3<h&&g&&Object.defineProperty(b,c,g),g},J=function(){function a(){c(this,a);this.key=this.source=this.prev1=this.next1=this.child1=this.prev0=this.next0=this.child0=null;this.state=n.e.NEW;this.error=null;this.newPriority=this.priority=0;this.newPriorityTier=this.priorityTier=n.d.RECENT;this.backendOnly=!1;this.downloadCancellationToken=void 0}u(a,
-[{key:"initialize",value:function(a){this.key=a;this.state=n.e.NEW;this.priority=Number.NEGATIVE_INFINITY;this.priorityTier=n.d.RECENT;this.newPriority=Number.NEGATIVE_INFINITY;this.newPriorityTier=n.d.RECENT;this.error=null}},{key:"updatePriorityProperties",value:function(){this.priorityTier=this.newPriorityTier;this.priority=this.newPriority;this.newPriorityTier=n.d.RECENT;this.newPriority=Number.NEGATIVE_INFINITY}},{key:"dispose",value:function(){this.error=this.source=null}},{key:"downloadFailed",
-value:function(a){this.error=a;this.queueManager.updateChunkState(this,n.e.FAILED)}},{key:"downloadSucceeded",value:function(){this.queueManager.updateChunkState(this,n.e.SYSTEM_MEMORY_WORKER)}},{key:"freeSystemMemory",value:function(){}},{key:"serialize",value:function(a,b){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,b){return a.priority<b.priority}},{key:"priorityGreater",value:function(a,b){return a.priority>b.priority}}]);return a}(),v=function(a){function b(a){c(this,b);var q=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));q.chunkManager=a;q.chunks=new Map;q.freeChunks=[];return q}f(b,a);u(b,[{key:"getNewChunk_",value:function(a){var b=this.freeChunks,c=b.length;if(0<c)return a=b[c-1],b.length=c-1,a.source=this,a;b=new a;b.source=this;return b}},{key:"addChunk",
-value:function(a){var b=this.chunks;0===b.size&&this.addRef();b.set(a.key,a)}},{key:"removeChunk",value:function(a){var b=this.chunks,c=this.freeChunks;b.delete(a.key);a.dispose();c[c.length]=a;0===b.size&&this.dispose()}}]);return b}(I.b),A=function(a){function b(a,q){c(this,b);var h=a.get(q.chunkManager);h=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,h));Object(I.d)(h,a,q);return h}f(b,a);return b}(v),t=function(){function a(b,q){c(this,a);this.heapOperations=b;this.linkedListOperations=
-q;this.heapRoots=[null,null];this.recentHead=new J;q.initializeHead(this.recentHead)}u(a,[{key:"add",value:function(a){var b=a.priorityTier;if(b===n.d.RECENT)this.linkedListOperations.insertAfter(this.recentHead,a);else{var c=this.heapRoots;c[b]=this.heapOperations.meld(c[b],a)}}},{key:"candidates",value:function(){function a(a,G){for(;;)switch(b){case 0:if(I.heapOperations.compare!==J.priorityLess){b=1;break}e=I;k=e.linkedListOperations;f=e.recentHead;case 3:z=k.back(f);if(null!=z){b=5;break}b=4;
-break;case 5:return b=7,{value:z,done:!1};case 7:if(void 0===G){b=8;break}b=-1;throw G;case 8:case 6:b=3;break;case 4:B=I,C=B.heapRoots,w=n.d.LAST_ORDERED_TIER;case 9:if(!(w>=n.d.FIRST_ORDERED_TIER)){b=11;break}case 12:d=C[w];if(null!=d){b=14;break}b=13;break;case 14:return b=16,{value:d,done:!1};case 16:if(void 0===G){b=17;break}b=-1;throw G;case 17:case 15:b=12;break;case 13:case 10:--w;b=9;break;case 11:b=2;break;case 1:l=I.heapRoots,r=n.d.FIRST_ORDERED_TIER;case 18:if(!(r<=n.d.LAST_ORDERED_TIER)){b=
-20;break}case 21:t=l[r];if(null!=t){b=23;break}b=22;break;case 23:return b=25,{value:t,done:!1};case 25:if(void 0===G){b=26;break}b=-1;throw G;case 26:case 24:b=21;break;case 22:case 19:++r;b=18;break;case 20:g=I,h=g.linkedListOperations,q=g.recentHead;case 27:c=h.front(q);if(null!=c){b=29;break}b=28;break;case 29:return b=31,{value:c,done:!1};case 31:if(void 0===G){b=32;break}b=-1;throw G;case 32:case 30:b=27;break;case 28:case 2:b=-1;default:return{value:void 0,done:!0}}}var b=0,c,q,h,g,t,r,l,d,
-w,C,B,z,f,k,e,I=this,G={next:function(b){return a(b,void 0)},throw:function(b){return a(void 0,b)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();G[Symbol.iterator]=function(){return this};return G}},{key:"delete",value:function(a){var b=a.priorityTier;if(b===n.d.RECENT)this.linkedListOperations.pop(a);else{var c=this.heapRoots;c[b]=this.heapOperations.remove(c[b],a)}}}]);return a}(),z=function(a){function b(a,q){c(this,b);var h=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));
-h.itemLimit=a;h.sizeLimit=q;h.currentSize=0;h.currentItems=0;h.capacityChanged=new B.a;h.registerDisposer(a.changed.add(h.capacityChanged.dispatch));h.registerDisposer(q.changed.add(h.capacityChanged.dispatch));return h}f(b,a);u(b,[{key:"adjust",value:function(a,b){this.currentItems-=a;this.currentSize-=b}},{key:"availableSize",get:function(){return this.sizeLimit.value-this.currentSize}},{key:"availableItems",get:function(){return this.itemLimit.value-this.currentItems}}]);return b}(p.a),H=function(q){function h(a,
-q){c(this,h);var r=k(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,a,q));r.queuedPromotionQueue=b(J.priorityGreater);r.downloadEvictionQueue=b(J.priorityLess);r.systemMemoryEvictionQueue=new t(new w.a(J.priorityLess),g.a);r.gpuMemoryPromotionQueue=b(J.priorityGreater);r.gpuMemoryEvictionQueue=b(J.priorityLess);r.updatePending=null;r.numQueued=0;r.numFailed=0;var l=function(b){b=r.registerDisposer(new z(a.get(b.itemLimit),a.get(b.sizeLimit)));b.capacityChanged.add(function(){return r.scheduleUpdate()});
-return b};r.gpuMemoryCapacity=l(q.gpuMemoryCapacity);r.systemMemoryCapacity=l(q.systemMemoryCapacity);r.downloadCapacity=l(q.downloadCapacity);return r}f(h,q);u(h,[{key:"scheduleUpdate",value:function(){null===this.updatePending&&(this.updatePending=setTimeout(this.process.bind(this),0))}},{key:"chunkQueuesForChunk",value:function(a){function b(b,r){for(;;)switch(c){case 0:h=!1;q=a.state;if(!h&&q!==n.e.QUEUED){c=2;break}h=!0;c=3;return{value:g.queuedPromotionQueue,done:!1};case 3:if(void 0===r){c=
-4;break}c=-1;throw r;case 4:c=1;break;case 2:if(!h&&q!==n.e.DOWNLOADING){c=5;break}h=!0;c=6;return{value:g.downloadEvictionQueue,done:!1};case 6:if(void 0===r){c=7;break}c=-1;throw r;case 7:return c=8,{value:g.systemMemoryEvictionQueue,done:!1};case 8:if(void 0===r){c=9;break}c=-1;throw r;case 9:c=1;break;case 5:if(h||q===n.e.SYSTEM_MEMORY_WORKER)h=!0;if(!h&&q!==n.e.SYSTEM_MEMORY){c=10;break}h=!0;c=11;return{value:g.systemMemoryEvictionQueue,done:!1};case 11:if(void 0===r){c=12;break}c=-1;throw r;
-case 12:if(a.priorityTier===n.d.RECENT||a.backendOnly){c=13;break}c=14;return{value:g.gpuMemoryPromotionQueue,done:!1};case 14:if(void 0===r){c=15;break}c=-1;throw r;case 15:case 13:c=1;break;case 10:if(!h&&q!==n.e.GPU_MEMORY){c=16;break}h=!0;c=17;return{value:g.systemMemoryEvictionQueue,done:!1};case 17:if(void 0===r){c=18;break}c=-1;throw r;case 18:return c=19,{value:g.gpuMemoryEvictionQueue,done:!1};case 19:if(void 0===r){c=20;break}c=-1;throw r;case 20:c=1;break;case 16:case 1:c=-1;default:return{value:void 0,
-done:!0}}}var c=0,q,h,g=this,r={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();r[Symbol.iterator]=function(){return this};return r}},{key:"adjustCapacitiesForChunk",value:function(a,b){b=b?-1:1;switch(a.state){case n.e.FAILED:this.numFailed-=b;break;case n.e.QUEUED:this.numQueued-=b;break;case n.e.DOWNLOADING:this.downloadCapacity.adjust(b,0);this.systemMemoryCapacity.adjust(b,0);break;
-case n.e.SYSTEM_MEMORY:case n.e.SYSTEM_MEMORY_WORKER:this.systemMemoryCapacity.adjust(b,b*a.systemMemoryBytes);break;case n.e.GPU_MEMORY:this.systemMemoryCapacity.adjust(b,b*a.systemMemoryBytes),this.gpuMemoryCapacity.adjust(b,b*a.gpuMemoryBytes)}}},{key:"removeChunkFromQueues_",value:function(a){for(var b=$jscomp.makeIterator(this.chunkQueuesForChunk(a)),c=b.next();!c.done;c=b.next())c.value.delete(a)}},{key:"addChunkToQueues_",value:function(a){if(a.state===n.e.QUEUED&&a.priorityTier===n.d.RECENT)return a.source.removeChunk(a),
-this.adjustCapacitiesForChunk(a,!1),!1;for(var b=$jscomp.makeIterator(this.chunkQueuesForChunk(a)),c=b.next();!c.done;c=b.next())c.value.add(a);return!0}},{key:"performChunkPriorityUpdate",value:function(a){a.priorityTier===a.newPriorityTier&&a.priority===a.newPriority?(a.newPriorityTier=n.d.RECENT,a.newPriority=Number.NEGATIVE_INFINITY):(this.removeChunkFromQueues_(a),a.updatePriorityProperties(),a.state===n.e.NEW&&(a.state=n.e.QUEUED,this.adjustCapacitiesForChunk(a,!0)),this.addChunkToQueues_(a))}},
-{key:"updateChunkState",value:function(a,b){b!==a.state&&(this.adjustCapacitiesForChunk(a,!1),this.removeChunkFromQueues_(a),a.state=b,this.adjustCapacitiesForChunk(a,!0),this.addChunkToQueues_(a),this.scheduleUpdate())}},{key:"processGPUPromotions_",value:function(){function a(a){b.freeChunkGPUMemory(a);a.source.chunkManager.queueManager.updateChunkState(a,n.e.SYSTEM_MEMORY)}for(var b=this,c=this.gpuMemoryPromotionQueue.candidates(),q=this.gpuMemoryEvictionQueue.candidates(),h=this.gpuMemoryCapacity;;){var g=
-c.next().value;if(void 0===g)break;else{if(!d(g.gpuMemoryBytes,h,g.priorityTier,g.priority,q,a))break;this.copyChunkToGPU(g);this.updateChunkState(g,n.e.GPU_MEMORY)}}}},{key:"freeChunkGPUMemory",value:function(a){this.rpc.invoke("Chunk.update",{id:a.key,state:n.e.SYSTEM_MEMORY,source:a.source.rpcId})}},{key:"freeChunkSystemMemory",value:function(a){a.state===n.e.SYSTEM_MEMORY_WORKER?a.freeSystemMemory():this.rpc.invoke("Chunk.update",{id:a.key,state:n.e.EXPIRED,source:a.source.rpcId})}},{key:"copyChunkToGPU",
-value:function(a){var b=this.rpc;if(a.state===n.e.SYSTEM_MEMORY)b.invoke("Chunk.update",{id:a.key,source:a.source.rpcId,state:n.e.GPU_MEMORY});else{var c={},q=[];a.serialize(c,q);c.state=n.e.GPU_MEMORY;b.invoke("Chunk.update",c,q)}}},{key:"processQueuePromotions_",value:function(){for(var b=this,c=this,q=function(a){switch(a.state){case n.e.DOWNLOADING:var q=a.downloadCancellationToken;a.downloadCancellationToken=void 0;q.cancel();break;case n.e.GPU_MEMORY:c.freeChunkGPUMemory(a);case n.e.SYSTEM_MEMORY_WORKER:case n.e.SYSTEM_MEMORY:c.freeChunkSystemMemory(a)}b.updateChunkState(a,
-n.e.QUEUED)},h=this.queuedPromotionQueue.candidates(),g=this.downloadEvictionQueue.candidates(),r=this.systemMemoryEvictionQueue.candidates(),t=this.downloadCapacity,l=this.systemMemoryCapacity;;){var w=h.next();if(w.done)break;w=w.value;var C=w.priorityTier,B=w.priority;if(!d(0,t,C,B,g,q))break;if(!d(0,l,C,B,r,q))break;this.updateChunkState(w,n.e.DOWNLOADING);a(w)}}},{key:"process",value:function(){this.updatePending&&(this.updatePending=null,this.processGPUPromotions_(),this.processQueuePromotions_(),
-this.logStatistics())}},{key:"logStatistics",value:function(){}},{key:"invalidateSourceCache",value:function(a){for(var b=$jscomp.makeIterator(a.chunks.values()),c=b.next();!c.done;c=b.next()){c=c.value;switch(c.state){case n.e.DOWNLOADING:var q=c.downloadCancellationToken;c.downloadCancellationToken=void 0;q.cancel();break;case n.e.SYSTEM_MEMORY_WORKER:c.freeSystemMemory()}this.updateChunkState(c,n.e.QUEUED)}this.rpc.invoke("Chunk.update",{source:a.rpcId});this.scheduleUpdate()}}]);return h}(I.c);
-H=x([Object(I.g)(n.b)],H);var q=function(a){function b(a,q){c(this,b);var h=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,q));h.existingTierChunks=[];h.newTierChunks=[];h.updatePending=null;h.recomputeChunkPriorities=new B.a;h.recomputeChunkPrioritiesLate=new B.a;h.memoize=new C.a;h.queueManager=a.get(q.chunkQueueManager).addRef();for(a=n.d.FIRST_TIER;a<=n.d.LAST_TIER;++a)a!==n.d.RECENT&&(h.existingTierChunks[a]=[]);return h}f(b,a);u(b,[{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.recomputeChunkPrioritiesLate.dispatch();this.updateQueueState([n.d.VISIBLE])}},{key:"requestChunk",value:function(a,b,c){a.newPriorityTier===n.d.RECENT&&this.newTierChunks.push(a);var q=a.newPriorityTier;if(b<q||b===q&&c>a.newPriority)a.newPriorityTier=b,a.newPriority=c}},{key:"updateQueueState",
-value:function(a){var b=this.existingTierChunks,c=this.queueManager;a=$jscomp.makeIterator(a);for(var q=a.next();!q.done;q=a.next()){var h=b[q.value],g=$jscomp.makeIterator(h);for(q=g.next();!q.done;q=g.next())q=q.value,q.newPriorityTier===n.d.RECENT&&c.performChunkPriorityUpdate(q);h.length=0}a=this.newTierChunks;h=$jscomp.makeIterator(a);for(q=h.next();!q.done;q=h.next())q=q.value,c.performChunkPriorityUpdate(q),b[q.priorityTier].push(q);a.length=0;this.queueManager.scheduleUpdate()}}]);return b}(I.c);
-q=x([Object(I.g)(n.a)],q);Object(I.f)(n.c,function(a){a=this.get(a.id);a.chunkManager.queueManager.invalidateSourceCache(a)})},function(p,e,m){function k(a){a:{var b=typeof a;if("number"===b||"string"===b)if(b=parseFloat(""+a),!Number.isNaN(b)){a=b;break a}throw Error("Expected floating-point number, but received: "+JSON.stringify(a)+".");}if(Number.isFinite(a))return a;throw Error("Expected finite floating-point number, but received: "+a+".");}function f(a){a=k(a);if(0<a)return a;throw Error("Expected positive finite floating-point number, but received: "+
-a+".");}function c(a){if("object"===typeof a){if(null===a)return"null";if(Array.isArray(a)){var b="[",g=a.length,h=0;if(h<g)for(b+=c(a[h]);++h<g;)b+=",",b+=c(a[h]);return b+"]"}b="{";g=Object.keys(a).sort();h=0;var r=g.length;if(h<r){var l=g[h];b+=JSON.stringify(l);for(b=b+":"+c(a[l]);++h<r;)b+=",",l=g[h],b+=JSON.stringify(l),b+=":",b+=c(a[l])}return b+"}"}return JSON.stringify(a)}function a(a){for(var b="";0<a.length;){var c=a.match(l);if(null===c){var h=a;c=a=""}else{h=a.substr(0,c.index);a=a.substr(c.index+
-c[0].length);var r=c[1];if(void 0!==r){if(c=r,2<=c.length&&"'"===c.charAt(0)&&"'"===c.charAt(c.length-1)){c=c.substr(1,c.length-2);for(r='"';0<c.length;){var d=c.match(g);if(null===d){r+=c;break}r+=d[1];'"'===d[2]?(r+="\\",r+='"'):r+="'";c=c.substr(d.index+d[0].length)}c=r+'"'}}else c=c[2]}b+=h.replace(/\(/g,"[").replace(/\)/g,"]").replace("True","true").replace("False","false").replace(/,\s*([\}\]])/g,"$1");b+=c}return b}function b(a,b,c){var h=a.length;if(!Array.isArray(b)||b.length!==h)throw Error("Expected length "+
-h+" array, but received: "+JSON.stringify(b)+".");for(var g=0;g<h;++g)a[g]=c(b[g],g);return a}function d(a){if("string"!==typeof a)throw Error("Expected string, but received: "+JSON.stringify(a)+".");return a}e.b=function(a,b){var c=a.length;if(!Array.isArray(b)||b.length!==c)throw Error("Incompatible sizes");for(var h=0;h<c;++h)if(!Number.isFinite(parseFloat(b[h])))throw Error("Non-finite value.");for(h=0;h<c;++h)a[h]=parseFloat(b[h]);return a};e.e=c;e.d=function(b){return JSON.parse(a(b))};e.a=
-function(a,b){if(!Array.isArray(a))throw Error("Expected array, but received: "+JSON.stringify(a)+".");return a.map(b)};e.c=b;e.i=function(a){if("object"!==typeof a||null==a||Array.isArray(a))throw Error("Expected JSON object, but received: "+JSON.stringify(a)+".");return a};e.l=d;e.k=function(a){if(void 0!==a)return d(a)};e.j=function(a,b,c){a=a.hasOwnProperty(b)?a[b]:void 0;try{return c(a)}catch(h){throw Error("Error parsing "+JSON.stringify(b)+" property: "+h.message);}};e.h=function(a,b){if("string"===
-typeof a&&null!==a.match(/^[a-zA-Z]/)&&(a=a.toUpperCase(),b.hasOwnProperty(a)))return b[a];throw Error("Invalid enum value: "+JSON.stringify(a)+".");};e.g=function(a){return b(n.m.create(),a,k)};e.f=function(a){return b(n.m.create(),a,f)};e.m=function(a){if(!Array.isArray(a))throw Error("Expected array, received: "+JSON.stringify(a)+".");for(var b=$jscomp.makeIterator(a),c=b.next();!c.done;c=b.next())if(c=c.value,"string"!==typeof c)throw Error("Expected string, received: "+JSON.stringify(c)+".");
-return a};var n=m(1),l=new RegExp(/('(?:[^'\\]|(?:\\.))*')/.source+"|"+/("(?:[^'\\]|(?:\\.))*")/.source),g=/^((?:[^"'\\]|(?:\\[^']))*)("|\\')/},function(p,e,m){m.d(e,"a",function(){return k});e.b=1E-6;var k="undefined"!==typeof Float32Array?Float32Array:Array;e.c=Math.random},function(p,e,m){m.d(e,"a",function(){return n});var k=function(){function a(a,b){for(var c=0;c<b.length;c++){var g=b[c];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,
-g)}}return function(b,c,l){c&&a(b.prototype,c);l&&a(b,l);return b}}(),f=new Uint32Array(2),c=[];for(p=2;36>=p;++p){e=Math.floor(32/Math.log2(p));m=Math.pow(p,e);var a=Math.floor(e/2),b=Math.pow(p,a);a=Math.pow(p,e-a);var d="^[0-"+String.fromCharCode(48+Math.min(9,p-1));10<p&&(d+="a-"+String.fromCharCode(97+p-11),d+="A-"+String.fromCharCode(65+p-11));d+="]{1,"+Math.ceil(64/Math.log2(p))+"}$";c[p]={lowDigits:e,lowBase:m,lowBase1:b,lowBase2:a,pattern:new RegExp(d)}}var n=function(){function a(b,c){b=
-void 0===b?0:b;c=void 0===c?0:c;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.low=b;this.high=c}k(a,[{key:"clone",value:function(){return new a(this.low,this.high)}},{key:"assign",value:function(a){this.low=a.low;this.high=a.high}},{key:"toString",value:function(a){a=void 0===a?10:a;var b=this.low,g=this.high;if(0===g)return b.toString(a);g*=4294967296;var d=c[a],h=d.lowBase;d=d.lowDigits;var l=g%h;g=Math.floor(g/h);b+=l;g+=Math.floor(b/h);b=(b%h).toString(a);
-return g.toString(a)+"0".repeat(d-b.length)+b}},{key:"tryParseString",value:function(a,b){b=void 0===b?10:b;var g=c[b],d=g.lowDigits,h=g.lowBase,l=g.lowBase1,r=g.lowBase2;if(!g.pattern.test(a))return!1;if(a.length<=d)return this.low=parseInt(a,b),this.high=0,!0;d=a.length-d;g=parseInt(a.substr(d),b);a=parseInt(a.substr(0,d),b);h=Math.floor(a*h/4294967296);l=g+a%4294967296*l%4294967296*r%4294967296;4294967296<=l&&(++h,l-=4294967296);if(l>>>0!==l||h>>>0!==h)return!1;this.low=l;this.high=h;return!0}},
-{key:"parseString",value:function(a,b){if(!this.tryParseString(a,void 0===b?10:b))throw Error("Failed to parse string as uint64 value: "+JSON.stringify(a)+".");return this}},{key:"valid",value:function(){var a=this.low,b=this.high;return a>>>0===a&&b>>>0===b}},{key:"toJSON",value:function(){return this.toString()}},{key:"lshift",value:function(b){b&=63;if(0==b)return this.clone();var c=this.low,g=this.high;return 32>b?new a(c<<b,g<<b|c>>>32-b):new a(0,c<<b-32)}},{key:"rshift",value:function(b){b&=
-63;if(0==b)return this.clone();var c=this.low,g=this.high;return 32>b?new a(c>>>b|g<<32-b,g>>b):new a(g>>b-32,0<=g?0:-1)}},{key:"or",value:function(b){return new a(this.low|b.low,this.high|b.high)}},{key:"xor",value:function(b){return new a(this.low^b.low,this.high^b.high)}},{key:"and",value:function(b){return new a(this.low&b.low,this.high&b.high)}}],[{key:"less",value:function(a,b){return a.high<b.high||a.high===b.high&&a.low<b.low}},{key:"compare",value:function(a,b){return a.high-b.high||a.low-
-b.low}},{key:"equal",value:function(a,b){return a.low===b.low&&a.high===b.high}},{key:"min",value:function(b,c){return a.less(b,c)?b:c}},{key:"random",value:function(){crypto.getRandomValues(f);return new a(f[0],f[1])}},{key:"parseString",value:function(b,c){c=void 0===c?10:c;return(new a).parseString(b,c)}}]);return a}();n.ZERO=new n(0,0)},function(p,e,m){p="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Int32Array;e.assign=function(c){for(var a=Array.prototype.slice.call(arguments,
-1);a.length;){var b=a.shift();if(b){if("object"!==typeof b)throw new TypeError(b+"must be non-object");for(var d in b)Object.prototype.hasOwnProperty.call(b,d)&&(c[d]=b[d])}}return c};e.shrinkBuf=function(c,a){if(c.length===a)return c;if(c.subarray)return c.subarray(0,a);c.length=a;return c};var k={arraySet:function(c,a,b,d,n){if(a.subarray&&c.subarray)c.set(a.subarray(b,b+d),n);else for(var l=0;l<d;l++)c[n+l]=a[b+l]},flattenChunks:function(c){var a,b;var d=b=0;for(a=c.length;d<a;d++)b+=c[d].length;
-var n=new Uint8Array(b);d=b=0;for(a=c.length;d<a;d++){var l=c[d];n.set(l,b);b+=l.length}return n}},f={arraySet:function(c,a,b,d,n){for(var l=0;l<d;l++)c[n+l]=a[b+l]},flattenChunks:function(c){return[].concat.apply([],c)}};e.setTyped=function(c){c?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,k)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,f))};e.setTyped(p)},function(p,e,m){m.d(e,"e",function(){return k});m.d(e,"d",function(){return f});var k;(function(c){c[c.GPU_MEMORY=
-0]="GPU_MEMORY";c[c.SYSTEM_MEMORY=1]="SYSTEM_MEMORY";c[c.SYSTEM_MEMORY_WORKER=2]="SYSTEM_MEMORY_WORKER";c[c.DOWNLOADING=3]="DOWNLOADING";c[c.QUEUED=4]="QUEUED";c[c.NEW=5]="NEW";c[c.FAILED=6]="FAILED";c[c.EXPIRED=7]="EXPIRED"})(k||(k={}));var f;(function(c){c[c.FIRST_TIER=0]="FIRST_TIER";c[c.FIRST_ORDERED_TIER=0]="FIRST_ORDERED_TIER";c[c.VISIBLE=0]="VISIBLE";c[c.PREFETCH=1]="PREFETCH";c[c.LAST_ORDERED_TIER=1]="LAST_ORDERED_TIER";c[c.RECENT=2]="RECENT";c[c.LAST_TIER=2]="LAST_TIER"})(f||(f={}));e.f=
-1E13;e.b="ChunkQueueManager";e.a="ChunkManager";e.c="ChunkSource.invalidate"},function(p,e,m){function k(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 f(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
-}m.d(e,"b",function(){return a});m.d(e,"a",function(){return b});var c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,g){c&&a(b.prototype,c);g&&a(b,g);return b}}(),a=function(){function a(){f(this,a);this.handlers=new Set;this.count=0;var b=this;this.dispatch=function(){var a=this,c=arguments;++b.count;b.handlers.forEach(function(b){b.apply(a,c)})}}
-c(a,[{key:"add",value:function(a){var b=this;this.handlers.add(a);return function(){return b.remove(a)}}},{key:"remove",value:function(a){return this.handlers.delete(a)}},{key:"dispose",value:function(){this.handlers=void 0}}]);return a}(),b=function(a){function b(){f(this,b);var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}k(b,
-a);return b}(a)},function(p,e,m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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,c){for(var q=0;3>q;++q)a[q]=Number.POSITIVE_INFINITY,
-b[q]=Number.NEGATIVE_INFINITY;c=$jscomp.makeIterator(c);for(q=c.next();!q.done;q=c.next()){var h=q.value.spec;q=h.lowerChunkBound;h=h.upperChunkBound;for(var g=0;3>g;++g)a[g]=Math.min(a[g],q[g]),b[g]=Math.max(b[g],h[g])}}function a(a,b,c,q){for(var h=u.FULLY_INSIDE,g=0;3>g;++g){var t=a[g];var d=b[g],l=c[g],r=q[g];t=t>=r||d<=l?u.FULLY_OUTSIDE:t>=l&&d<=r?u.FULLY_INSIDE:u.PARTIALLY_INSIDE;switch(t){case u.FULLY_OUTSIDE:return t;case u.PARTIALLY_INSIDE:h=t}}return h}function b(a){var b=a.transform,c=
-a.transformedSources,q=b.changed.count;q!==a.transformedSourcesGeneration&&(a.transformedSourcesGeneration=q,c=h.h.equals(b.transform,h.c)?a.sources.map(function(a){return a.map(function(a){return{source:a,chunkLayout:a.spec.chunkLayout}})}):a.sources.map(function(a){return a.map(function(a){var c=a.spec.chunkLayout;return{chunkLayout:g.a.get(c.size,l(c.transform,b)),source:a}})}),a.transformedSources=c);return c}function d(a,b){var c=b.length,q=0;if(1<c)for(var h=0,g=0;g<c;++g){var t=b[g].chunkLayout;
-var d=t.size;t=t.globalToLocalSpatialVector(I,a);for(var l=0,r=0,w=1,n=0;3>n;++n){var C=d[n];w*=C;C*=t[n];l=Math.min(l,C);r=Math.max(r,C)}d=w/(r-l);d>h&&(h=d,q=g)}return b[q]}function n(a){var b=a.voxelSize,c=void 0===a.lowerVoxelBound?h.g:a.lowerVoxelBound,q=a.upperVoxelBound,g=void 0===a.maxVoxelsPerChunkLog2?18:a.maxVoxelsPerChunkLog2;a=void 0===a.transform?h.c:a.transform;a=Object(h.b)(h.m.create(),a);b=h.m.multiply(a,a,b);a=h.m.fromValues(1,1,1);if(void 0===q)var d=h.e;else{d=h.m.create();for(var t=
-0;3>t;++t)d[t]=Math.pow(2,Math.floor(Math.log2(q[t]-c[t])))}for(c=0;c<g;++c){q=Infinity;t=-1;for(var l=0;3>l;++l)if(!(a[l]>=d[l])){var r=a[l]*b[l];r<q&&(q=r,t=l)}q=t;if(-1===q)break;a[q]*=2}return a}function l(a,b){b=b.transform;return void 0===b?void 0===a?h.c:a:void 0===a?b:h.h.multiply(h.h.create(),b,a)}m.d(e,"h",function(){return J});e.l=n;e.k=l;e.j=function(a){if(void 0!==a.chunkDataSizes)return a.chunkDataSizes;var b=void 0===a.chunkLayoutPreference?v.ISOTROPIC:a.chunkLayoutPreference;switch(b){case v.ISOTROPIC:return[n(a)];
-case v.FLAT:b=[];for(var c=0;3>c;++c){var q=c;var g=a.lowerVoxelBound;var d=a.upperVoxelBound,l=c,t=a.voxelSize,r=a.maxVoxelsPerChunkLog2,w=a.transform;h.m.subtract(I,void 0===d?h.e:d,void 0===g?h.g:g);I[l]=1;g=n({voxelSize:t,upperVoxelBound:I,maxVoxelsPerChunkLog2:r,transform:w});b[q]=g}b.push(n(a));return b}throw Error("Invalid chunk layout preference: "+b+".");};m.d(e,"i",function(){return A});var g=m(66),r=m(20),C=m(67),w=m(14),h=m(1);p=m(0);m.d(e,"a",function(){return w.b});var B=function(){function a(a,
-b){for(var c=0;c<b.length;c++){var h=b[c];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}return function(b,c,q){c&&a(b.prototype,c);q&&a(b,q);return b}}(),I=h.m.create(),u;(function(a){a[a.FULLY_OUTSIDE=0]="FULLY_OUTSIDE";a[a.FULLY_INSIDE=1]="FULLY_INSIDE";a[a.PARTIALLY_INSIDE=2]="PARTIALLY_INSIDE"})(u||(u={}));var x=[h.m.create(),h.m.create(),h.m.create(),h.m.create()],J=function(g){function l(){k(this,l);var a=(l.__proto__||Object.getPrototypeOf(l)).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=h.h.create();a.viewportAxes=[h.m.create(),h.m.create(),h.m.create()];a.previousViewportAxes=[h.m.create(),h.m.create()];a.centerDataPosition=h.m.create();a.viewportPlaneDistanceToOrigin=0;a.visibleChunkLayouts=new Map;a.visibleLayers=new Map;a.visibleSourcesStale=!0;
-a.pixelSize=0;h.h.identity(a.viewportToData);return a}f(l,g);B(l,[{key:"onViewportChanged",value:function(){}},{key:"maybeSetHasValidViewport",value:function(){!this.hasValidViewport&&-1!==this.width&&-1!==this.height&&this.hasViewportToData&&(this.hasValidViewport=!0,this.onHasValidViewport());if(this.hasValidViewport)this.onViewportChanged()}},{key:"onHasValidViewport",value:function(){}},{key:"setViewportSize",value:function(a,b){return a!==this.width||b!==this.height?(this.width=a,this.height=
-b,this.maybeSetHasValidViewport(),!0):!1}},{key:"setViewportToDataMatrix",value:function(a){if(this.hasViewportToData&&h.h.equals(this.viewportToData,a))return!1;this.hasViewportToData=!0;var b=this.viewportToData;h.h.copy(b,a);Object(h.k)(b);h.m.transformMat4(this.centerDataPosition,h.g,a);a=0;for(var c=this.viewportAxes,g=this.previousViewportAxes,d=0;3>d;++d){var l=c[d];Object(h.l)(l,h.d[d],b);0===d&&(a=h.m.length(l));h.m.normalize(l,l)}this.viewportAxes=c;this.previousViewportAxes=g;if(!Object(C.a)(a,
-this.pixelSize)||.95>h.m.dot(c[0],g[0])||.95>h.m.dot(c[1],g[1]))h.m.copy(g[0],c[0]),h.m.copy(g[1],c[1]),this.visibleSourcesStale=!0,this.pixelSize=a;this.viewportPlaneDistanceToOrigin=h.m.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,h=this.viewportAxes[2],g=this.visibleLayers;c.clear();var l={};g=$jscomp.makeIterator(g);for(var t=g.next();!t.done;l={smallestVoxelSize:l.smallestVoxelSize,visibleSources:l.visibleSources},t=g.next()){t=$jscomp.makeIterator(t.value);var r=t.next().value;l.visibleSources=t.next().value;l.visibleSources.length=0;t=b(r);var w=t.length;r=void 0;l.smallestVoxelSize=t[0][0].source.spec.voxelSize;var n=function(b){return function(c){for(var q=0;3>q;++q){var h=c[q];if(h>a&&h>b.smallestVoxelSize[q])return!0}return!1}}(l),
-C=function(a){return function(b,q){var h=b.source,g=b.chunkLayout;a.visibleSources[a.visibleSources.length++]=b;b=c.get(g);void 0===b&&(b=new Map,c.set(g,b));b.set(h,q)}}(l);for(r=w-1;;){w=d(h,t[r]);C(w,r);if(0===r||!n(w.source.spec.voxelSize))break;--r}l.visibleSources.reverse()}}}},{key:"computeVisibleChunks",value:function(b,q){var g=this;this.updateVisibleSources();for(var l=this.width,d=this.height,t=this.viewportToData,w=0;3>w;++w)x[0][w]=-h.d[0][w]*l/2-h.d[1][w]*d/2,x[1][w]=-h.d[0][w]*l/2+
-h.d[1][w]*d/2,x[2][w]=h.d[0][w]*l/2-h.d[1][w]*d/2,x[3][w]=h.d[0][w]*l/2+h.d[1][w]*d/2;for(l=0;4>l;++l)h.m.transformMat4(x[l],x[l],t);var n=h.m.create(),C=h.m.create(),B=h.m.create(),f=h.m.create(),z=h.m.create(),k=h.m.create(),e=[],m=[];this.visibleChunkLayouts.forEach(function(l,d){function t(){for(var a=0,b=0,c=0;3>c;++c){var q=k[c],h=n[c],g=C[c]-h,l=z[c]*g;a+=q*(h+l);b+=q*(h+g-l)}return a<v?!1:b<=v}function w(b){function c(){H=Object(r.b)(e,0,k,function(b){var c=b.spec;switch(a(n,C,c.lowerChunkBound,
-c.upperChunkBound)){case u.PARTIALLY_INSIDE:return!0;case u.FULLY_INSIDE:m.push(b);default:return!1}})}if(0!==m.length||0!==H){for(var h=1,g=0;3>g;++g)h*=Math.max(0,C[g]-n[g]);if(0!==h&&t())if(1===h)q(d,G,n,m);else{for(var l;;)if(h=n[b],g=C[b],l=g-h,1===l)b=(b+1)%3;else break;l=h+Math.floor(.5*l);var B=(b+1)%3,f=m.length;C[b]=l;var k=H;c();w(B);m.length=f;H=k;C[b]=g;n[b]=l;c();w(B);n[b]=h;m.length=f;H=k}}}var G=b(d);c(B,f,l.keys());h.m.set(n,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);
-h.m.set(C,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);d.globalToLocalSpatialVector(k,g.viewportAxes[2]);for(var y=0;3>y;++y)z[y]=0<k[y]?1:0;var v=h.m.dot(d.globalToLocalGrid(I,g.centerDataPosition),k);for(y=0;4>y;++y)for(var L=d.globalToLocalGrid(I,x[y]),A=0;3>A;++A)n[A]=Math.min(n[A],Math.floor(L[A])),C[A]=Math.max(C[A],Math.floor(L[A])+1);h.m.max(n,n,B);h.m.min(C,C,f);m.length=0;e.length=0;l=$jscomp.makeIterator(l.keys());for(y=l.next();!y.done;y=l.next())switch(y=
-y.value,L=y.spec,a(n,C,L.lowerChunkBound,L.upperChunkBound)){case u.FULLY_INSIDE:m.push(y);break;case u.PARTIALLY_INSIDE:e.push(y)}var H=e.length;w(0)})}}]);return l}(p.b),v;(function(a){a[a.ISOTROPIC=0]="ISOTROPIC";a[a.FLAT=1]="FLAT"})(v||(v={}));var A=function(){function a(b){k(this,a);var c=b.chunkSize,q=b.transform,l=void 0===b.lowerChunkBound?h.g:b.lowerChunkBound,d=b.upperChunkBound;this.voxelSize=b.voxelSize;this.chunkLayout=g.a.get(c,q);this.lowerChunkBound=l;this.upperChunkBound=d}B(a,[{key:"toObject",
-value:function(){return{transform:this.chunkLayout.transform,chunkSize:this.chunkLayout.size,voxelSize:this.voxelSize,lowerChunkBound:this.lowerChunkBound,upperChunkBound:this.upperChunkBound}}}]);return a}();e.f="SliceView";e.d="sliceview/RenderLayer";e.b="SliceView.addVisibleLayer";e.c="SliceView.removeVisibleLayer";e.g="SliceView.updateView";e.e="SliceView.updateTransform"},function(p,e,m){function k(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 f(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}e.c=function(a){return function(a){function b(a){for(var c=[],g=0;g<arguments.length;++g)c[g-0]=arguments[g];if(!(this instanceof
-b))throw new TypeError("Cannot call a class as a function");var d,n=k(this,(d=b.__proto__||Object.getPrototypeOf(b)).call.apply(d,[].concat([this],$jscomp.arrayFromIterable(c))));n.visibility=c[0].get(c[1].visibility);n.registerDisposer(n.visibility.changed.add(function(){return n.chunkManager.scheduleUpdateChunkPriorities()}));return n}f(b,a);return b}(a)};e.b=function(a){return a===Number.POSITIVE_INFINITY?c.d.VISIBLE:c.d.PREFETCH};e.a=function(a){return a===Number.POSITIVE_INFINITY?0:a*c.f};m(68);
-var c=m(7)},function(p,e,m){m.d(e,"b",function(){return k});e.c=function(c,a,b){b=void 0===b?f:b;if(a!==b)for(c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength),a=0,b=c.length;a<b;a+=2){var d=c[a];c[a]=c[a+1];c[a+1]=d}};e.d=function(c,a,b){b=void 0===b?f:b;if(a!==b)for(c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength),a=0,b=c.length;a<b;a+=4){var d=c[a];c[a]=c[a+3];c[a+3]=d;d=c[a+1];c[a+1]=c[a+2];c[a+2]=d}};var k;(function(c){c[c.LITTLE=0]="LITTLE";c[c.BIG=1]="BIG"})(k||(k={}));var f=function(){var c=
-Uint16Array.of(4386);return 17===(new Uint8Array(c.buffer))[0]?k.BIG:k.LITTLE}();e.a=f},function(p,e,m){function k(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 f(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
-}m.d(e,"b",function(){return d});m.d(e,"c",function(){return n});e.d=function(a,c){return new Promise(function(g,l){if(a===b)c(g,l,b);else{var r=new d,h=a.add(function(){r.cancel()});c(function(a){h();g(a)},function(a){h();l(a)},r)}})};var c=function(){function a(a,b){for(var c=0;c<b.length;c++){var g=b[c];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(b,c,l){c&&a(b.prototype,c);l&&a(b,l);return b}}();p=new (function(){function a(){f(this,
-a);this.name="CancellationError";this.message="CANCELED"}c(a,[{key:"toString",value:function(){return"CANCELED"}}]);return a}());e.a=p;var a=function(){},b={isCanceled:!1,add:function(){return a},remove:a};e.e=b;var d=function(){function b(){f(this,b)}c(b,[{key:"cancel",value:function(){var a=this.handlers;if(null!==a&&(this.handlers=null,void 0!==a)){a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next())b=b.value,b()}}},{key:"add",value:function(b){var c=this,g=this.handlers;if(null===
-g)return b(),a;void 0===g&&(g=this.handlers=new Set);g.add(b);return function(){c.remove(b)}}},{key:"remove",value:function(a){var b=this.handlers;null!=b&&b.delete(a)}},{key:"isCanceled",get:function(){return null===this.handlers}}]);return b}(),n=function(a){function g(){f(this,g);var a=(g.__proto__||Object.getPrototypeOf(g)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");a=!a||"object"!==typeof a&&"function"!==typeof a?this:
-a;a.consumers=new Set;return a}k(g,a);c(g,[{key:"addConsumer",value:function(a){var c=this;a=void 0===a?b:a;var g=this.consumers;g.has(a)||a.isCanceled||(g.add(a),a.add(function(){g.delete(a);0===g.size&&c.cancel()}))}}]);return g}(d)},function(p,e,m){function k(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 f(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function c(a,b,c,d){a.addEventListener(b,c,d);return function(){return a.removeEventListener(b,c,d)}}m.d(e,"a",function(){return b});m.d(e,"b",function(){return d});var a=function(){function a(a,b){for(var c=0;c<b.length;c++){var g=b[c];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,
-g)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),b=function(){function b(){f(this,b);this.refCount=1}a(b,[{key:"addRef",value:function(){++this.refCount;return this}},{key:"dispose",value:function(){0===--this.refCount&&this.refCountReachedZero()}},{key:"refCountReachedZero",value:function(){this.disposed();var a=this.disposers;if(null!=a){for(var b=a.length;0<b;--b){var c=a[b-1];"object"===typeof c?c.dispose():c.call(this)}this.disposers=void 0}this.wasDisposed=!0}},{key:"disposed",
-value:function(){}},{key:"registerDisposer",value:function(a){var b=this.disposers;null==b?this.disposers=[a]:b.push(a);return a}},{key:"unregisterDisposer",value:function(a){var b=this.disposers;if(null!=b){var c=b.indexOf(a);-1!==c&&b.splice(c,1)}return a}},{key:"registerEventListener",value:function(a,b,d,n){this.registerDisposer(c(a,b,d,n))}},{key:"registerCancellable",value:function(a){this.registerDisposer(function(){a.cancel()});return a}}]);return b}(),d=function(a){function b(a){f(this,b);
-var c=(b.__proto__||Object.getPrototypeOf(b)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");c=!c||"object"!==typeof c&&"function"!==typeof c?this:c;c.value=a;return c}k(b,a);return b}(b)},function(p,e,m){m.d(e,"b",function(){return k});var k;(function(f){f[f.UINT8=0]="UINT8";f[f.UINT16=1]="UINT16";f[f.UINT32=2]="UINT32";f[f.UINT64=3]="UINT64";f[f.FLOAT32=4]="FLOAT32"})(k||(k={}));p=[];e.a=p;p[k.UINT8]=1;p[k.UINT16]=2;p[k.UINT32]=4;p[k.UINT64]=
-8;p[k.FLOAT32]=4},function(p,e,m){function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}m.d(e,"a",function(){return n});e.b=function(a,c){c=void 0===c?"GET":c;var g=new XMLHttpRequest;g[d]=c;g[b]=a;g.open(c,a);return g};e.c=function(a,g,r){r=
-void 0===r?"GET":r;var l=new XMLHttpRequest;if(Array.isArray(a)){var w=a.length;w=1===w?0:Math.abs(Object(c.a)(g))%w;a=a[w]+g}else a+=g;l[d]=r;l[b]=a;l.open(r,a);return l};e.e=function(a,b,c){c=void 0===c?f.e:c;a.responseType=b;return new Promise(function(b,d){var h=function(){a.abort()};c.add(h);a.onloadend=function(){var g=this.status;c.remove(h);200<=g&&300>g?b(this.response):d(n.fromXhr(a))};a.send()})};e.d=function(a,b,c,d){d=void 0===d?f.e:d;a.responseType=c;a.setRequestHeader("Content-Type",
-"application/json");return new Promise(function(c,h){var g=function(){a.abort()};d.add(g);a.onloadend=function(){var b=this.status;d.remove(g);200<=b&&300>b?c(this.response):h(n.fromXhr(a))};a.send(JSON.stringify(b))})};var f=m(12),c=m(87),a=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();$jscomp.initSymbol();
-var b=Symbol("url");$jscomp.initSymbol();var d=Symbol("method"),n=function(c){function g(a,b,c,h){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var d=a+" "+JSON.stringify(b)+" resulted in HTTP error "+c;h&&(d+=": "+h);d+=".";var l=(g.__proto__||Object.getPrototypeOf(g)).call(this,d);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");l=!l||"object"!==typeof l&&"function"!==typeof l?this:l;l.name="HttpError";l.message=d;
-l.method=a;l.url=b;l.code=c;l.statusMessage=h;return l}k(g,c);a(g,null,[{key:"fromXhr",value:function(a){return new g(a[d],a[b],a.status,a.statusText)}}]);return g}(Error)},function(p,e,m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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 c(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}m.d(e,"a",function(){return r});p=m(19);var a=m(44),b=m(1),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var h=b[c];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),n=function w(a,
-b,c){null===a&&(a=Function.prototype);var h=Object.getOwnPropertyDescriptor(a,b);if(void 0===h){if(a=Object.getPrototypeOf(a),null!==a)return w(a,b,c)}else{if("value"in h)return h.value;b=h.get;return void 0===b?void 0:b.call(c)}},l=b.m.create(),g=b.m.create();m=function(a){function b(){k(this,b);var a=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));a.source=null;return a}c(b,a);d(b,[{key:"initializeVolumeChunk",value:function(a,c){n(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),
-"initializeVolumeChunk",this).call(this,a,c);this.chunkDataSize=null;a=this.source;this.gpuMemoryBytes=this.systemMemoryBytes=a.spec.chunkBytes;this.data=null}},{key:"serialize",value:function(a,c){n(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"serialize",this).call(this,a,c);var h=this.chunkDataSize;h!==this.source.spec.chunkDataSize&&(a.chunkDataSize=h);a=a.data=this.data;c.push(a.buffer);this.data=null}},{key:"downloadSucceeded",value:function(){this.systemMemoryBytes=this.gpuMemoryBytes=
-this.data.byteLength;n(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"downloadSucceeded",this).call(this)}},{key:"freeSystemMemory",value:function(){this.data=null}}]);return b}(p.SliceViewChunk);var r=function(n){function h(b,c){k(this,h);b=f(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,b,c));b.spec=a.b.fromObject(c.spec);return b}c(h,n);d(h,[{key:"computeChunkBounds",value:function(a){var c=this.spec,h=c.upperVoxelBound;c=c.chunkDataSize;for(var d=b.m.multiply(g,a.chunkGridPosition,
-c),n=!1,r=0;3>r;++r)(l[r]=Math.min(h[r],d[r]+c[r])-d[r])!==c[r]&&(n=!0);b.m.add(d,d,this.spec.baseVoxelOffset);a.chunkDataSize=n?b.m.clone(l):c;return d}}]);return h}(p.SliceViewChunkSource);r.prototype.chunkConstructor=m},function(p,e,m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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 c(a,
-b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){for(var c=r.m.create(),h=r.m.create(),q=r.m.create(),d=new Float32Array(a.length),g=b.length,l=0;l<g;l+=3){for(var t=3*b[l],n=3*b[l+1],w=3*b[l+2],f=0;3>f;++f)h[f]=a[n+f]-a[t+f],q[f]=
-a[w+f]-a[n+f];r.m.cross(c,h,q);r.m.normalize(c,c);for(t=0;3>t;++t)for(n=3*b[l+t],w=0;3>w;++w)d[n+w]+=c[w]}a=d.length;for(b=0;b<a;b+=3)c=d.subarray(b,b+3),r.m.normalize(c,c);return d}function b(a,b,c,h,q,d,l,n){var t=new Float32Array(c,q,3*d);Object(g.d)(t,h);void 0===l&&(l=q+12*d);var r;void 0!==n&&(r=n*b);c=void 0===r?new Uint32Array(c,l):new Uint32Array(c,l,r);if(0!==c.length%b)throw Error("Number of indices is not a multiple of "+b+": "+c.length+".");Object(g.d)(c,h);a.vertexPositions=t;a.indices=
-c}e.c=function(a,b,c){Object(C.i)(b);a.fragmentIds=Object(C.j)(b,c,C.m)};e.b=a;e.e=b;e.d=function(c,h,d,g,q,l,n){b(c,3,h,d,g,q,l,n);c.vertexNormals=a(c.vertexPositions,c.indices)};m.d(e,"a",function(){return v});var d=m(2),n=m(7);p=m(89);e=m(42);var l=m(21),g=m(11),r=m(1),C=m(3),w=m(5),h=m(10);m=m(0);var B=function(){function a(a,b){for(var c=0;c<b.length;c++){var q=b[c];q.enumerable=q.enumerable||!1;q.configurable=!0;"value"in q&&(q.writable=!0);Object.defineProperty(a,q.key,q)}}return function(b,
-c,h){c&&a(b.prototype,c);h&&a(b,h);return b}}(),I=function t(a,b,c){null===a&&(a=Function.prototype);var q=Object.getOwnPropertyDescriptor(a,b);if(void 0===q){if(a=Object.getPrototypeOf(a),null!==a)return t(a,b,c)}else{if("value"in q)return q.value;b=q.get;return void 0===b?void 0:b.call(c)}},u=this&&this.__decorate||function(a,b,c,q){var h=arguments.length,d=3>h?b:null===q?q=Object.getOwnPropertyDescriptor(b,c):q,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)d=Reflect.decorate(a,
-b,c,q);else for(var l=a.length-1;0<=l;l--)if(g=a[l])d=(3>h?g(d):3<h?g(b,c,d):g(b,c))||d;return 3<h&&d&&Object.defineProperty(b,c,d),d},x=function(a){function b(){k(this,b);var a=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));a.objectId=new w.a;return a}c(b,a);B(b,[{key:"initializeManifestChunk",value:function(a,c,h){I(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initialize",this).call(this,a);this.objectId.assign(c);h&&(this.clipBounds=h)}},{key:"freeSystemMemory",value:function(){this.fragmentIds=
-null}},{key:"serialize",value:function(a,c){I(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"serialize",this).call(this,a,c);a.fragmentIds=this.fragmentIds}},{key:"downloadSucceeded",value:function(){this.systemMemoryBytes=100;this.gpuMemoryBytes=0;I(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"downloadSucceeded",this).call(this);this.priorityTier<n.d.RECENT&&this.source.chunkManager.scheduleUpdateChunkPriorities()}},{key:"toString",value:function(){return this.objectId.toString()}}]);
-return b}(d.Chunk),J=function(a){function b(){k(this,b);var a=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));a.manifestChunk=null;a.fragmentId=null;a.vertexPositions=null;a.indices=null;a.vertexNormals=null;return a}c(b,a);B(b,[{key:"initializeFragmentChunk",value:function(a,c,h){I(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initialize",this).call(this,a);this.manifestChunk=c;this.fragmentId=h}},{key:"freeSystemMemory",value:function(){this.fragmentId=this.vertexPositions=
-this.indices=this.vertexNormals=this.manifestChunk=null}},{key:"serialize",value:function(a,c){I(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"serialize",this).call(this,a,c);a.objectKey=this.manifestChunk.key;var q=this.vertexPositions,h=this.indices,d=this.vertexNormals;a.vertexPositions=q;a.indices=h;a.vertexNormals=d;a=q.buffer;c.push(a);h=h.buffer;h!==a&&c.push(h);d=d.buffer;d!==a&&d!==h&&c.push(d);this.vertexPositions=this.indices=this.vertexNormals=null}},{key:"downloadSucceeded",
-value:function(){this.systemMemoryBytes=this.gpuMemoryBytes=this.vertexPositions.byteLength+this.indices.byteLength+this.vertexNormals.byteLength;I(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"downloadSucceeded",this).call(this)}}]);return b}(d.Chunk),v=function(a){function b(a,c){k(this,b);var q=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));return(q.fragmentSource=q.registerDisposer(a.getRef(c.fragmentSource))).meshSource=q}c(b,a);B(b,[{key:"getChunk",value:function(a,
-b){var c=Object(l.b)(a,b),q=this.chunks.get(c);void 0===q&&(q=this.getNewChunk_(x),q.initializeManifestChunk(c,a,b),this.addChunk(q));return q}},{key:"getFragmentChunk",value:function(a,b){var c=a.key+"/"+b,q=this.fragmentSource,h=q.chunks.get(c);void 0===h&&(h=q.getNewChunk_(J),h.initializeFragmentChunk(c,a,b),q.addChunk(h));return h}}]);return b}(d.ChunkSource);d=function(a){function b(){k(this,b);var a=f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.meshSource=null;return a}
-c(b,a);B(b,[{key:"download",value:function(a,b){return this.meshSource.downloadFragment(a,b)}}]);return b}(d.ChunkSource);d=u([Object(m.g)(p.a)],d);e=function(a){function b(a,c){k(this,b);var q=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));q.source=q.registerDisposer(a.getRef(c.source));q.registerDisposer(q.chunkManager.recomputeChunkPriorities.add(function(){q.updateChunkPriorities()}));return q}c(b,a);B(b,[{key:"updateChunkPriorities",value:function(){var a=this,b=this.visibility.value;
-if(b!==Number.NEGATIVE_INFINITY){var c=Object(h.b)(b),d=Object(h.a)(b),g=this.source,t=this.chunkManager;Object(l.a)(this,function(b){b=g.getChunk(b,a.clipBounds.value);t.requestChunk(b,c,d+100);var q=b.state;if(q===n.e.SYSTEM_MEMORY_WORKER||q===n.e.SYSTEM_MEMORY||q===n.e.GPU_MEMORY){q=$jscomp.makeIterator(b.fragmentIds);for(var h=q.next();!h.done;h=q.next())h=g.getFragmentChunk(b,h.value),t.requestChunk(h,c,d+50)}})}}}]);return b}(e.a);e=u([Object(m.g)(p.b)],e)},function(p,e,m){e.a=function(c,a){Object(k.a)(c,
-Object(f.a)(new Uint8Array(a),c.chunkDataSize,c.source.spec.numChannels))};var k=m(26),f=m(99)},function(p,e,m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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 c(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(e,"__esModule",{value:!0});m.d(e,"SliceView",function(){return B});m.d(e,"SliceViewChunk",function(){return I});m.d(e,"SliceViewChunkSource",function(){return u});m.d(e,"RenderLayer",function(){return x});p=m(2);var a=m(65);e=m(9);var b=m(1),d=m(8),n=m(10);m=m(0);var l=function(){function a(a,
-b){for(var c=0;c<b.length;c++){var h=b[c];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}return function(b,c,h){c&&a(b.prototype,c);h&&a(b,h);return b}}(),g=function v(a,b,c){null===a&&(a=Function.prototype);var h=Object.getOwnPropertyDescriptor(a,b);if(void 0===h){if(a=Object.getPrototypeOf(a),null!==a)return v(a,b,c)}else{if("value"in h)return h.value;b=h.get;return void 0===b?void 0:b.call(c)}},r=this&&this.__decorate||function(a,
-b,c,h){var d=arguments.length,q=3>d?b:null===h?h=Object.getOwnPropertyDescriptor(b,c):h,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)q=Reflect.decorate(a,b,c,h);else for(var l=a.length-1;0<=l;l--)if(g=a[l])q=(3>d?g(q):3<d?g(b,c,q):g(b,c))||q;return 3<d&&q&&Object.defineProperty(b,c,q),q},C=b.m.create(),w=b.m.create(),h=function(a){function b(a,c){k(this,b);var h=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));h.initializeSharedObject(a,c.id);return h}c(b,a);return b}(e.h),
-B=function(a){function h(a,b){k(this,h);var c=f(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,a,b));c.handleLayerChanged=function(){c.hasValidViewport&&c.chunkManager.scheduleUpdateChunkPriorities()};c.invalidateVisibleSources=function(){c.visibleSourcesStale=!0;c.hasValidViewport&&c.chunkManager.scheduleUpdateChunkPriorities()};c.registerDisposer(c.chunkManager.recomputeChunkPriorities.add(function(){c.updateVisibleChunks()}));return c}c(h,a);l(h,[{key:"onViewportChanged",value:function(){this.chunkManager.scheduleUpdateChunkPriorities()}},
-{key:"updateVisibleChunks",value:function(){var a=this,c=this.centerDataPosition,h=this.chunkManager,q=this.visibility.value;if(q!==Number.NEGATIVE_INFINITY){var d=Object(n.b)(q),g=Object(n.a)(q);g+=-1E12;this.computeVisibleChunks(function(b){b.globalToLocalSpatial(w,c);return a.visibleChunkLayouts.get(b)},function(a,c,q,l){b.m.multiply(C,q,a.size);a=-b.m.distance(w,C);l=$jscomp.makeIterator(l);for(var t=l.next();!t.done;t=l.next()){var n=t.value;t=c.get(n);n=n.getChunk(q);h.requestChunk(n,d,g+a+
-1E9*t)}})}}},{key:"removeVisibleLayer",value:function(a){this.visibleLayers.delete(a);a.layerChanged.remove(this.handleLayerChanged);a.transform.changed.remove(this.invalidateVisibleSources);this.invalidateVisibleSources()}},{key:"addVisibleLayer",value:function(a){this.visibleLayers.set(a,[]);a.layerChanged.add(this.handleLayerChanged);a.transform.changed.add(this.invalidateVisibleSources);this.invalidateVisibleSources()}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.visibleLayers.keys()),
-b=a.next();!b.done;b=a.next())this.removeVisibleLayer(b.value);g(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"disposed",this).call(this)}}]);return h}(Object(n.c)(Object(p.withChunkManager)(h)));B=r([Object(m.g)(e.f)],B);Object(m.f)(e.g,function(a){var b=this.get(a.id);a.width&&b.setViewportSize(a.width,a.height);a.viewportToData&&b.setViewportToDataMatrix(a.viewportToData)});Object(m.f)(e.b,function(a){var b=this.get(a.id);a=this.get(a.layerId);b.addVisibleLayer(a)});Object(m.f)(e.c,
-function(a){var b=this.get(a.id);a=this.get(a.layerId);b.removeVisibleLayer(a)});var I=function(a){function h(){k(this,h);var a=f(this,(h.__proto__||Object.getPrototypeOf(h)).call(this));a.source=null;a.chunkGridPosition=b.m.create();return a}c(h,a);l(h,[{key:"initializeVolumeChunk",value:function(a,c){g(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"initialize",this).call(this,a);b.m.copy(this.chunkGridPosition,c)}},{key:"serialize",value:function(a,b){g(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),
-"serialize",this).call(this,a,b);a.chunkGridPosition=this.chunkGridPosition}},{key:"downloadSucceeded",value:function(){g(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"downloadSucceeded",this).call(this)}},{key:"freeSystemMemory",value:function(){}},{key:"toString",value:function(){return this.source.toString()+":"+Object(b.n)(this.chunkGridPosition)}}]);return h}(p.Chunk),u=function(a){function h(a,b){k(this,h);return f(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,a,b))}c(h,
-a);l(h,[{key:"getChunk",value:function(a){var c=Object(b.n)(a),h=this.chunks.get(c);void 0===h&&(h=this.getNewChunk_(this.chunkConstructor),h.initializeVolumeChunk(c,a),this.addChunk(h));return h}}]);return h}(p.ChunkSource),x=function(h){function g(c,h){k(this,g);var l=f(this,(g.__proto__||Object.getPrototypeOf(g)).call(this,c,h));l.layerChanged=new d.a;l.transform=new a.a;l.transformedSourcesGeneration=-1;for(var q=l.sources=[],t=$jscomp.makeIterator(h.sources),n=t.next();!n.done;n=t.next()){var r=
-n.value;n=[];q.push(n);r=$jscomp.makeIterator(r);for(var w=r.next();!w.done;w=r.next())w=c.get(w.value),l.registerDisposer(w.addRef()),n.push(w)}b.h.copy(l.transform.transform,h.transform);l.transform.changed.add(l.layerChanged.dispatch);return l}c(g,h);return g}(m.c);x=r([Object(m.g)(e.d)],x);Object(m.f)(e.e,function(a){var c=this.get(a.id);a=a.value;var h=c.transform.transform;b.h.equals(a,h)||(b.h.copy(h,a),c.transform.changed.dispatch())})},function(p,e,m){e.b=function(k,f,c,a){for(;f<c;){var b=
-k[f];a(b)?++f:(--c,k[f]=k[c],k[c]=b)}return c};e.a=function(k,f){var c=k.length,a=Array(c);f=a[0]=void 0===f?1:f;for(var b=1;b<c;++b)f*=k[b-1],a[b]=f;return a};e.c=function(k,f,c){for(var a=new k.constructor(k.length),b=0;b<f*c;b+=c)for(var d=0;d<c;d++)a[d*f+b/c]=k[b+d];return a}},function(p,e,m){e.b=function(k,f){return k.low+","+k.high+(f?"_"+f.center.toString()+"_"+f.size.toString():"")};e.a=function(k,f){var c=k.segmentEquivalences;k=$jscomp.makeIterator(k.visibleSegments);for(var a=k.next();!a.done;a=
-k.next())if(a=a.value,c.disjointSets.isMinElement(a))for(var b=$jscomp.makeIterator(c.setElements(a)),d=b.next();!d.done;d=b.next())f(d.value,a)}},function(p,e,m){function k(f,c,a,b,d,n,l){for(var g=new Map,r=Array(3),C=2,w=0;3>w;++w){var h=r[w]=Math.ceil(b[w]/c[w]);C*=h}w=r[0];h=r[1];r=r[2];var B=b[0],k=b[1];b=b[2];var e=c[0],m=c[1],p=c[2],v=f.length,A=v,t=[0,0,0];f.resize(v+C);C=n[0];for(var z=n[1],H=n[2],q=0;q<r;++q){t[2]=Math.min(p,b-q*p);for(var G=0;G<h;++G){t[1]=Math.min(m,k-G*m);for(var L=
-0;L<w;++L){t[0]=Math.min(e,B-L*e);var K=f.length-v,D=$jscomp.makeIterator(l(a,d+(q*p*H+G*m*z+L*e*C),n,c,t,v,g,f)),E=D.next().value;D=D.next().value;var Q=f.data;Q[A++]=D|E<<24;Q[A++]=K}}}}e.c=function(f,c,a,b,d,n,l,g,r){if(1===d)var C=0;else for(C=1;1<<C<d;)C*=2;var w=Math.ceil(C*b/32),h=f.length,B=w,k=!1,e=Array.prototype.join.call(n.subarray(0,d*r),",");b=a.get(e);void 0===b&&(k=!0,B+=d*r,b=h+w-c,a.set(e,b));f.resize(h+B);f=f.data;if(0<C)switch(C){case 1:for(c=a=0;a<w;++a)B=0,B|=g[l[c+0]]<<0,B|=
-g[l[c+1]]<<1,B|=g[l[c+2]]<<2,B|=g[l[c+3]]<<3,B|=g[l[c+4]]<<4,B|=g[l[c+5]]<<5,B|=g[l[c+6]]<<6,B|=g[l[c+7]]<<7,B|=g[l[c+8]]<<8,B|=g[l[c+9]]<<9,B|=g[l[c+10]]<<10,B|=g[l[c+11]]<<11,B|=g[l[c+12]]<<12,B|=g[l[c+13]]<<13,B|=g[l[c+14]]<<14,B|=g[l[c+15]]<<15,B|=g[l[c+16]]<<16,B|=g[l[c+17]]<<17,B|=g[l[c+18]]<<18,B|=g[l[c+19]]<<19,B|=g[l[c+20]]<<20,B|=g[l[c+21]]<<21,B|=g[l[c+22]]<<22,B|=g[l[c+23]]<<23,B|=g[l[c+24]]<<24,B|=g[l[c+25]]<<25,B|=g[l[c+26]]<<26,B|=g[l[c+27]]<<27,B|=g[l[c+28]]<<28,B|=g[l[c+29]]<<29,
-B|=g[l[c+30]]<<30,B|=g[l[c+31]]<<31,f[h+a]=B,c+=32;break;case 2:for(c=a=0;a<w;++a)B=0,B|=g[l[c+0]]<<0,B|=g[l[c+1]]<<2,B|=g[l[c+2]]<<4,B|=g[l[c+3]]<<6,B|=g[l[c+4]]<<8,B|=g[l[c+5]]<<10,B|=g[l[c+6]]<<12,B|=g[l[c+7]]<<14,B|=g[l[c+8]]<<16,B|=g[l[c+9]]<<18,B|=g[l[c+10]]<<20,B|=g[l[c+11]]<<22,B|=g[l[c+12]]<<24,B|=g[l[c+13]]<<26,B|=g[l[c+14]]<<28,B|=g[l[c+15]]<<30,f[h+a]=B,c+=16;break;case 4:for(c=a=0;a<w;++a)B=0,B|=g[l[c+0]]<<0,B|=g[l[c+1]]<<4,B|=g[l[c+2]]<<8,B|=g[l[c+3]]<<12,B|=g[l[c+4]]<<16,B|=g[l[c+5]]<<
-20,B|=g[l[c+6]]<<24,B|=g[l[c+7]]<<28,f[h+a]=B,c+=8;break;case 8:for(c=a=0;a<w;++a)B=0,B|=g[l[c+0]]<<0,B|=g[l[c+1]]<<8,B|=g[l[c+2]]<<16,B|=g[l[c+3]]<<24,f[h+a]=B,c+=4;break;case 16:for(c=a=0;a<w;++a)B=0,B|=g[l[c+0]]<<0,B|=g[l[c+1]]<<16,f[h+a]=B,c+=2;break;case 32:for(c=a=0;a<w;++a)B=0,B|=g[l[c+0]]<<0,f[h+a]=B,c+=1}if(k)for(l=h+w,g=0,d*=r;g<d;++g)f[l++]=n[g];return[C,b]};e.a=k;e.b=function(f,c,a,b,d,n,l){var g=f.length,r=b[3];f.resize(g+r);for(var C=0;C<r;++C)f.data[g+C]=f.length,k(f,c,a,b,d+n[3]*C,
-n,l)}},function(p,e,m){e.a=function(b,d,n){n=void 0===n?c.a:n;var l=b.source.spec,g=l.dataType,r=Object(a.i)(b.chunkDataSize),C=f.a[g];l=r*C*l.numChannels;if(l!==d.byteLength)throw Error("Raw-format chunk is "+d.byteLength+" bytes, "+("but "+r+" * "+C+" = "+l+" bytes are expected."));switch(g){case f.b.UINT8:d=new Uint8Array(d);break;case f.b.UINT16:d=new Uint16Array(d);Object(c.c)(d,n);break;case f.b.UINT32:case f.b.UINT64:d=new Uint32Array(d);Object(c.d)(d,n);break;case f.b.FLOAT32:d=new Float32Array(d);
-Object(c.d)(d,n);break;default:throw Error("Unexpected data type: "+g+".");}Object(k.a)(b,d)};var k=m(26),f=m(14),c=m(11),a=m(1)},function(p,e,m){function k(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 f(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){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}m.d(e,"b",function(){return g});m.d(e,"a",function(){return r});e.c=function(c,d){function h(){g=c.value;l=new b.a;d(l,g)}var g,l,n=a()(function(){c.value!==g&&(l.dispose(),h())},0),r=c.changed.add(n);h();return function(){n.cancel();r();l.dispose()}};p=m(69);var a=m.n(p),b=m(13),d=m(8),n=function w(a,
-b,c){null===a&&(a=Function.prototype);var h=Object.getOwnPropertyDescriptor(a,b);if(void 0===h){if(a=Object.getPrototypeOf(a),null!==a)return w(a,b,c)}else{if("value"in h)return h.value;b=h.get;return void 0===b?void 0:b.call(c)}},l=function(){function a(a,b){for(var c=0;c<b.length;c++){var h=b[c];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=function(){function a(b){c(this,
-a);this.value_=b;this.changed=new d.a}l(a,[{key:"value",get:function(){return this.value_},set:function(a){a!==this.value_&&(this.value_=a,this.changed.dispatch())}}]);return a}();(function(a){function b(a,h,d){d=void 0===d?a:d;c(this,b);a=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));a.validator=h;a.defaultValue=d;return a}f(b,a);l(b,[{key:"toJSON",value:function(){if(this.value_!==this.defaultValue)return this.value_}},{key:"reset",value:function(){this.value=this.defaultValue}},
-{key:"restoreState",value:function(a){if(void 0!==a){var b=this.validator;try{this.value=b(a);return}catch(u){}}this.value=this.defaultValue}}]);return b})(g);(function(a){function b(a,h){c(this,b);var g=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));g.changed=new d.a;g.f=a;g.ws=h;a=$jscomp.makeIterator(h);for(h=a.next();!h.done;h=a.next())g.registerDisposer(h.value.changed.add(g.changed.dispatch));return g}f(b,a);l(b,[{key:"value",get:function(){return this.f.apply(this,[].concat($jscomp.arrayFromIterable(this.ws.map(function(a){return a.value}))))}}]);
-return b})(b.a);(function(a){function b(a,h){for(var g=[],l=1;l<arguments.length;++l)g[l-1]=arguments[l];c(this,b);l=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));l.f=a;l.changed=new d.a;g=$jscomp.makeIterator(g);for(var n=g.next();!n.done;n=g.next())l.registerDisposer(n.value.add(l.changed.dispatch));return l}f(b,a);l(b,[{key:"value",get:function(){return this.f()}}]);return b})(b.a);(function(a){function b(a,h){c(this,b);var d=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));
-d.validator=a;d.jsonConverter=h;return d}f(b,a);l(b,[{key:"toJSON",value:function(){var a=this.value;return a&&this.jsonConverter(a)}},{key:"restoreState",value:function(a){this.value=this.validator(a)}}]);return b})(function(a){function b(){c(this,b);var a=k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.changed=new d.a;return a}f(b,a);l(b,[{key:"reset",value:function(){this.value=void 0}},{key:"disposed",value:function(){void 0!==this.value_&&this.value_.dispose();this.value_=
-void 0;n(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"value",get:function(){return this.value_},set:function(a){var b=this,c=this.value_;this.value_=a;void 0!==c&&(c.dispose(),this.valueHandler=void 0);if(void 0!==a){var h=this.valueHandler=function(){b.value_===a&&(b.value_=void 0,b.changed.dispatch())};a.registerDisposer(h)}a!==c&&this.changed.dispatch()}}]);return b}(b.a));var r=function(){function a(b){c(this,a);this.changed=new d.a;this.values=
-void 0===b?new Set:new Set(b)}$jscomp.initSymbol();$jscomp.initSymbolIterator();l(a,[{key:"add",value:function(a){var b=this.values;b.has(a)||(b.add(a),this.changed.dispatch());return this}},{key:"delete",value:function(a){return this.values.delete(a)?(this.changed.dispatch(),!0):!1}},{key:"has",value:function(a){return this.values.has(a)}},{key:Symbol.iterator,value:function(){$jscomp.initSymbol();$jscomp.initSymbolIterator();return this.values[Symbol.iterator]()}},{key:"clear",value:function(){var a=
-this.values;0<a.size&&(a.clear(),this.changed.dispatch())}},{key:"size",get:function(){return this.values.size}}]);return a}()},function(p,e,m){e.a=function(k,f){k.data=new Uint32Array(f)}},function(p,e,m){e.a=function(d,n){var l=d.source.spec;if(l.compressedSegmentationBlockSize){var g=l.dataType;a.clear();var r=d.chunkDataSize;b[0]=r[0];b[1]=r[1];b[2]=r[2];b[3]=l.numChannels;switch(g){case k.a.UINT32:Object(f.a)(a,l.compressedSegmentationBlockSize,n,b);break;case k.a.UINT64:Object(c.a)(a,l.compressedSegmentationBlockSize,
-n,b);break;default:throw Error("Unsupported data type for compressed segmentation: "+k.a[g]);}d.data=new Uint32Array(a.view)}else d.data=n};var k=m(9),f=m(96),c=m(97),a=new (m(98).a)(2E4),b=Array(4)},function(p,e,m){e=m(6).assign;var k=m(104),f=m(107);m=m(50);var c={};e(c,k,f,m);p.exports=c},function(p,e,m){p.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(p,
-e,m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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 c(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});
-b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}m.d(e,"a",function(){return C});p=m(2);var a=m(7),b=m(12),d=m(15),n=m(124),l=function(){function a(a,b){for(var c=0;c<b.length;c++){var h=b[c];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=function h(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=
-Object.getPrototypeOf(a),null!==a)return h(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},r=function(a){function b(){k(this,b);var a=f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.backendOnly=!0;return a}c(b,a);l(b,[{key:"initialize",value:function(a){g(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initialize",this).call(this,a);this.requesters=new Set}},{key:"downloadSucceeded",value:function(){g(b.prototype.__proto__||
-Object.getPrototypeOf(b.prototype),"downloadSucceeded",this).call(this);var a=this.requesters,c=this.data;this.requesters=void 0;a=$jscomp.makeIterator(a);for(var h=a.next();!h.done;h=a.next())h.value.resolve(c)}},{key:"downloadFailed",value:function(a){g(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"downloadFailed",this).call(this,a);var c=this.requesters;this.requesters=void 0;c=$jscomp.makeIterator(c);for(var h=c.next();!h.done;h=c.next())h.value.reject(a)}},{key:"freeSystemMemory",
-value:function(){this.data=void 0}}]);return b}(p.Chunk),C=function(h){function g(a,b){k(this,g);var c=f(this,(g.__proto__||Object.getPrototypeOf(g)).call(this,a));c.decodeFile=b;c.registerDisposer(a);c.registerDisposer(c.chunkManager.recomputeChunkPrioritiesLate.add(function(){c.updateChunkPriorities()}));return c}c(g,h);l(g,[{key:"updateChunkPriorities",value:function(){for(var a=this.chunkManager,b=$jscomp.makeIterator(this.chunks.values()),c=b.next();!c.done;c=b.next()){c=c.value;var h=c.requesters;
-if(void 0!==h){h=$jscomp.makeIterator(h);for(var d=h.next();!d.done;d=h.next())d=d.value.getPriority(),a.requestChunk(c,d.priorityTier,d.priority)}}}},{key:"download",value:function(a,b){var c=this;return Object(d.e)(Object(d.b)(a.key),"arraybuffer",b).then(function(b){a.data=c.decodeFile(b)})}},{key:"getData",value:function(c,h,d){var g=this,l=this.chunks.get(c);void 0===l&&(l=this.getNewChunk_(r),l.initialize(c),this.addChunk(l));return Object(b.d)(d,function(c,d,n){switch(l.state){case a.e.FAILED:d(l.error);
-return;case a.e.SYSTEM_MEMORY_WORKER:c(l.data);return}var t={resolve:c,reject:d,getPriority:h};l.requesters.add(t);n.add(function(){var a=l.requesters;void 0!==a&&(a.delete(t),g.chunkManager.scheduleUpdateChunkPriorities());d(b.a)});g.chunkManager.scheduleUpdateChunkPriorities()})}}],[{key:"get",value:function(a,b){return a.memoize.get("getFileSource:"+Object(n.a)(b),function(){return new g(a,b)})}},{key:"getData",value:function(a,b,c,h,d){a=g.get(a,b);c=a.getData(c,h,d);a.dispose();return c}}]);
-return g}(p.ChunkSourceBase)},function(p,e,m){var k=k||{};k.Utils=k.Utils||{};k.Utils.crcTable=null;k.Utils.GUNZIP_MAGIC_COOKIE1=31;k.Utils.GUNZIP_MAGIC_COOKIE2=139;k.Utils.getStringAt=function(f,c,a){for(var b="",d;c<a;c+=1)d=f.getUint8(c),0!==d&&(b+=String.fromCharCode(d));return b};k.Utils.getByteAt=function(f,c){return f.getInt8(c)};k.Utils.getShortAt=function(f,c,a){return f.getInt16(c,a)};k.Utils.getIntAt=function(f,c,a){return f.getInt32(c,a)};k.Utils.getFloatAt=function(f,c,a){return f.getFloat32(c,
-a)};k.Utils.getDoubleAt=function(f,c,a){return f.getFloat64(c,a)};k.Utils.getLongAt=function(f,c,a){var b,d=[],n=0;for(b=0;8>b;b+=1)d[b]=k.Utils.getByteAt(f,c+b,a);for(b=d.length-1;0<=b;b--)n=256*n+d[b];return n};k.Utils.toArrayBuffer=function(f){var c;var a=new ArrayBuffer(f.length);var b=new Uint8Array(a);for(c=0;c<f.length;c+=1)b[c]=f[c];return a};k.Utils.isString=function(f){return"string"===typeof f||f instanceof String};k.Utils.formatNumber=function(f,c){f=k.Utils.isString(f)?Number(f):f;f=
-c?f.toPrecision(5):f.toPrecision(7);return parseFloat(f)};k.Utils.makeCRCTable=function(){for(var f,c=[],a=0;256>a;a++){f=a;for(var b=0;8>b;b++)f=f&1?3988292384^f>>>1:f>>>1;c[a]=f}return c};k.Utils.crc32=function(f){for(var c=k.Utils.crcTable||(k.Utils.crcTable=k.Utils.makeCRCTable()),a=-1,b=0;b<f.byteLength;b++)a=a>>>8^c[(a^f.getUint8(b))&255];return(a^-1)>>>0};"undefined"!==typeof p&&p.exports&&(p.exports=k.Utils)},function(p,e,m){function k(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 f(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}m.d(e,"a",function(){return n});var c=m(13),a=m(3),b=function g(a,b,c){null===a&&(a=Function.prototype);var h=Object.getOwnPropertyDescriptor(a,b);if(void 0===h){if(a=Object.getPrototypeOf(a),null!==a)return g(a,b,c)}else{if("value"in
-h)return h.value;b=h.get;return void 0===b?void 0:b.call(c)}},d=function(){function a(a,b){for(var c=0;c<b.length;c++){var h=b[c];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),n=function(g){function n(){f(this,n);var a=(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!a||"object"!==typeof a&&"function"!==typeof a?this:a}k(n,g);d(n,[{key:"get",value:function(c,d){"string"!==typeof c&&(c=Object(a.e)(c));return b(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"get",this).call(this,c,d)}},{key:"getUncounted",value:function(a,b){return this.get(a,function(){return new c.b(b())}).value}}]);return n}(function(){function a(){f(this,a);this.map=new Map}d(a,[{key:"get",value:function(a,b){var c=this.map,h=c.get(a);void 0===h?(h=b(),h.registerDisposer(function(){c.delete(a)}),
-c.set(a,h)):h.addRef();return h}}]);return a}())},function(p,e,m){m(4);m(58);m(59);m(33);var k=m(60),f=m(61);m(62);var c=m(34);m(35);m.d(e,"a",function(){return k});m.d(e,"b",function(){return f});m.d(e,"c",function(){return c})},function(p,e,m){e.a=function(){var f=new k.a(9);f[0]=1;f[1]=0;f[2]=0;f[3]=0;f[4]=1;f[5]=0;f[6]=0;f[7]=0;f[8]=1;return f};var k=m(4)},function(p,e,m){function k(){var a=new w.a(3);a[0]=0;a[1]=0;a[2]=0;return a}function f(a){var b=a[0],c=a[1];a=a[2];return Math.sqrt(b*b+c*
-c+a*a)}function c(a,b,c){var h=new w.a(3);h[0]=a;h[1]=b;h[2]=c;return h}function a(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];return a}function b(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];a[2]=b[2]*c[2];return a}function d(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];a[2]=b[2]/c[2];return a}function n(a,b){var c=b[0]-a[0],h=b[1]-a[1];a=b[2]-a[2];return Math.sqrt(c*c+h*h+a*a)}function l(a,b){var c=b[0]-a[0],h=b[1]-a[1];a=b[2]-a[2];return c*c+h*h+a*a}function g(a){var b=a[0],c=a[1];a=a[2];return b*b+c*
-c+a*a}function r(a,b){var c=b[0],h=b[1],d=b[2];c=c*c+h*h+d*d;0<c&&(c=1/Math.sqrt(c),a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c);return a}function C(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}Object.defineProperty(e,"__esModule",{value:!0});e.create=k;e.clone=function(a){var b=new w.a(3);b[0]=a[0];b[1]=a[1];b[2]=a[2];return b};e.length=f;e.fromValues=c;e.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];return a};e.set=function(a,b,c,d){a[0]=b;a[1]=c;a[2]=d;return a};e.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=
-b[1]+c[1];a[2]=b[2]+c[2];return a};e.subtract=a;e.multiply=b;e.divide=d;e.ceil=function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);a[2]=Math.ceil(b[2]);return a};e.floor=function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);a[2]=Math.floor(b[2]);return a};e.min=function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);a[2]=Math.min(b[2],c[2]);return a};e.max=function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);a[2]=Math.max(b[2],c[2]);return a};e.round=function(a,b){a[0]=
-Math.round(b[0]);a[1]=Math.round(b[1]);a[2]=Math.round(b[2]);return a};e.scale=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;return a};e.scaleAndAdd=function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;a[2]=b[2]+c[2]*d;return a};e.distance=n;e.squaredDistance=l;e.squaredLength=g;e.negate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];return a};e.inverse=function(a,b){a[0]=1/b[0];a[1]=1/b[1];a[2]=1/b[2];return a};e.normalize=r;e.dot=C;e.cross=function(a,b,c){var d=b[0],h=b[1];b=b[2];var g=c[0],
-l=c[1];c=c[2];a[0]=h*c-b*l;a[1]=b*g-d*c;a[2]=d*l-h*g;return a};e.lerp=function(a,b,c,d){var h=b[0],g=b[1];b=b[2];a[0]=h+d*(c[0]-h);a[1]=g+d*(c[1]-g);a[2]=b+d*(c[2]-b);return a};e.hermite=function(a,b,c,d,g,l){var h=l*l,n=h*(2*l-3)+1,t=h*(l-2)+l,r=h*(l-1);l=h*(3-2*l);a[0]=b[0]*n+c[0]*t+d[0]*r+g[0]*l;a[1]=b[1]*n+c[1]*t+d[1]*r+g[1]*l;a[2]=b[2]*n+c[2]*t+d[2]*r+g[2]*l;return a};e.bezier=function(a,b,c,d,g,l){var h=1-l,n=h*h,t=l*l,r=n*h;n*=3*l;h*=3*t;l*=t;a[0]=b[0]*r+c[0]*n+d[0]*h+g[0]*l;a[1]=b[1]*r+c[1]*
-n+d[1]*h+g[1]*l;a[2]=b[2]*r+c[2]*n+d[2]*h+g[2]*l;return a};e.random=function(a,b){b=b||1;var c=2*w.c()*Math.PI,d=2*w.c()-1,h=Math.sqrt(1-d*d)*b;a[0]=Math.cos(c)*h;a[1]=Math.sin(c)*h;a[2]=d*b;return a};e.transformMat4=function(a,b,c){var d=b[0],h=b[1];b=b[2];var g=c[3]*d+c[7]*h+c[11]*b+c[15];g=g||1;a[0]=(c[0]*d+c[4]*h+c[8]*b+c[12])/g;a[1]=(c[1]*d+c[5]*h+c[9]*b+c[13])/g;a[2]=(c[2]*d+c[6]*h+c[10]*b+c[14])/g;return a};e.transformMat3=function(a,b,c){var d=b[0],h=b[1];b=b[2];a[0]=d*c[0]+h*c[3]+b*c[6];
-a[1]=d*c[1]+h*c[4]+b*c[7];a[2]=d*c[2]+h*c[5]+b*c[8];return a};e.transformQuat=function(a,b,c){var d=b[0],h=b[1],g=b[2];b=c[0];var l=c[1],n=c[2];c=c[3];var t=c*d+l*g-n*h,r=c*h+n*d-b*g,f=c*g+b*h-l*d;d=-b*d-l*h-n*g;a[0]=t*c+d*-b+r*-n-f*-l;a[1]=r*c+d*-l+f*-b-t*-n;a[2]=f*c+d*-n+t*-l-r*-b;return a};e.rotateX=function(a,b,c,d){var h=[],g=[];h[0]=b[0]-c[0];h[1]=b[1]-c[1];h[2]=b[2]-c[2];g[0]=h[0];g[1]=h[1]*Math.cos(d)-h[2]*Math.sin(d);g[2]=h[1]*Math.sin(d)+h[2]*Math.cos(d);a[0]=g[0]+c[0];a[1]=g[1]+c[1];a[2]=
-g[2]+c[2];return a};e.rotateY=function(a,b,c,d){var h=[],g=[];h[0]=b[0]-c[0];h[1]=b[1]-c[1];h[2]=b[2]-c[2];g[0]=h[2]*Math.sin(d)+h[0]*Math.cos(d);g[1]=h[1];g[2]=h[2]*Math.cos(d)-h[0]*Math.sin(d);a[0]=g[0]+c[0];a[1]=g[1]+c[1];a[2]=g[2]+c[2];return a};e.rotateZ=function(a,b,c,d){var h=[],g=[];h[0]=b[0]-c[0];h[1]=b[1]-c[1];h[2]=b[2]-c[2];g[0]=h[0]*Math.cos(d)-h[1]*Math.sin(d);g[1]=h[0]*Math.sin(d)+h[1]*Math.cos(d);g[2]=h[2];a[0]=g[0]+c[0];a[1]=g[1]+c[1];a[2]=g[2]+c[2];return a};e.angle=function(a,b){a=
-c(a[0],a[1],a[2]);b=c(b[0],b[1],b[2]);r(a,a);r(b,b);b=C(a,b);return 1<b?0:-1>b?Math.PI:Math.acos(b)};e.str=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"};e.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]};e.equals=function(a,b){var c=a[0],d=a[1];a=a[2];var h=b[0],g=b[1];b=b[2];return Math.abs(c-h)<=w.b*Math.max(1,Math.abs(c),Math.abs(h))&&Math.abs(d-g)<=w.b*Math.max(1,Math.abs(d),Math.abs(g))&&Math.abs(a-b)<=w.b*Math.max(1,Math.abs(a),Math.abs(b))};var w=m(4);e.sub=
-a;e.mul=b;e.div=d;e.dist=n;e.sqrDist=l;e.len=f;e.sqrLen=g;p=function(){var a=k();return function(b,c,d,g,h,l){c||(c=3);d||(d=0);for(g=g?Math.min(g*c+d,b.length):b.length;d<g;d+=c)a[0]=b[d],a[1]=b[d+1],a[2]=b[d+2],h(a,a,l),b[d]=a[0],b[d+1]=a[1],b[d+2]=a[2];return b}}();e.forEach=p},function(p,e,m){function k(){var c=new f.a(4);c[0]=0;c[1]=0;c[2]=0;c[3]=0;return c}e.b=function(c){var a=new f.a(4);a[0]=c[0];a[1]=c[1];a[2]=c[2];a[3]=c[3];return a};e.g=function(c,a,b,d){var n=new f.a(4);n[0]=c;n[1]=a;
-n[2]=b;n[3]=d;return n};e.c=function(c,a){c[0]=a[0];c[1]=a[1];c[2]=a[2];c[3]=a[3];return c};e.l=function(c,a,b,d,n){c[0]=a;c[1]=b;c[2]=d;c[3]=n;return c};e.a=function(c,a,b){c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];c[3]=a[3]+b[3];return c};e.k=function(c,a,b){c[0]=a[0]*b;c[1]=a[1]*b;c[2]=a[2]*b;c[3]=a[3]*b;return c};e.h=function(c){var a=c[0],b=c[1],d=c[2];c=c[3];return Math.sqrt(a*a+b*b+d*d+c*c)};e.m=function(c){var a=c[0],b=c[1],d=c[2];c=c[3];return a*a+b*b+d*d+c*c};e.j=function(c,a){var b=
-a[0],d=a[1],n=a[2];a=a[3];var l=b*b+d*d+n*n+a*a;0<l&&(l=1/Math.sqrt(l),c[0]=b*l,c[1]=d*l,c[2]=n*l,c[3]=a*l);return c};e.d=function(c,a){return c[0]*a[0]+c[1]*a[1]+c[2]*a[2]+c[3]*a[3]};e.i=function(c,a,b,d){var n=a[0],l=a[1],g=a[2];a=a[3];c[0]=n+d*(b[0]-n);c[1]=l+d*(b[1]-l);c[2]=g+d*(b[2]-g);c[3]=a+d*(b[3]-a);return c};e.f=function(c,a){return c[0]===a[0]&&c[1]===a[1]&&c[2]===a[2]&&c[3]===a[3]};e.e=function(c,a){var b=c[0],d=c[1],n=c[2];c=c[3];var l=a[0],g=a[1],r=a[2];a=a[3];return Math.abs(b-l)<=
-f.b*Math.max(1,Math.abs(b),Math.abs(l))&&Math.abs(d-g)<=f.b*Math.max(1,Math.abs(d),Math.abs(g))&&Math.abs(n-r)<=f.b*Math.max(1,Math.abs(n),Math.abs(r))&&Math.abs(c-a)<=f.b*Math.max(1,Math.abs(c),Math.abs(a))};var f=m(4);(function(){var c=k();return function(a,b,d,n,l,g){b||(b=4);d||(d=0);for(n=n?Math.min(n*b+d,a.length):a.length;d<n;d+=b)c[0]=a[d],c[1]=a[d+1],c[2]=a[d+2],c[3]=a[d+3],l(c,c,g),a[d]=c[0],a[d+1]=c[1],a[d+2]=c[2],a[d+3]=c[3];return a}})()},function(p,e){p.exports=function(e){var k=typeof e;
-return null!=e&&("object"==k||"function"==k)}},function(p,e,m){e=m(71);m="object"==typeof self&&self&&self.Object===Object&&self;e=e||m||Function("return this")();p.exports=e},function(p,e,m){e=m(37).Symbol;p.exports=e},function(p,e,m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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 c(a,
-b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(e,"__esModule",{value:!0});m.d(e,"PerspectiveViewState",function(){return b});m.d(e,"PerspectiveViewRenderLayer",function(){return d});p=m(79);var a=m(24);m=m(0);e=this&&this.__decorate||
-function(a,b,c,d){var g=arguments.length,l=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,h;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)l=Reflect.decorate(a,b,c,d);else for(var n=a.length-1;0<=n;n--)if(h=a[n])l=(3>g?h(l):3<g?h(b,c,l):h(b,c))||l;return 3<g&&l&&Object.defineProperty(b,c,l),l};var b=function(a){function b(a){for(var c=[],d=0;d<arguments.length;++d)c[d-0]=arguments[d];k(this,b);var g;d=f(this,(g=b.__proto__||Object.getPrototypeOf(b)).call.apply(g,[].concat([this],
-$jscomp.arrayFromIterable(c))));d.visibility=c[0].get(c[1].visibility);return d}c(b,a);return b}(m.c);b=e([Object(m.g)(p.c)],b);var d=function(b){function d(){k(this,d);var b=f(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));b.viewStates=new a.a;return b}c(d,b);return d}(m.c);Object(m.f)(p.a,function(a){var b=this.get(a.view);this.get(a.layer).viewStates.add(b)});Object(m.f)(p.b,function(a){var b=this.get(a.view);this.get(a.layer).viewStates.delete(b)})},function(p,e,m){function k(a,
-b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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 c(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?
-Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a){return function(a){function b(){k(this,b);return f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}c(b,a);B(b,[{key:"serialize",value:function(a,c){I(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"serialize",this).call(this,a,c);this.data.serialize(a,c);this.data=void 0}},{key:"downloadSucceeded",value:function(){this.systemMemoryBytes=this.gpuMemoryBytes=this.data.numBytes;I(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),
-"downloadSucceeded",this).call(this)}},{key:"freeSystemMemory",value:function(){this.data=void 0}}]);return b}(a)}Object.defineProperty(e,"__esModule",{value:!0});m.d(e,"AnnotationMetadataChunk",function(){return u});m.d(e,"AnnotationGeometryData",function(){return x});m.d(e,"AnnotationGeometryChunk",function(){return J});m.d(e,"AnnotationSubsetGeometryChunk",function(){return v});m.d(e,"AnnotationSource",function(){return t});var b=m(41),d=m(81);p=m(2);var n=m(7),l=m(39),g=m(21),r=m(19),C=m(24),
-w=m(1),h=m(10);m=m(0);var B=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),I=function H(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return H(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:
-b.call(c)}};e=this&&this.__decorate||function(a,b,c,d){var q=arguments.length,g=3>q?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,h;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)g=Reflect.decorate(a,b,c,d);else for(var l=a.length-1;0<=l;l--)if(h=a[l])g=(3>q?h(g):3<q?h(b,c,g):h(b,c))||g;return 3<q&&g&&Object.defineProperty(b,c,g),g};var u=function(a){function b(){k(this,b);return f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}c(b,a);B(b,[{key:"freeSystemMemory",
-value:function(){this.annotation=void 0}},{key:"serialize",value:function(a,c){I(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"serialize",this).call(this,a,c);a.annotation=this.annotation}},{key:"downloadSucceeded",value:function(){this.systemMemoryBytes=this.gpuMemoryBytes=0;I(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"downloadSucceeded",this).call(this)}}]);return b}(p.Chunk),x=function(){function a(){k(this,a)}B(a,[{key:"serialize",value:function(a,b){a.data=this.data;
-a.typeToOffset=this.typeToOffset;a.typeToIds=this.typeToIds;a.segmentList=this.segmentList;a.segmentListIndex=this.segmentListIndex;b.push(this.data.buffer,this.segmentList.buffer,this.segmentListIndex.buffer)}},{key:"numBytes",get:function(){return this.data.byteLength}}]);return a}(),J=function(a){function b(){k(this,b);return f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}c(b,a);return b}(a(r.SliceViewChunk)),v=function(a){function b(){k(this,b);return f(this,(b.__proto__||
-Object.getPrototypeOf(b)).apply(this,arguments))}c(b,a);return b}(a(p.Chunk)),A=function(a){function b(){k(this,b);var a=f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.parent=void 0;return a}c(b,a);B(b,[{key:"getChunk",value:function(a){var b=this.chunks.get(a);void 0===b&&(b=this.getNewChunk_(u),b.initialize(a),this.addChunk(b));return b}},{key:"download",value:function(a,b){return this.parent.downloadMetadata(a,b)}}]);return b}(p.ChunkSource);A=e([Object(m.g)(d.d)],A);r=
-function(a){function b(a,c){k(this,b);a=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));a.parent=void 0;a.spec=new d.k(c.spec);return a}c(b,a);B(b,[{key:"download",value:function(a,b){return this.parent.downloadGeometry(a,b)}}]);return b}(r.SliceViewChunkSource);r=e([Object(m.g)(d.c)],r);r.prototype.chunkConstructor=J;r=function(a){function b(a,c){k(this,b);a=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));a.parent=void 0;return a}c(b,a);B(b,[{key:"getChunk",value:function(a){var b=
-Object(g.b)(a),c=this.chunks.get(b);void 0===c&&(c=this.getNewChunk_(v),c.initialize(b),c.objectId=a.clone(),this.addChunk(c));return c}},{key:"download",value:function(a,b){return this.parent.downloadSegmentFilteredGeometry(a,b)}}]);return b}(p.ChunkSource);r=e([Object(m.g)(d.j)],r);var t=function(a){function b(a,c){k(this,b);var d=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));d.references=new Set;var q=d.chunkManager=a.get(c.chunkManager),g=d.metadataChunkSource=d.registerDisposer(a.getRef(c.metadataChunkSource));
-d.sources=c.sources.map(function(b){return b.map(function(b){b=d.registerDisposer(a.getRef(b));b.parent=d;return b})});d.segmentFilteredSource=d.registerDisposer(a.getRef(c.segmentFilteredSource));d.segmentFilteredSource.parent=d;g.parent=d;d.registerDisposer(q.recomputeChunkPriorities.add(function(){return d.recomputeChunkPriorities()}));return d}c(b,a);B(b,[{key:"recomputeChunkPriorities",value:function(){for(var a=this.chunkManager,b=this.metadataChunkSource,c=$jscomp.makeIterator(this.references),
-d=c.next();!d.done;d=c.next())a.requestChunk(b.getChunk(d.value),n.d.VISIBLE,200)}},{key:"add",value:function(a){a;throw Error("Not implemented");}},{key:"delete",value:function(a){a;throw Error("Not implemented");}},{key:"update",value:function(a,b){a;b;throw Error("Not implemented");}}]);return b}(m.c);Object(m.f)(d.f,function(a){var b=this.get(a.id);b.references.add(a.annotation);b.chunkManager.scheduleUpdateChunkPriorities()});Object(m.f)(d.g,function(a){var b=this.get(a.id);b.references.delete(a.annotation);
-b.chunkManager.scheduleUpdateChunkPriorities()});Object(m.f)(d.b,function(a){var c=this,g=this.get(a.id),h=a.annotationId,l=Object(b.c)(a.newAnnotation);(void 0===h?g.add(l).then(function(a){return Object.assign({},l,{id:a})}):null===l?g.delete(h).then(function(){return null}):g.update(h,l).then(function(){return l})).then(function(a){g.wasDisposed||c.invoke(d.a,{id:g.rpcId,annotationId:h||l.id,newAnnotation:a})},function(a){g.wasDisposed||c.invoke(d.a,{id:g.rpcId,annotationId:h,error:a.message})})});
-l=function(a){function b(a,c){k(this,b);var d=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));d.source=a.get(c.source);d.filterBySegmentation=a.get(c.filterBySegmentation);d.viewStates.changed.add(function(){return d.source.chunkManager.scheduleUpdateChunkPriorities()});d.filterBySegmentation.changed.add(function(){return d.source.chunkManager.scheduleUpdateChunkPriorities()});d.registerDisposer(d.source.chunkManager.recomputeChunkPriorities.add(function(){return d.recomputeChunkPriorities()}));
-return d}c(b,a);B(b,[{key:"recomputeChunkPriorities",value:function(){var a=this.source;if(!this.filterBySegmentation.value)for(var b=$jscomp.makeIterator(this.viewStates),c=b.next();!c.done;c=b.next()){var d=c.value.visibility.value;if(d!==Number.NEGATIVE_INFINITY){c=Object(h.b)(d);d=Object(h.a)(d);for(var g=$jscomp.makeIterator(a.sources),q=g.next();!q.done;q=g.next()){q=$jscomp.makeIterator(q.value);for(var l=q.next();!l.done;l=q.next())l=l.value.getChunk(w.g),a.chunkManager.requestChunk(l,c,d)}}}}}]);
-return b}(l.PerspectiveViewRenderLayer);l=e([Object(m.g)(d.e)],l);l;p=function(a){function b(a,c){k(this,b);var d=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));d.segmentationState=new C.b(void 0);d.source=a.get(c.source);d.segmentationState.value=d.getSegmentationState(c.segmentationState);var g=function(){return d.chunkManager.scheduleUpdateChunkPriorities()};d.registerDisposer(Object(C.c)(d.segmentationState,function(a,b){null!=b&&(a.registerDisposer(b.visibleSegments.changed.add(g)),
-a.registerDisposer(b.segmentEquivalences.changed.add(g)))}));d.registerDisposer(d.chunkManager.recomputeChunkPriorities.add(function(){return d.recomputeChunkPriorities()}));return d}c(b,a);B(b,[{key:"recomputeChunkPriorities",value:function(){var a=this.segmentationState.value;if(null!=a){var b=this.visibility.value;if(b!==Number.NEGATIVE_INFINITY){var c=Object(h.b)(b),d=Object(h.a)(b),q=this.chunkManager,l=this.source.segmentFilteredSource;Object(g.a)(a,function(a){a=l.getChunk(a);q.requestChunk(a,
-c,d+60)})}}}},{key:"getSegmentationState",value:function(a){return null==a?a:{visibleSegments:this.rpc.get(a.visibleSegments),segmentEquivalences:this.rpc.get(a.segmentEquivalences)}}}]);return b}(Object(h.c)(Object(p.withChunkManager)(m.c)));p=e([Object(m.g)(d.h)],p);p;Object(m.f)(d.i,function(a){var b=this.get(a.id);b.segmentationState.value=b.getSegmentationState(a.segmentationState)})},function(p,e,m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
-}function f(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 c(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a){var b=
-x.get(a.type).toJSON(a);b.type=I[a.type].toLowerCase();b.id=a.id;b.description=a.description||void 0;a=a.segments;void 0!==a&&0<a.length&&(b.segments=a.map(function(a){return a.toString()}));return b}function b(a,b){b=void 0===b?!1:b;Object(g.i)(a);var c=Object(g.j)(a,"type",function(a){return Object(g.h)(a,I)});b={id:Object(g.j)(a,"id",b?g.k:g.l)||Object(r.a)(160),description:Object(g.j)(a,"description",g.k),segments:Object(g.j)(a,"segments",function(a){return void 0===a?void 0:Object(g.a)(a,function(a){return w.a.parseString(a)})}),
-type:c};x.get(c).restoreState(b,a);return b}function d(a,b){return a.id<b.id?-1:a.id===b.id?0:1}function n(a){for(var b=0,c=[],g=0,h=0,q=$jscomp.makeIterator(u),l=q.next();!l.done;l=q.next()){l=l.value;c[l]=b;for(var n=a[l],r=0,f=$jscomp.makeIterator(n),w=f.next();!w.done;w=f.next())w=w.value.segments,void 0!==w&&(r+=w.length);h+=n.length;g+=r;n.sort(d);n=n.length;l=x.get(l);b+=l.serializedBytes*n}var k=new Uint32Array(h+1),e=new Uint32Array(2*g);g=[];b=new ArrayBuffer(b);var C=0,m=0;h={};q=$jscomp.makeIterator(u);
-for(l=q.next();!l.done;h={serializer:h.serializer},l=q.next())l=l.value,n=a[l],g[l]=n.map(function(a){return a.id}),r=n.length,f=x.get(l),h.serializer=f.serializer(b,c[l],r),n.forEach(function(a){return function(b,c){a.serializer(b,c);k[m++]=C;b=b.segments;if(void 0!==b)for(b=$jscomp.makeIterator(b),c=b.next();!c.done;c=b.next())c=c.value,e[2*C]=c.low,e[2*C+1]=c.high,++C}}(h));return{data:new Uint8Array(b),typeToIds:g,typeToOffset:c,segmentListIndex:k,segmentList:e}}m.d(e,"b",function(){return I});
-m.d(e,"a",function(){return J});e.c=function(a){if(null==a)return a;var b=a.segments;void 0!==b&&(a.segments=b.map(function(a){return new w.a(a.low,a.high)}));return a};p=m(13);var l=m(1),g=m(3),r=m(80),C=m(8),w=m(5),h=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),B=function(a){function b(a){k(this,b);var c=
-f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.id=a;c.changed=new C.a;return c}c(b,a);return b}(p.a),I;(function(a){a[a.POINT=0]="POINT";a[a.LINE=1]="LINE";a[a.AXIS_ALIGNED_BOUNDING_BOX=2]="AXIS_ALIGNED_BOUNDING_BOX";a[a.ELLIPSOID=3]="ELLIPSOID"})(I||(I={}));var u=[I.POINT,I.LINE,I.AXIS_ALIGNED_BOUNDING_BOX,I.ELLIPSOID],x=new Map;x.set(I.LINE,{icon:"\ua579",description:"Line",toJSON:function(a){return{pointA:Array.from(a.pointA),pointB:Array.from(a.pointB)}},restoreState:function(a,
-b){a.pointA=Object(g.j)(b,"pointA",g.g);a.pointB=Object(g.j)(b,"pointB",g.g)},serializedBytes:24,serializer:function(a,b,c){var d=new Float32Array(a,b,6*c);return function(a,b){var c=a.pointA;a=a.pointB;b*=6;d[b]=c[0];d[b+1]=c[1];d[b+2]=c[2];d[b+3]=a[0];d[b+4]=a[1];d[b+5]=a[2]}}});x.set(I.POINT,{icon:"\u26ac",description:"Point",toJSON:function(a){return{point:Array.from(a.point)}},restoreState:function(a,b){a.point=Object(g.j)(b,"point",g.g)},serializedBytes:12,serializer:function(a,b,c){var d=new Float32Array(a,
-b,3*c);return function(a,b){a=a.point;b*=3;d[b]=a[0];d[b+1]=a[1];d[b+2]=a[2]}}});x.set(I.AXIS_ALIGNED_BOUNDING_BOX,{icon:"\u2751",description:"Bounding Box",toJSON:function(a){return{pointA:Array.from(a.pointA),pointB:Array.from(a.pointB)}},restoreState:function(a,b){a.pointA=Object(g.j)(b,"pointA",g.g);a.pointB=Object(g.j)(b,"pointB",g.g)},serializedBytes:24,serializer:function(a,b,c){var d=new Float32Array(a,b,6*c);return function(a,b){var c=a.pointA;a=a.pointB;b*=6;d[b]=Math.min(c[0],a[0]);d[b+
-1]=Math.min(c[1],a[1]);d[b+2]=Math.min(c[2],a[2]);d[b+3]=Math.max(c[0],a[0]);d[b+4]=Math.max(c[1],a[1]);d[b+5]=Math.max(c[2],a[2])}}});x.set(I.ELLIPSOID,{icon:"\u25ce",description:"Ellipsoid",toJSON:function(a){return{center:Array.from(a.center),radii:Array.from(a.radii)}},restoreState:function(a,b){a.center=Object(g.j)(b,"center",g.g);a.radii=Object(g.j)(b,"radii",g.f)},serializedBytes:24,serializer:function(a,b,c){var d=new Float32Array(a,b,6*c);return function(a,b){var c=a.radii;b*=6;d.set(a.center,
-b);d.set(c,b+3)}}});(function(a){function b(){k(this,b);return f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}c(b,a);return b})(function(d){function n(a){a=void 0===a?l.h.create():a;k(this,n);var b=f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this));b.objectToLocal=a;b.annotationMap=new Map;b.changed=new C.a;b.readonly=!1;b.pending=new Set;b.references=new Map;return b}c(n,d);$jscomp.initSymbol();$jscomp.initSymbolIterator();h(n,[{key:"add",value:function(a,b){b=void 0===
-b?!0:b;if(!a.id)a.id=Object(r.a)(160);else if(this.annotationMap.has(a.id))throw Error("Annotation id already exists: "+JSON.stringify(a.id)+".");this.annotationMap.set(a.id,a);this.changed.dispatch();b||this.pending.add(a.id);return this.getReference(a.id)}},{key:"commit",value:function(a){this.pending.delete(a.id)}},{key:"update",value:function(a,b){if(null===a.value)throw Error("Annotation already deleted.");a.value=b;this.annotationMap.set(b.id,b);a.changed.dispatch();this.changed.dispatch()}},
-{key:Symbol.iterator,value:function(){return this.annotationMap.values()}},{key:"get",value:function(a){return this.annotationMap.get(a)}},{key:"delete",value:function(a){null!==a.value&&(a.value=null,this.annotationMap.delete(a.id),this.pending.delete(a.id),a.changed.dispatch(),this.changed.dispatch())}},{key:"getReference",value:function(a){var b=this,c=this.references.get(a);if(void 0!==c)return c.addRef();c=new B(a);c.value=this.annotationMap.get(a)||null;this.references.set(a,c);c.registerDisposer(function(){b.references.delete(a)});
-return c}},{key:"toJSON",value:function(){for(var b=[],c=this.pending,d=$jscomp.makeIterator(this),g=d.next();!g.done;g=d.next())g=g.value,c.has(g.id)||b.push(a(g));return b}},{key:"clear",value:function(){this.annotationMap.clear();this.pending.clear();this.changed.dispatch()}},{key:"restoreState",value:function(a){var c=this.annotationMap;c.clear();this.pending.clear();void 0!==a&&Object(g.a)(a,function(a){a=b(a);c.set(a.id,a)});a=$jscomp.makeIterator(this.references.values());for(var d=a.next();!d.done;d=
-a.next()){d=d.value;var h=c.get(d.id);d.value=h||null;d.changed.dispatch()}this.changed.dispatch()}},{key:"reset",value:function(){this.clear()}}]);return n}(p.a));var J=function(){function a(){k(this,a);this.annotations=[[],[],[],[]]}h(a,[{key:"add",value:function(a){this.annotations[a.type].push(a)}},{key:"serialize",value:function(){return n(this.annotations)}}]);return a}()},function(p,e,m){function k(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 f(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}m.d(e,"a",function(){return c});m(90);m(92);p=m(2);e=m(10);m=m(0);var c=function(a){function b(a,c){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");
-var d=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));d.visibleSegments=a.get(c.visibleSegments);d.clipBounds=a.get(c.clipBounds);d.segmentEquivalences=a.get(c.segmentEquivalences);a=function(){d.chunkManager.scheduleUpdateChunkPriorities()};d.registerDisposer(d.visibleSegments.changed.add(a));d.registerDisposer(d.segmentEquivalences.changed.add(a));d.registerDisposer(d.clipBounds.changed.add(a));return d}f(b,a);return b}(Object(e.c)(Object(p.withChunkManager)(m.c)))},function(p,e,
-m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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 c(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});
-b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}m.d(e,"a",function(){return h});e.b=function(b,c,d,g,h,l,n){Object(a.e)(b,2,c,d,g,h,l,n)};e=m(2);var a=m(17),b=m(42),d=m(21);p=m(95);var n=m(5),l=m(10);m=m(0);var g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),r=function I(a,b,c){null===
-a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return I(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},C=this&&this.__decorate||function(a,b,c,d){var g=arguments.length,h=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,l;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)h=Reflect.decorate(a,b,c,d);else for(var n=a.length-1;0<=n;n--)if(l=a[n])h=(3>g?l(h):3<g?
-l(b,c,h):l(b,c))||h;return 3<g&&h&&Object.defineProperty(b,c,h),h},w=function(a){function b(){k(this,b);var a=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));a.objectId=new n.a;a.vertexPositions=null;a.vertexAttributes=null;a.indices=null;return a}c(b,a);g(b,[{key:"initializeSkeletonChunk",value:function(a,c){r(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initialize",this).call(this,a);this.objectId.assign(c)}},{key:"freeSystemMemory",value:function(){this.vertexPositions=
-this.indices=null}},{key:"getVertexAttributeBytes",value:function(){var a=this.vertexPositions.byteLength,b=this.vertexAttributes;null!=b&&b.forEach(function(b){a+=b.byteLength});return a}},{key:"serialize",value:function(a,c){r(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"serialize",this).call(this,a,c);var d=this.vertexPositions,g=this.indices;a.indices=g;c.push(g.buffer);g=this.vertexAttributes;if(null!=g&&0<g.length){var h=new Uint8Array(this.getVertexAttributeBytes());h.set(new Uint8Array(d.buffer,
-d.byteOffset,d.byteLength));var l=a.vertexAttributeOffsets=new Uint32Array(g.length+1);l[0]=0;var n=d.byteLength;g.forEach(function(a,b){l[b+1]=n;h.set(new Uint8Array(a.buffer,a.byteOffset,a.byteLength),n);n+=a.byteLength});c.push(h.buffer);a.vertexAttributes=h}else a.vertexAttributes=new Uint8Array(d.buffer,d.byteOffset,d.byteLength),a.vertexAttributeOffsets=Uint32Array.of(0),d.buffer!==c[0]&&c.push(d.buffer);this.vertexPositions=this.indices=this.vertexAttributes=null}},{key:"downloadSucceeded",
-value:function(){this.systemMemoryBytes=this.gpuMemoryBytes=this.indices.byteLength+this.getVertexAttributeBytes();r(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"downloadSucceeded",this).call(this)}}]);return b}(e.Chunk),h=function(a){function b(){k(this,b);return f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}c(b,a);g(b,[{key:"getChunk",value:function(a){var b=Object(d.b)(a),c=this.chunks.get(b);void 0===c&&(c=this.getNewChunk_(w),c.initializeSkeletonChunk(b,
-a),this.addChunk(c));return c}}]);return b}(e.ChunkSource);e=function(a){function b(a,c){k(this,b);var d=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));d.source=d.registerDisposer(a.getRef(c.source));d.registerDisposer(d.chunkManager.recomputeChunkPriorities.add(function(){d.updateChunkPriorities()}));return d}c(b,a);g(b,[{key:"updateChunkPriorities",value:function(){var a=this.visibility.value;if(a!==Number.NEGATIVE_INFINITY){var b=Object(l.b)(a),c=Object(l.a)(a),g=this.source,h=
-this.chunkManager;Object(d.a)(this,function(a){a=g.getChunk(a);h.requestChunk(a,b,c+60)})}}}]);return b}(b.a);e=C([Object(m.g)(p.a)],e)},function(p,e,m){function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}m.d(e,"c",function(){return n});
-m.d(e,"b",function(){return l});var f=m(9),c=m(14),a=m(1);m.d(e,"a",function(){return c.b});var b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),d=function r(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return r(a,
-b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},n;(function(a){a[a.UNKNOWN=0]="UNKNOWN";a[a.IMAGE=1]="IMAGE";a[a.SEGMENTATION=2]="SEGMENTATION"})(n||(n={}));var l=function(l){function r(b){if(!(this instanceof r))throw new TypeError("Cannot call a class as a function");for(var d=void 0===b.lowerVoxelBound?a.g:b.lowerVoxelBound,l=b.upperVoxelBound,n=b.chunkDataSize,f=b.voxelSize,k=b.transform,e=void 0===b.baseVoxelOffset?a.g:b.baseVoxelOffset,w=void 0===b.lowerClipBound?
-a.m.multiply(a.m.create(),f,d):b.lowerClipBound,m=void 0===b.upperClipBound?a.m.multiply(a.m.create(),f,l):b.upperClipBound,t=a.m.multiply(a.m.create(),n,f),C=a.m.create(),p=a.m.create(),q=0;3>q;++q)C[q]=Math.floor(d[q]/n[q]),p[q]=Math.floor((l[q]-1)/n[q]+1);f=(r.__proto__||Object.getPrototypeOf(r)).call(this,{voxelSize:f,transform:k,lowerChunkBound:C,upperChunkBound:p,chunkSize:t});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.baseVoxelOffset=e;f.lowerClipBound=w;f.upperClipBound=m;f.lowerVoxelBound=d;f.upperVoxelBound=l;f.chunkDataSize=n;d=f.dataType=b.dataType;l=f.numChannels=b.numChannels;f.chunkBytes=Object(a.i)(n)*c.a[d]*l;f.compressedSegmentationBlockSize=b.compressedSegmentationBlockSize;return f}k(r,l);b(r,[{key:"toObject",value:function(){return Object.assign({},d(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"toObject",this).call(this),{numChannels:this.numChannels,chunkDataSize:this.chunkDataSize,
-dataType:this.dataType,lowerVoxelBound:this.lowerVoxelBound,upperVoxelBound:this.upperVoxelBound,lowerClipBound:this.lowerClipBound,upperClipBound:this.upperClipBound,baseVoxelOffset:this.baseVoxelOffset,compressedSegmentationBlockSize:this.compressedSegmentationBlockSize})}}],[{key:"make",value:function(a){return new r(Object.assign({},a,{transform:Object(f.k)(a.transform,a.volumeSourceOptions)}))}},{key:"fromObject",value:function(a){return new r(a)}},{key:"withDefaultCompression",value:function(a){var b=
-a.compressedSegmentationBlockSize,d=a.dataType,l=a.voxelSize,k=a.transform,e=a.lowerVoxelBound,w=a.upperVoxelBound;k=Object(f.k)(k,a.volumeSourceOptions);void 0!==b||a.volumeType!==n.SEGMENTATION||d!==c.b.UINT32&&d!==c.b.UINT64||(b=Object(f.l)({voxelSize:l,transform:k,lowerVoxelBound:e,upperVoxelBound:w,maxVoxelsPerChunkLog2:9}));return new r(Object.assign({},a,{compressedSegmentationBlockSize:b,transform:k}))}},{key:"getDefaults",value:function(a){var b=Object.assign({},a,{transform:Object(f.k)(a.transform,
-a.volumeSourceOptions)});return(void 0===a.chunkDataSizes?Object(f.j)(b):a.chunkDataSizes).map(function(b){return r.withDefaultCompression(Object.assign({},a,{chunkDataSize:b}))})}}]);return r}(f.i)},function(p,e,m){function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,
-b):a.__proto__=b)}Object.defineProperty(e,"__esModule",{value:!0});m.d(e,"NDStoreVolumeChunkSource",function(){return r});p=m(2);e=m(101);var f=m(18),c=m(102),a=m(23),b=m(16),d=m(15);m=m(0);var n=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),l=this&&this.__decorate||function(a,b,c,d){var g=arguments.length,
-h=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,l;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)h=Reflect.decorate(a,b,c,d);else for(var n=a.length-1;0<=n;n--)if(l=a[n])h=(3>g?l(h):3<g?l(b,c,h):l(b,c))||h;return 3<g&&h&&Object.defineProperty(b,c,h),h},g=new Map;g.set("npz",c.a);g.set("jpeg",f.a);g.set("raw",a.a);var r=function(a){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,
-arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a.chunkDecoder=g.get(a.parameters.encoding);return a}k(b,a);n(b,[{key:"download",value:function(a,b){for(var c=this,g=this.parameters,h=g.urlPrefix+"/"+g.key+"/"+g.channel+"/"+(g.encoding+"/"+g.resolution),l=this.computeChunkBounds(a),n=a.chunkDataSize,r=0;3>r;++r)h+="/"+l[r]+","+(l[r]+n[r]);g.neariso&&(h+="/neariso/");return Object(d.e)(Object(d.c)(g.baseUrls,
-h),"arraybuffer",b).then(function(b){return c.chunkDecoder(a,b)})}}]);return b}(Object(p.WithParameters)(b.a,e.a));r=l([Object(m.g)()],r)},function(p,e,m){p.exports=function(k,f,c,a){var b=k&65535|0;k=k>>>16&65535|0;for(var d;0!==c;){d=2E3<c?2E3:c;c-=d;do b=b+f[a++]|0,k=k+b|0;while(--d);b%=65521;k%=65521}return b|k<<16|0}},function(p,e,m){var k=function(){for(var f,c=[],a=0;256>a;a++){f=a;for(var b=0;8>b;b++)f=f&1?3988292384^f>>>1:f>>>1;c[a]=f}return c}();p.exports=function(f,c,a,b){a=b+a;for(f^=
--1;b<a;b++)f=f>>>8^k[(f^c[b])&255];return f^-1}},function(p,e,m){function k(b,n){if(65537>n&&(b.subarray&&a||!b.subarray&&c))return String.fromCharCode.apply(null,f.shrinkBuf(b,n));for(var d="",g=0;g<n;g++)d+=String.fromCharCode(b[g]);return d}var f=m(6),c=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(d){c=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(d){a=!1}var b=new f.Buf8(256);for(p=0;256>p;p++)b[p]=252<=p?6:248<=p?5:240<=p?4:224<=p?3:192<=p?2:1;b[254]=b[254]=1;e.string2buf=
-function(a){var b,c,d=a.length,r=0;for(b=0;b<d;b++){var k=a.charCodeAt(b);if(55296===(k&64512)&&b+1<d){var e=a.charCodeAt(b+1);56320===(e&64512)&&(k=65536+(k-55296<<10)+(e-56320),b++)}r+=128>k?1:2048>k?2:65536>k?3:4}var h=new f.Buf8(r);for(b=c=0;c<r;b++)k=a.charCodeAt(b),55296===(k&64512)&&b+1<d&&(e=a.charCodeAt(b+1),56320===(e&64512)&&(k=65536+(k-55296<<10)+(e-56320),b++)),128>k?h[c++]=k:(2048>k?h[c++]=192|k>>>6:(65536>k?h[c++]=224|k>>>12:(h[c++]=240|k>>>18,h[c++]=128|k>>>12&63),h[c++]=128|k>>>6&
-63),h[c++]=128|k&63);return h};e.buf2binstring=function(a){return k(a,a.length)};e.binstring2buf=function(a){for(var b=new f.Buf8(a.length),c=0,d=b.length;c<d;c++)b[c]=a.charCodeAt(c);return b};e.buf2string=function(a,c){var d,g=c||a.length,n=Array(2*g);for(c=d=0;c<g;){var f=a[c++];if(128>f)n[d++]=f;else{var e=b[f];if(4<e)n[d++]=65533,c+=e-1;else{for(f&=2===e?31:3===e?15:7;1<e&&c<g;)f=f<<6|a[c++]&63,e--;1<e?n[d++]=65533:65536>f?n[d++]=f:(f-=65536,n[d++]=55296|f>>10&1023,n[d++]=56320|f&1023)}}}return k(n,
-d)};e.utf8border=function(a,c){var d;c=c||a.length;c>a.length&&(c=a.length);for(d=c-1;0<=d&&128===(a[d]&192);)d--;return 0>d||0===d?c:d+b[a[d]]>c?d:c}},function(p,e,m){p.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(p,e,m){p.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(p,e,m){var k=k||{};k.Utils=k.Utils||m(30);k.NIFTI1=k.NIFTI1||function(){this.littleEndian=!1;this.dim_info=0;this.dims=[];this.slice_code=this.slice_end=this.slice_start=this.numBitsPerVoxel=this.datatypeCode=this.intent_code=
-this.intent_p3=this.intent_p2=this.intent_p1=0;this.pixDims=[];this.vox_offset=0;this.scl_slope=1;this.toffset=this.slice_duration=this.cal_min=this.cal_max=this.xyzt_units=this.scl_inter=0;this.intent_name=this.aux_file=this.description="";this.qoffset_z=this.qoffset_y=this.qoffset_x=this.quatern_d=this.quatern_c=this.quatern_b=this.sform_code=this.qform_code=0;this.affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];this.magic=0;this.isHDR=!1;this.extensionFlag=[0,0,0,0];this.extensionCode=this.extensionSize=
-0};k.NIFTI1.TYPE_NONE=0;k.NIFTI1.TYPE_BINARY=1;k.NIFTI1.TYPE_UINT8=2;k.NIFTI1.TYPE_INT16=4;k.NIFTI1.TYPE_INT32=8;k.NIFTI1.TYPE_FLOAT32=16;k.NIFTI1.TYPE_COMPLEX64=32;k.NIFTI1.TYPE_FLOAT64=64;k.NIFTI1.TYPE_RGB24=128;k.NIFTI1.TYPE_INT8=256;k.NIFTI1.TYPE_UINT16=512;k.NIFTI1.TYPE_UINT32=768;k.NIFTI1.TYPE_INT64=1024;k.NIFTI1.TYPE_UINT64=1280;k.NIFTI1.TYPE_FLOAT128=1536;k.NIFTI1.TYPE_COMPLEX128=1792;k.NIFTI1.TYPE_COMPLEX256=2048;k.NIFTI1.XFORM_UNKNOWN=0;k.NIFTI1.XFORM_SCANNER_ANAT=1;k.NIFTI1.XFORM_ALIGNED_ANAT=
-2;k.NIFTI1.XFORM_TALAIRACH=3;k.NIFTI1.XFORM_MNI_152=4;k.NIFTI1.SPATIAL_UNITS_MASK=7;k.NIFTI1.TEMPORAL_UNITS_MASK=56;k.NIFTI1.UNITS_UNKNOWN=0;k.NIFTI1.UNITS_METER=1;k.NIFTI1.UNITS_MM=2;k.NIFTI1.UNITS_MICRON=3;k.NIFTI1.UNITS_SEC=8;k.NIFTI1.UNITS_MSEC=16;k.NIFTI1.UNITS_USEC=24;k.NIFTI1.UNITS_HZ=32;k.NIFTI1.UNITS_PPM=40;k.NIFTI1.UNITS_RADS=48;k.NIFTI1.MAGIC_COOKIE=348;k.NIFTI1.STANDARD_HEADER_SIZE=348;k.NIFTI1.MAGIC_NUMBER_LOCATION=344;k.NIFTI1.MAGIC_NUMBER=[110,43,49];k.NIFTI1.MAGIC_NUMBER2=[110,105,
-49];k.NIFTI1.EXTENSION_HEADER_SIZE=8;k.NIFTI1.prototype.readHeader=function(f){f=new DataView(f);var c=k.Utils.getIntAt(f,0,this.littleEndian),a,b;c!==k.NIFTI1.MAGIC_COOKIE&&(this.littleEndian=!0,c=k.Utils.getIntAt(f,0,this.littleEndian));if(c!==k.NIFTI1.MAGIC_COOKIE)throw Error("This does not appear to be a NIFTI file!");this.dim_info=k.Utils.getByteAt(f,39);for(a=0;8>a;a+=1)c=40+2*a,this.dims[a]=k.Utils.getShortAt(f,c,this.littleEndian);this.intent_p1=k.Utils.getFloatAt(f,56,this.littleEndian);
-this.intent_p2=k.Utils.getFloatAt(f,60,this.littleEndian);this.intent_p3=k.Utils.getFloatAt(f,64,this.littleEndian);this.intent_code=k.Utils.getShortAt(f,68,this.littleEndian);this.datatypeCode=k.Utils.getShortAt(f,70,this.littleEndian);this.numBitsPerVoxel=k.Utils.getShortAt(f,72,this.littleEndian);this.slice_start=k.Utils.getShortAt(f,74,this.littleEndian);for(a=0;8>a;a+=1)c=76+4*a,this.pixDims[a]=k.Utils.getFloatAt(f,c,this.littleEndian);this.vox_offset=k.Utils.getFloatAt(f,108,this.littleEndian);
-this.scl_slope=k.Utils.getFloatAt(f,112,this.littleEndian);this.scl_inter=k.Utils.getFloatAt(f,116,this.littleEndian);this.slice_end=k.Utils.getShortAt(f,120,this.littleEndian);this.slice_code=k.Utils.getByteAt(f,122);this.xyzt_units=k.Utils.getByteAt(f,123);this.cal_max=k.Utils.getFloatAt(f,124,this.littleEndian);this.cal_min=k.Utils.getFloatAt(f,128,this.littleEndian);this.slice_duration=k.Utils.getFloatAt(f,132,this.littleEndian);this.toffset=k.Utils.getFloatAt(f,136,this.littleEndian);this.description=
-k.Utils.getStringAt(f,148,228);this.aux_file=k.Utils.getStringAt(f,228,252);this.qform_code=k.Utils.getShortAt(f,252,this.littleEndian);this.sform_code=k.Utils.getShortAt(f,254,this.littleEndian);this.quatern_b=k.Utils.getFloatAt(f,256,this.littleEndian);this.quatern_c=k.Utils.getFloatAt(f,260,this.littleEndian);this.quatern_d=k.Utils.getFloatAt(f,264,this.littleEndian);this.qoffset_x=k.Utils.getFloatAt(f,268,this.littleEndian);this.qoffset_y=k.Utils.getFloatAt(f,272,this.littleEndian);this.qoffset_z=
-k.Utils.getFloatAt(f,276,this.littleEndian);for(a=0;3>a;a+=1)for(b=0;4>b;b+=1)c=280+4*(4*a+b),this.affine[a][b]=k.Utils.getFloatAt(f,c,this.littleEndian);this.affine[3][0]=0;this.affine[3][1]=0;this.affine[3][2]=0;this.affine[3][3]=1;this.intent_name=k.Utils.getStringAt(f,328,344);this.magic=k.Utils.getStringAt(f,344,348);this.isHDR=this.magic===k.NIFTI1.MAGIC_NUMBER2;f.byteLength>k.NIFTI1.MAGIC_COOKIE&&(this.extensionFlag[0]=k.Utils.getByteAt(f,348),this.extensionFlag[1]=k.Utils.getByteAt(f,349),
-this.extensionFlag[2]=k.Utils.getByteAt(f,350),this.extensionFlag[3]=k.Utils.getByteAt(f,351),this.extensionFlag[0]&&(this.extensionSize=this.getExtensionSize(f),this.extensionCode=this.getExtensionCode(f)))};k.NIFTI1.prototype.toFormattedString=function(){var f=k.Utils.formatNumber;var c=""+("Dim Info = "+this.dim_info+"\n");c+="Image Dimensions (1-8): "+this.dims[0]+", "+this.dims[1]+", "+this.dims[2]+", "+this.dims[3]+", "+this.dims[4]+", "+this.dims[5]+", "+this.dims[6]+", "+this.dims[7]+"\n";
-c+="Intent Parameters (1-3): "+this.intent_p1+", "+this.intent_p2+", "+this.intent_p3+"\n";c+="Intent Code = "+this.intent_code+"\n";c+="Datatype = "+this.datatypeCode+" ("+this.getDatatypeCodeString(this.datatypeCode)+")\n";c+="Bits Per Voxel = "+this.numBitsPerVoxel+"\n";c+="Slice Start = "+this.slice_start+"\n";c+="Voxel Dimensions (1-8): "+f(this.pixDims[0])+", "+f(this.pixDims[1])+", "+f(this.pixDims[2])+", "+f(this.pixDims[3])+", "+f(this.pixDims[4])+", "+f(this.pixDims[5])+", "+f(this.pixDims[6])+
-", "+f(this.pixDims[7])+"\n";c+="Image Offset = "+this.vox_offset+"\n";c+="Data Scale:  Slope = "+f(this.scl_slope)+"  Intercept = "+f(this.scl_inter)+"\n";c+="Slice End = "+this.slice_end+"\n";c+="Slice Code = "+this.slice_code+"\n";c+="Units Code = "+this.xyzt_units+" ("+this.getUnitsCodeString(k.NIFTI1.SPATIAL_UNITS_MASK&this.xyzt_units)+", "+this.getUnitsCodeString(k.NIFTI1.TEMPORAL_UNITS_MASK&this.xyzt_units)+")\n";c+="Display Range:  Max = "+f(this.cal_max)+"  Min = "+f(this.cal_min)+"\n";c+=
-"Slice Duration = "+this.slice_duration+"\n";c+="Time Axis Shift = "+this.toffset+"\n";c+='Description: "'+this.description+'"\n';c+='Auxiliary File: "'+this.aux_file+'"\n';c+="Q-Form Code = "+this.qform_code+" ("+this.getTransformCodeString(this.qform_code)+")\n";c+="S-Form Code = "+this.sform_code+" ("+this.getTransformCodeString(this.sform_code)+")\n";c+="Quaternion Parameters:  b = "+f(this.quatern_b)+"  c = "+f(this.quatern_c)+"  d = "+f(this.quatern_d)+"\n";c+="Quaternion Offsets:  x = "+this.qoffset_x+
-"  y = "+this.qoffset_y+"  z = "+this.qoffset_z+"\n";c+="S-Form Parameters X: "+f(this.affine[0][0])+", "+f(this.affine[0][1])+", "+f(this.affine[0][2])+", "+f(this.affine[0][3])+"\n";c+="S-Form Parameters Y: "+f(this.affine[1][0])+", "+f(this.affine[1][1])+", "+f(this.affine[1][2])+", "+f(this.affine[1][3])+"\n";c+="S-Form Parameters Z: "+f(this.affine[2][0])+", "+f(this.affine[2][1])+", "+f(this.affine[2][2])+", "+f(this.affine[2][3])+"\n";c+='Intent Name: "'+this.intent_name+'"\n';this.extensionFlag[0]&&
-(c+="Extension: Size = "+this.extensionSize+"  Code = "+this.extensionCode+"\n");return c};k.NIFTI1.prototype.getDatatypeCodeString=function(f){return f===k.NIFTI1.TYPE_UINT8?"1-Byte Unsigned Integer":f===k.NIFTI1.TYPE_INT16?"2-Byte Signed Integer":f===k.NIFTI1.TYPE_INT32?"4-Byte Signed Integer":f===k.NIFTI1.TYPE_FLOAT32?"4-Byte Float":f===k.NIFTI1.TYPE_FLOAT64?"8-Byte Float":f===k.NIFTI1.TYPE_RGB24?"RGB":f===k.NIFTI1.TYPE_INT8?"1-Byte Signed Integer":f===k.NIFTI1.TYPE_UINT16?"2-Byte Unsigned Integer":
-f===k.NIFTI1.TYPE_UINT32?"4-Byte Unsigned Integer":f===k.NIFTI1.TYPE_INT64?"8-Byte Signed Integer":f===k.NIFTI1.TYPE_UINT64?"8-Byte Unsigned Integer":"Unknown"};k.NIFTI1.prototype.getTransformCodeString=function(f){return f===k.NIFTI1.XFORM_SCANNER_ANAT?"Scanner":f===k.NIFTI1.XFORM_ALIGNED_ANAT?"Aligned":f===k.NIFTI1.XFORM_TALAIRACH?"Talairach":f===k.NIFTI1.XFORM_MNI_152?"MNI":"Unknown"};k.NIFTI1.prototype.getUnitsCodeString=function(f){return f===k.NIFTI1.UNITS_METER?"Meters":f===k.NIFTI1.UNITS_MM?
-"Millimeters":f===k.NIFTI1.UNITS_MICRON?"Microns":f===k.NIFTI1.UNITS_SEC?"Seconds":f===k.NIFTI1.UNITS_MSEC?"Milliseconds":f===k.NIFTI1.UNITS_USEC?"Microseconds":f===k.NIFTI1.UNITS_HZ?"Hz":f===k.NIFTI1.UNITS_PPM?"PPM":f===k.NIFTI1.UNITS_RADS?"Rads":"Unknown"};k.NIFTI1.prototype.getQformMat=function(){return this.convertNiftiQFormToNiftiSForm(this.quatern_b,this.quatern_c,this.quatern_d,this.qoffset_x,this.qoffset_y,this.qoffset_z,this.pixDims[1],this.pixDims[2],this.pixDims[3],this.pixDims[0])};k.NIFTI1.prototype.convertNiftiQFormToNiftiSForm=
-function(f,c,a,b,d,n,l,g,r,k){var e=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],h=a;e[3][0]=e[3][1]=e[3][2]=0;e[3][3]=1;a=1-(f*f+c*c+h*h);1E-7>a?(a=1/Math.sqrt(f*f+c*c+h*h),f*=a,c*=a,h*=a,a=0):a=Math.sqrt(a);l=0<l?l:1;g=0<g?g:1;r=0<r?r:1;0>k&&(r=-r);e[0][0]=(a*a+f*f-c*c-h*h)*l;e[0][1]=2*(f*c-a*h)*g;e[0][2]=2*(f*h+a*c)*r;e[1][0]=2*(f*c+a*h)*l;e[1][1]=(a*a+c*c-f*f-h*h)*g;e[1][2]=2*(c*h-a*f)*r;e[2][0]=2*(f*h-a*c)*l;e[2][1]=2*(c*h+a*f)*g;e[2][2]=(a*a+h*h-c*c-f*f)*r;e[0][3]=b;e[1][3]=d;e[2][3]=n;return e};
-k.NIFTI1.prototype.convertNiftiSFormToNEMA=function(f){var c,a,b,d;var n=[[0,0,0],[0,0,0],[0,0,0]];var l=[[0,0,0],[0,0,0],[0,0,0]];var g=f[0][0];var r=f[0][1];var e=f[0][2];var k=f[1][0];var h=f[1][1];var m=f[1][2];var p=f[2][0];var u=f[2][1];var x=f[2][2];f=Math.sqrt(g*g+k*k+p*p);if(0===f)return null;g/=f;k/=f;p/=f;f=Math.sqrt(r*r+h*h+u*u);if(0===f)return null;r/=f;h/=f;u/=f;f=g*r+k*h+p*u;if(1E-4<Math.abs(f)){r-=f*g;h-=f*k;u-=f*p;f=Math.sqrt(r*r+h*h+u*u);if(0===f)return null;r/=f;h/=f;u/=f}f=Math.sqrt(e*
-e+m*m+x*x);0===f?(e=k*u-p*h,m=p*r-u*g,x=g*h-k*r):(e/=f,m/=f,x/=f);f=g*e+k*m+p*x;if(1E-4<Math.abs(f)){e-=f*g;m-=f*k;x-=f*p;f=Math.sqrt(e*e+m*m+x*x);if(0===f)return null;e/=f;m/=f;x/=f}f=r*e+h*m+u*x;if(1E-4<Math.abs(f)){e-=f*r;m-=f*h;x-=f*u;f=Math.sqrt(e*e+m*m+x*x);if(0===f)return null;e/=f;m/=f;x/=f}n[0][0]=g;n[0][1]=r;n[0][2]=e;n[1][0]=k;n[1][1]=h;n[1][2]=m;n[2][0]=p;n[2][1]=u;n[2][2]=x;p=this.nifti_mat33_determ(n);if(0===p)return null;var J=-666;g=k=h=m=1;r=2;e=3;for(u=1;3>=u;u+=1)for(x=1;3>=x;x+=
-1)if(u!==x)for(c=1;3>=c;c+=1)if(u!==c&&x!==c)for(l[0][0]=l[0][1]=l[0][2]=l[1][0]=l[1][1]=l[1][2]=l[2][0]=l[2][1]=l[2][2]=0,a=-1;1>=a;a+=2)for(b=-1;1>=b;b+=2)for(d=-1;1>=d;d+=2)l[0][u-1]=a,l[1][x-1]=b,l[2][c-1]=d,f=this.nifti_mat33_determ(l),0<f*p&&(f=this.nifti_mat33_mul(l,n),f=f[0][0]+f[1][1]+f[2][2],f>J&&(J=f,g=u,r=x,e=c,k=a,h=b,m=d));n=l=f=p=u=x=0;switch(g*k){case 1:n="X";p="+";break;case -1:n="X";p="-";break;case 2:n="Y";p="+";break;case -2:n="Y";p="-";break;case 3:n="Z";p="+";break;case -3:n=
-"Z",p="-"}switch(r*h){case 1:l="X";u="+";break;case -1:l="X";u="-";break;case 2:l="Y";u="+";break;case -2:l="Y";u="-";break;case 3:l="Z";u="+";break;case -3:l="Z",u="-"}switch(e*m){case 1:f="X";x="+";break;case -1:f="X";x="-";break;case 2:f="Y";x="+";break;case -2:f="Y";x="-";break;case 3:f="Z";x="+";break;case -3:f="Z",x="-"}return n+l+f+p+u+x};k.NIFTI1.prototype.nifti_mat33_mul=function(f,c){var a=[[0,0,0],[0,0,0],[0,0,0]],b,d;for(b=0;3>b;b+=1)for(d=0;3>d;d+=1)a[b][d]=f[b][0]*c[0][d]+f[b][1]*c[1][d]+
-f[b][2]*c[2][d];return a};k.NIFTI1.prototype.nifti_mat33_determ=function(f){var c=f[0][0];var a=f[0][1];var b=f[0][2];var d=f[1][0];var n=f[1][1];var l=f[1][2];var g=f[2][0];var r=f[2][1];f=f[2][2];return c*n*f-c*r*l-d*a*f+d*r*b+g*a*l-g*n*b};k.NIFTI1.prototype.getExtensionLocation=function(){return k.NIFTI1.MAGIC_COOKIE+4};k.NIFTI1.prototype.getExtensionSize=function(f){return k.Utils.getIntAt(f,this.getExtensionLocation(),this.littleEndian)};k.NIFTI1.prototype.getExtensionCode=function(f){return k.Utils.getIntAt(f,
-this.getExtensionLocation()+4,this.littleEndian)};"undefined"!==typeof p&&p.exports&&(p.exports=k.NIFTI1)},function(p,e,m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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 c(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){b=b.match(v);if(null===b||void 0===b[1])throw Error('Data source URL must have the form "<protocol>://<path>".');var c=b[1];a=a.get(c);if(void 0===a)throw Error("Unsupported data source: "+JSON.stringify(c)+".");return[a,b[2],c]}function b(b,c,d,g){var h=$jscomp.makeIterator(a(x,c));c=h.next().value;
-h=h.next().value;return c.getMesh(b,h,d,g)}function d(b,c,d,g){var h=$jscomp.makeIterator(a(J,c));c=h.next().value;h=h.next().value;return c.getMeshVertexAttributes(b,h,d,g)}function n(a){var b=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY;a=$jscomp.makeIterator(a);for(var d=a.next();!d.done;d=a.next())d=d.value,b=Math.min(b,d),c=Math.max(c,d);return[b,c]}function l(a,c,g,h){for(var q=[b(a,c.meshSourceUrl,g,h)],l=$jscomp.makeIterator(c.attributeSourceUrls),f=l.next();!f.done;f=l.next())q.push(d(a,
-f.value,g,h));return Promise.all(q).then(function(a){function b(a,b,c){for(var d=a.length,h=0;h<d;++h){var q=a[h],l=b[h],f=c,r=$jscomp.makeIterator(n(l)),e=r.next().value;r=r.next().value;g.info.vertexAttributes.push({name:q.name,source:f,numComponents:q.numComponents,dataType:q.dataType,min:e,max:r});g.vertexAttributes.push(l)}}var d=a[0],g={info:{numVertices:d.info.numVertices,numTriangles:d.info.numTriangles,vertexAttributes:[]},vertexPositions:d.vertexPositions,indices:d.indices,vertexNormals:d.vertexNormals,
-vertexAttributes:[]};b(d.info.vertexAttributes,d.vertexAttributes);c.attributeSourceUrls.forEach(function(c,g){g=a[g+1];if(g.numVertices!==d.info.numVertices)throw Error("Vertex attribute source "+JSON.stringify(c)+" specifies attributes for "+(g.numVertices+" vertices, but mesh has "+d.info.numVertices+" vertices."));b(g.attributeInfo,g.attributes,c)});return g})}e.a=function(a,b){x.set(a,b)};e.b=function(a,b){J.set(a,b)};p=m(2);var g=m(7),r=m(17),C=m(130),w=m(3),h=m(10);m=m(0);var B=function(){function a(a,
-b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),I=function z(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return z(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};e=this&&this.__decorate||function(a,
-b,c,d){var g=arguments.length,h=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,q;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)h=Reflect.decorate(a,b,c,d);else for(var l=a.length-1;0<=l;l--)if(q=a[l])h=(3>g?q(h):3<g?q(b,c,h):q(b,c))||h;return 3<g&&h&&Object.defineProperty(b,c,h),h};var u=function(a){function b(){k(this,b);var a=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));a.data=null;return a}c(b,a);B(b,[{key:"freeSystemMemory",value:function(){this.data=
-null}},{key:"serialize",value:function(a,c){I(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"serialize",this).call(this,a,c);var d=this.data,g=d.vertexPositions,h=d.indices,l=d.vertexNormals;d=d.vertexAttributes;a.vertexPositions=g;a.indices=h;a.vertexNormals=l;a.vertexAttributes=d;a=new Set;a.add(g.buffer);a.add(h.buffer);a.add(l.buffer);g=$jscomp.makeIterator(d);for(h=g.next();!h.done;h=g.next())a.add(h.value.buffer);c.push.apply(c,[].concat($jscomp.arrayFromIterable(a)));this.data=
-null}},{key:"downloadSucceeded",value:function(){var a=this.data,c=a.vertexAttributes;a=this.gpuMemoryBytes=a.vertexPositions.byteLength+a.indices.byteLength+a.vertexNormals.byteLength;c=$jscomp.makeIterator(c);for(var d=c.next();!d.done;d=c.next())a+=d.value.byteLength;this.systemMemoryBytes=this.gpuMemoryBytes=a;I(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"downloadSucceeded",this).call(this)}}]);return b}(p.Chunk),x=new Map,J=new Map,v=/^(?:([a-zA-Z-+_]+):\/\/)?(.*)$/,A=function(a){function b(){k(this,
-b);return f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}c(b,a);B(b,[{key:"getChunk",value:function(){var a=C.b,b=this.chunks.get(a);void 0===b&&(b=this.getNewChunk_(u),b.initialize(a),this.addChunk(b));return b}},{key:"download",value:function(a,b){var c=this;return l(this.chunkManager,this.parameters,function(){return{priorityTier:a.priorityTier,priority:a.priority}},b).then(function(b){if(Object(w.e)(b.info)!==Object(w.e)(c.parameters.info))throw Error("Mesh info has changed.");
-void 0===b.vertexNormals&&(b.vertexNormals=Object(r.b)(b.vertexPositions,b.indices));a.data=b})}}]);return b}(Object(p.WithParameters)(p.ChunkSource,C.d));A=e([Object(m.g)()],A);p=function(a){function b(a,c){k(this,b);var d=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));d.source=d.registerDisposer(a.getRef(c.source));d.registerDisposer(d.chunkManager.recomputeChunkPriorities.add(function(){d.updateChunkPriorities()}));return d}c(b,a);B(b,[{key:"updateChunkPriorities",value:function(){var a=
-this.visibility.value;if(a!==Number.NEGATIVE_INFINITY){var b=Object(h.b)(a);a=Object(h.a)(a);var c=this.chunkManager,d=this.source.getChunk();c.requestChunk(d,b,a+50)}}}]);return b}(Object(h.c)(Object(p.withChunkManager)(m.c)));p=e([Object(m.g)(C.c)],p);Object(m.e)(C.a,function(a,b){var c=this.getRef(a.chunkManager);try{return l(c,a.parameters,function(){return{priorityTier:g.d.VISIBLE,priority:1E3}},b).then(function(a){return{value:a.info}})}finally{c.dispose()}})},function(p,e,m){e.a=function(f){f=
-f instanceof ArrayBuffer?new Uint8Array(f):new Uint8Array(f.buffer,f.byteOffset,f.byteLength);var c=new Uint8Array(f.buffer,f.byteOffset,f.byteLength);return 2<c.length&&31===c[0]&&139===c[1]?Object(k.inflate)(f):f};var k=m(27);m.n(k)},function(p,e,m){m(55);m(2);m(19);m(39);m(40);m(82);m(45);m(112);m(115);m(120);m(121);m(123);m(128);p.exports=m(131)},function(p,e,m){Object.defineProperty(e,"__esModule",{value:!0});m.d(e,"rpc",function(){return k});var k=new (m(0).a)(self);self.rpc=k},function(p,e,
-m){var k=function(){function f(c,a){for(var b=0;b<a.length;b++){var d=a[b];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(c,d.key,d)}}return function(c,a,b){a&&f(c.prototype,a);b&&f(c,b);return c}}();p=function(){function f(){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");}k(f,null,[{key:"insertAfter",value:function(c,a){var b=c.next0;a.next0=b;a.prev0=c;c.next0=a;b.prev0=a}},{key:"insertBefore",value:function(c,
-a){var b=c.prev0;a.prev0=b;a.next0=c;c.prev0=a;b.next0=a}},{key:"front",value:function(c){var a=c.next0;return a===c?null:a}},{key:"back",value:function(c){var a=c.prev0;return a===c?null:a}},{key:"pop",value:function(c){var a=c.next0,b=c.prev0;a.prev0=b;b.next0=a;c.next0=null;c.prev0=null;return c}},{key:"iterator",value:function(c){function a(a,g){for(;;)switch(b){case 0:d=c.next0;case 1:if(d===c){b=3;break}b=4;return{value:d,done:!1};case 4:if(void 0===g){b=5;break}b=-1;throw g;case 5:case 2:d=
-d.next0;b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,d,n={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();n[Symbol.iterator]=function(){return this};return n}},{key:"reverseIterator",value:function(c){function a(a,g){for(;;)switch(b){case 0:d=c.prev0;case 1:if(d===c){b=3;break}b=4;return{value:d,done:!1};case 4:if(void 0===g){b=5;break}b=-1;throw g;case 5:case 2:d=
-d.prev0;b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,d,n={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();n[Symbol.iterator]=function(){return this};return n}},{key:"initializeHead",value:function(c){c.next0=c.prev0=c}}]);return f}();e.a=p},function(p,e,m){var k=function(){function f(c,a){for(var b=0;b<a.length;b++){var d=a[b];d.enumerable=d.enumerable||!1;d.configurable=
-!0;"value"in d&&(d.writable=!0);Object.defineProperty(c,d.key,d)}}return function(c,a,b){a&&f(c.prototype,a);b&&f(c,b);return c}}();p=function(){function f(){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");}k(f,null,[{key:"insertAfter",value:function(c,a){var b=c.next1;a.next1=b;a.prev1=c;c.next1=a;b.prev1=a}},{key:"insertBefore",value:function(c,a){var b=c.prev1;a.prev1=b;a.next1=c;c.prev1=a;b.next1=a}},{key:"front",value:function(c){var a=c.next1;return a===c?null:
-a}},{key:"back",value:function(c){var a=c.prev1;return a===c?null:a}},{key:"pop",value:function(c){var a=c.next1,b=c.prev1;a.prev1=b;b.next1=a;c.next1=null;c.prev1=null;return c}},{key:"iterator",value:function(c){function a(a,g){for(;;)switch(b){case 0:d=c.next1;case 1:if(d===c){b=3;break}b=4;return{value:d,done:!1};case 4:if(void 0===g){b=5;break}b=-1;throw g;case 5:case 2:d=d.next1;b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,d,n={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();n[Symbol.iterator]=function(){return this};return n}},{key:"reverseIterator",value:function(c){function a(a,g){for(;;)switch(b){case 0:d=c.prev1;case 1:if(d===c){b=3;break}b=4;return{value:d,done:!1};case 4:if(void 0===g){b=5;break}b=-1;throw g;case 5:case 2:d=d.prev1;b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,d,n={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();n[Symbol.iterator]=function(){return this};return n}},{key:"initializeHead",value:function(c){c.next1=c.prev1=c}}]);return f}();e.a=p},function(p,e,m){m(4)},function(p,e,m){m(4)},function(p,e,m){function k(a,b,c){var d=b[0],l=b[1],g=b[2],f=b[3],e=b[4],k=b[5],h=b[6],m=b[7],p=b[8],u=b[9],x=b[10],J=b[11],v=b[12],A=b[13],t=b[14];b=b[15];var z=c[0],H=c[1],q=c[2],G=c[3];a[0]=z*d+H*e+q*p+G*v;a[1]=z*l+H*k+q*u+G*A;a[2]=
-z*g+H*h+q*x+G*t;a[3]=z*f+H*m+q*J+G*b;z=c[4];H=c[5];q=c[6];G=c[7];a[4]=z*d+H*e+q*p+G*v;a[5]=z*l+H*k+q*u+G*A;a[6]=z*g+H*h+q*x+G*t;a[7]=z*f+H*m+q*J+G*b;z=c[8];H=c[9];q=c[10];G=c[11];a[8]=z*d+H*e+q*p+G*v;a[9]=z*l+H*k+q*u+G*A;a[10]=z*g+H*h+q*x+G*t;a[11]=z*f+H*m+q*J+G*b;z=c[12];H=c[13];q=c[14];G=c[15];a[12]=z*d+H*e+q*p+G*v;a[13]=z*l+H*k+q*u+G*A;a[14]=z*g+H*h+q*x+G*t;a[15]=z*f+H*m+q*J+G*b;return a}function f(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];a[3]=b[3]-c[3];a[4]=b[4]-c[4];a[5]=b[5]-c[5];
-a[6]=b[6]-c[6];a[7]=b[7]-c[7];a[8]=b[8]-c[8];a[9]=b[9]-c[9];a[10]=b[10]-c[10];a[11]=b[11]-c[11];a[12]=b[12]-c[12];a[13]=b[13]-c[13];a[14]=b[14]-c[14];a[15]=b[15]-c[15];return a}Object.defineProperty(e,"__esModule",{value:!0});e.create=function(){var a=new c.a(16);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.clone=function(a){var b=new c.a(16);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=
-a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return b};e.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a};e.fromValues=function(a,b,d,n,l,g,f,e,k,h,m,p,u,x,J,v){var r=new c.a(16);r[0]=a;r[1]=b;r[2]=d;r[3]=n;r[4]=l;r[5]=g;r[6]=f;r[7]=e;r[8]=k;r[9]=h;r[10]=m;r[11]=p;r[12]=u;r[13]=x;r[14]=J;r[15]=v;
-return r};e.set=function(a,b,c,n,l,g,f,e,k,h,m,p,u,x,J,v,A){a[0]=b;a[1]=c;a[2]=n;a[3]=l;a[4]=g;a[5]=f;a[6]=e;a[7]=k;a[8]=h;a[9]=m;a[10]=p;a[11]=u;a[12]=x;a[13]=J;a[14]=v;a[15]=A;return a};e.identity=function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.transpose=function(a,b){if(a===b){var c=b[1],n=b[2],l=b[3],g=b[6],f=b[7],e=b[11];a[1]=b[4];a[2]=b[8];a[3]=b[12];a[4]=c;a[6]=b[9];a[7]=b[13];a[8]=n;a[9]=g;a[11]=
-b[14];a[12]=l;a[13]=f;a[14]=e}else a[0]=b[0],a[1]=b[4],a[2]=b[8],a[3]=b[12],a[4]=b[1],a[5]=b[5],a[6]=b[9],a[7]=b[13],a[8]=b[2],a[9]=b[6],a[10]=b[10],a[11]=b[14],a[12]=b[3],a[13]=b[7],a[14]=b[11],a[15]=b[15];return a};e.invert=function(a,b){var c=b[0],n=b[1],l=b[2],g=b[3],f=b[4],e=b[5],k=b[6],h=b[7],m=b[8],p=b[9],u=b[10],x=b[11],J=b[12],v=b[13],A=b[14];b=b[15];var t=c*e-n*f,z=c*k-l*f,H=c*h-g*f,q=n*k-l*e,G=n*h-g*e,L=l*h-g*k,K=m*v-p*J,D=m*A-u*J,E=m*b-x*J,Q=p*A-u*v,N=p*b-x*v,O=u*b-x*A,F=t*O-z*N+H*Q+q*
-E-G*D+L*K;if(!F)return null;F=1/F;a[0]=(e*O-k*N+h*Q)*F;a[1]=(l*N-n*O-g*Q)*F;a[2]=(v*L-A*G+b*q)*F;a[3]=(u*G-p*L-x*q)*F;a[4]=(k*E-f*O-h*D)*F;a[5]=(c*O-l*E+g*D)*F;a[6]=(A*H-J*L-b*z)*F;a[7]=(m*L-u*H+x*z)*F;a[8]=(f*N-e*E+h*K)*F;a[9]=(n*E-c*N-g*K)*F;a[10]=(J*G-v*H+b*t)*F;a[11]=(p*H-m*G-x*t)*F;a[12]=(e*D-f*Q-k*K)*F;a[13]=(c*Q-n*D+l*K)*F;a[14]=(v*z-J*q-A*t)*F;a[15]=(m*q-p*z+u*t)*F;return a};e.adjoint=function(a,b){var c=b[0],n=b[1],l=b[2],g=b[3],f=b[4],e=b[5],k=b[6],h=b[7],m=b[8],p=b[9],u=b[10],x=b[11],J=
-b[12],v=b[13],A=b[14];b=b[15];a[0]=e*(u*b-x*A)-p*(k*b-h*A)+v*(k*x-h*u);a[1]=-(n*(u*b-x*A)-p*(l*b-g*A)+v*(l*x-g*u));a[2]=n*(k*b-h*A)-e*(l*b-g*A)+v*(l*h-g*k);a[3]=-(n*(k*x-h*u)-e*(l*x-g*u)+p*(l*h-g*k));a[4]=-(f*(u*b-x*A)-m*(k*b-h*A)+J*(k*x-h*u));a[5]=c*(u*b-x*A)-m*(l*b-g*A)+J*(l*x-g*u);a[6]=-(c*(k*b-h*A)-f*(l*b-g*A)+J*(l*h-g*k));a[7]=c*(k*x-h*u)-f*(l*x-g*u)+m*(l*h-g*k);a[8]=f*(p*b-x*v)-m*(e*b-h*v)+J*(e*x-h*p);a[9]=-(c*(p*b-x*v)-m*(n*b-g*v)+J*(n*x-g*p));a[10]=c*(e*b-h*v)-f*(n*b-g*v)+J*(n*h-g*e);a[11]=
--(c*(e*x-h*p)-f*(n*x-g*p)+m*(n*h-g*e));a[12]=-(f*(p*A-u*v)-m*(e*A-k*v)+J*(e*u-k*p));a[13]=c*(p*A-u*v)-m*(n*A-l*v)+J*(n*u-l*p);a[14]=-(c*(e*A-k*v)-f*(n*A-l*v)+J*(n*k-l*e));a[15]=c*(e*u-k*p)-f*(n*u-l*p)+m*(n*k-l*e);return a};e.determinant=function(a){var b=a[0],c=a[1],n=a[2],l=a[3],g=a[4],f=a[5],e=a[6],k=a[7],h=a[8],m=a[9],p=a[10],u=a[11],x=a[12],J=a[13],v=a[14];a=a[15];return(b*f-c*g)*(p*a-u*v)-(b*e-n*g)*(m*a-u*J)+(b*k-l*g)*(m*v-p*J)+(c*e-n*f)*(h*a-u*x)-(c*k-l*f)*(h*v-p*x)+(n*k-l*e)*(h*J-m*x)};e.multiply=
-k;e.translate=function(a,b,c){var d=c[0],l=c[1];c=c[2];if(b===a)a[12]=b[0]*d+b[4]*l+b[8]*c+b[12],a[13]=b[1]*d+b[5]*l+b[9]*c+b[13],a[14]=b[2]*d+b[6]*l+b[10]*c+b[14],a[15]=b[3]*d+b[7]*l+b[11]*c+b[15];else{var g=b[0];var f=b[1];var e=b[2];var k=b[3];var h=b[4];var m=b[5];var p=b[6];var u=b[7];var x=b[8];var J=b[9];var v=b[10];var A=b[11];a[0]=g;a[1]=f;a[2]=e;a[3]=k;a[4]=h;a[5]=m;a[6]=p;a[7]=u;a[8]=x;a[9]=J;a[10]=v;a[11]=A;a[12]=g*d+h*l+x*c+b[12];a[13]=f*d+m*l+J*c+b[13];a[14]=e*d+p*l+v*c+b[14];a[15]=
-k*d+u*l+A*c+b[15]}return a};e.scale=function(a,b,c){var d=c[0],l=c[1];c=c[2];a[0]=b[0]*d;a[1]=b[1]*d;a[2]=b[2]*d;a[3]=b[3]*d;a[4]=b[4]*l;a[5]=b[5]*l;a[6]=b[6]*l;a[7]=b[7]*l;a[8]=b[8]*c;a[9]=b[9]*c;a[10]=b[10]*c;a[11]=b[11]*c;a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a};e.rotate=function(a,b,d,n){var l=n[0],g=n[1];n=n[2];var f=Math.sqrt(l*l+g*g+n*n);if(Math.abs(f)<c.b)return null;f=1/f;l*=f;g*=f;n*=f;var e=Math.sin(d);var k=Math.cos(d);var h=1-k;d=b[0];f=b[1];var m=b[2];var p=b[3];var u=
-b[4];var x=b[5];var J=b[6];var v=b[7];var A=b[8];var t=b[9];var z=b[10];var H=b[11];var q=l*l*h+k;var G=g*l*h+n*e;var L=n*l*h-g*e;var K=l*g*h-n*e;var D=g*g*h+k;var E=n*g*h+l*e;var Q=l*n*h+g*e;l=g*n*h-l*e;g=n*n*h+k;a[0]=d*q+u*G+A*L;a[1]=f*q+x*G+t*L;a[2]=m*q+J*G+z*L;a[3]=p*q+v*G+H*L;a[4]=d*K+u*D+A*E;a[5]=f*K+x*D+t*E;a[6]=m*K+J*D+z*E;a[7]=p*K+v*D+H*E;a[8]=d*Q+u*l+A*g;a[9]=f*Q+x*l+t*g;a[10]=m*Q+J*l+z*g;a[11]=p*Q+v*l+H*g;b!==a&&(a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);return a};e.rotateX=function(a,
-b,c){var d=Math.sin(c);c=Math.cos(c);var l=b[4],g=b[5],f=b[6],e=b[7],k=b[8],h=b[9],m=b[10],p=b[11];b!==a&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[4]=l*c+k*d;a[5]=g*c+h*d;a[6]=f*c+m*d;a[7]=e*c+p*d;a[8]=k*c-l*d;a[9]=h*c-g*d;a[10]=m*c-f*d;a[11]=p*c-e*d;return a};e.rotateY=function(a,b,c){var d=Math.sin(c);c=Math.cos(c);var l=b[0],g=b[1],f=b[2],e=b[3],k=b[8],h=b[9],m=b[10],p=b[11];b!==a&&(a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[12]=b[12],a[13]=b[13],
-a[14]=b[14],a[15]=b[15]);a[0]=l*c-k*d;a[1]=g*c-h*d;a[2]=f*c-m*d;a[3]=e*c-p*d;a[8]=l*d+k*c;a[9]=g*d+h*c;a[10]=f*d+m*c;a[11]=e*d+p*c;return a};e.rotateZ=function(a,b,c){var d=Math.sin(c);c=Math.cos(c);var l=b[0],g=b[1],f=b[2],e=b[3],k=b[4],h=b[5],m=b[6],p=b[7];b!==a&&(a[8]=b[8],a[9]=b[9],a[10]=b[10],a[11]=b[11],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[0]=l*c+k*d;a[1]=g*c+h*d;a[2]=f*c+m*d;a[3]=e*c+p*d;a[4]=k*c-l*d;a[5]=h*c-g*d;a[6]=m*c-f*d;a[7]=p*c-e*d;return a};e.fromTranslation=function(a,
-b){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=b[0];a[13]=b[1];a[14]=b[2];a[15]=1;return a};e.fromScaling=function(a,b){a[0]=b[0];a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b[1];a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=b[2];a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.fromRotation=function(a,b,d){var f=d[0],l=d[1];d=d[2];var g=Math.sqrt(f*f+l*l+d*d);if(Math.abs(g)<c.b)return null;g=1/g;f*=g;l*=g;d*=g;g=Math.sin(b);b=Math.cos(b);var e=1-b;a[0]=f*f*e+b;a[1]=l*f*
-e+d*g;a[2]=d*f*e-l*g;a[3]=0;a[4]=f*l*e-d*g;a[5]=l*l*e+b;a[6]=d*l*e+f*g;a[7]=0;a[8]=f*d*e+l*g;a[9]=l*d*e-f*g;a[10]=d*d*e+b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.fromXRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b;a[6]=c;a[7]=0;a[8]=0;a[9]=-c;a[10]=b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.fromYRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=0;a[2]=-c;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=c;a[9]=0;a[10]=
-b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.fromZRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=c;a[2]=0;a[3]=0;a[4]=-c;a[5]=b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.fromRotationTranslation=function(a,b,c){var d=b[0],l=b[1],g=b[2],f=b[3],e=d+d,k=l+l,h=g+g;b=d*e;var m=d*k;d*=h;var p=l*k;l*=h;g*=h;e*=f;k*=f;f*=h;a[0]=1-(p+g);a[1]=m+f;a[2]=d-k;a[3]=0;a[4]=m-f;a[5]=1-(b+g);a[6]=l+e;a[7]=0;a[8]=d+k;a[9]=l-e;a[10]=1-(b+p);a[11]=
-0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a};e.getTranslation=function(a,b){a[0]=b[12];a[1]=b[13];a[2]=b[14];return a};e.getScaling=function(a,b){var c=b[0],f=b[1],l=b[2],g=b[4],e=b[5],k=b[6],m=b[8],h=b[9];b=b[10];a[0]=Math.sqrt(c*c+f*f+l*l);a[1]=Math.sqrt(g*g+e*e+k*k);a[2]=Math.sqrt(m*m+h*h+b*b);return a};e.getRotation=function(a,b){var c=b[0]+b[5]+b[10];0<c?(c=2*Math.sqrt(c+1),a[3]=.25*c,a[0]=(b[6]-b[9])/c,a[1]=(b[8]-b[2])/c,a[2]=(b[1]-b[4])/c):b[0]>b[5]&b[0]>b[10]?(c=2*Math.sqrt(1+b[0]-
-b[5]-b[10]),a[3]=(b[6]-b[9])/c,a[0]=.25*c,a[1]=(b[1]+b[4])/c,a[2]=(b[8]+b[2])/c):b[5]>b[10]?(c=2*Math.sqrt(1+b[5]-b[0]-b[10]),a[3]=(b[8]-b[2])/c,a[0]=(b[1]+b[4])/c,a[1]=.25*c,a[2]=(b[6]+b[9])/c):(c=2*Math.sqrt(1+b[10]-b[0]-b[5]),a[3]=(b[1]-b[4])/c,a[0]=(b[8]+b[2])/c,a[1]=(b[6]+b[9])/c,a[2]=.25*c);return a};e.fromRotationTranslationScale=function(a,b,c,f){var d=b[0],g=b[1],e=b[2],k=b[3],n=d+d,h=g+g,m=e+e;b=d*n;var p=d*h;d*=m;var u=g*h;g*=m;e*=m;n*=k;h*=k;k*=m;m=f[0];var x=f[1];f=f[2];a[0]=(1-(u+e))*
-m;a[1]=(p+k)*m;a[2]=(d-h)*m;a[3]=0;a[4]=(p-k)*x;a[5]=(1-(b+e))*x;a[6]=(g+n)*x;a[7]=0;a[8]=(d+h)*f;a[9]=(g-n)*f;a[10]=(1-(b+u))*f;a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a};e.fromRotationTranslationScaleOrigin=function(a,b,c,f,l){var d=b[0],e=b[1],k=b[2],n=b[3],h=d+d,m=e+e,p=k+k;b=d*h;var u=d*m;d*=p;var x=e*m;e*=p;k*=p;h*=n;m*=n;n*=p;p=f[0];var J=f[1];f=f[2];var v=l[0],A=l[1];l=l[2];a[0]=(1-(x+k))*p;a[1]=(u+n)*p;a[2]=(d-m)*p;a[3]=0;a[4]=(u-n)*J;a[5]=(1-(b+k))*J;a[6]=(e+h)*J;a[7]=0;
-a[8]=(d+m)*f;a[9]=(e-h)*f;a[10]=(1-(b+x))*f;a[11]=0;a[12]=c[0]+v-(a[0]*v+a[4]*A+a[8]*l);a[13]=c[1]+A-(a[1]*v+a[5]*A+a[9]*l);a[14]=c[2]+l-(a[2]*v+a[6]*A+a[10]*l);a[15]=1;return a};e.fromQuat=function(a,b){var c=b[0],f=b[1],l=b[2];b=b[3];var g=c+c,e=f+f,k=l+l;c*=g;var m=f*g;f*=e;var h=l*g,p=l*e;l*=k;g*=b;e*=b;b*=k;a[0]=1-f-l;a[1]=m+b;a[2]=h-e;a[3]=0;a[4]=m-b;a[5]=1-c-l;a[6]=p+g;a[7]=0;a[8]=h+e;a[9]=p-g;a[10]=1-c-f;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};e.frustum=function(a,b,c,f,l,g,e){var d=
-1/(c-b),k=1/(l-f),h=1/(g-e);a[0]=2*g*d;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=2*g*k;a[6]=0;a[7]=0;a[8]=(c+b)*d;a[9]=(l+f)*k;a[10]=(e+g)*h;a[11]=-1;a[12]=0;a[13]=0;a[14]=e*g*2*h;a[15]=0;return a};e.perspective=function(a,b,c,f,l){b=1/Math.tan(b/2);var d=1/(f-l);a[0]=b/c;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=(l+f)*d;a[11]=-1;a[12]=0;a[13]=0;a[14]=2*l*f*d;a[15]=0;return a};e.perspectiveFromFieldOfView=function(a,b,c,f){var d=Math.tan(b.upDegrees*Math.PI/180),g=Math.tan(b.downDegrees*
-Math.PI/180),e=Math.tan(b.leftDegrees*Math.PI/180);b=Math.tan(b.rightDegrees*Math.PI/180);var k=2/(e+b),n=2/(d+g);a[0]=k;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=n;a[6]=0;a[7]=0;a[8]=-((e-b)*k*.5);a[9]=(d-g)*n*.5;a[10]=f/(c-f);a[11]=-1;a[12]=0;a[13]=0;a[14]=f*c/(c-f);a[15]=0;return a};e.ortho=function(a,b,c,f,l,g,e){var d=1/(b-c),k=1/(f-l),h=1/(g-e);a[0]=-2*d;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=-2*k;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2*h;a[11]=0;a[12]=(b+c)*d;a[13]=(l+f)*k;a[14]=(e+g)*h;a[15]=1;return a};e.lookAt=
-function(a,b,d,f){var l=b[0],g=b[1];b=b[2];var e=f[0];var k=f[1];var n=f[2];var h=d[0];f=d[1];var m=d[2];if(Math.abs(l-h)<c.b&&Math.abs(g-f)<c.b&&Math.abs(b-m)<c.b)return mat4.identity(a);d=l-h;f=g-f;h=b-m;var p=1/Math.sqrt(d*d+f*f+h*h);d*=p;f*=p;h*=p;m=k*h-n*f;n=n*d-e*h;e=e*f-k*d;(p=Math.sqrt(m*m+n*n+e*e))?(p=1/p,m*=p,n*=p,e*=p):e=n=m=0;k=f*e-h*n;var u=h*m-d*e;var x=d*n-f*m;(p=Math.sqrt(k*k+u*u+x*x))?(p=1/p,k*=p,u*=p,x*=p):x=u=k=0;a[0]=m;a[1]=k;a[2]=d;a[3]=0;a[4]=n;a[5]=u;a[6]=f;a[7]=0;a[8]=e;a[9]=
-x;a[10]=h;a[11]=0;a[12]=-(m*l+n*g+e*b);a[13]=-(k*l+u*g+x*b);a[14]=-(d*l+f*g+h*b);a[15]=1;return a};e.targetTo=function(a,b,c,f){var d=b[0],g=b[1];b=b[2];var e=f[0],k=f[1],m=f[2];f=d-c[0];var h=g-c[1];c=b-c[2];var n=f*f+h*h+c*c;0<n&&(n=1/Math.sqrt(n),f*=n,h*=n,c*=n);n=k*c-m*h;m=m*f-e*c;e=e*h-k*f;a[0]=n;a[1]=m;a[2]=e;a[3]=0;a[4]=h*e-c*m;a[5]=c*n-f*e;a[6]=f*m-h*n;a[7]=0;a[8]=f;a[9]=h;a[10]=c;a[11]=0;a[12]=d;a[13]=g;a[14]=b;a[15]=1;return a};e.str=function(a){return"mat4("+a[0]+", "+a[1]+", "+a[2]+", "+
-a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+a[12]+", "+a[13]+", "+a[14]+", "+a[15]+")"};e.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2)+Math.pow(a[9],2)+Math.pow(a[10],2)+Math.pow(a[11],2)+Math.pow(a[12],2)+Math.pow(a[13],2)+Math.pow(a[14],2)+Math.pow(a[15],2))};e.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];
-a[2]=b[2]+c[2];a[3]=b[3]+c[3];a[4]=b[4]+c[4];a[5]=b[5]+c[5];a[6]=b[6]+c[6];a[7]=b[7]+c[7];a[8]=b[8]+c[8];a[9]=b[9]+c[9];a[10]=b[10]+c[10];a[11]=b[11]+c[11];a[12]=b[12]+c[12];a[13]=b[13]+c[13];a[14]=b[14]+c[14];a[15]=b[15]+c[15];return a};e.subtract=f;e.multiplyScalar=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;a[4]=b[4]*c;a[5]=b[5]*c;a[6]=b[6]*c;a[7]=b[7]*c;a[8]=b[8]*c;a[9]=b[9]*c;a[10]=b[10]*c;a[11]=b[11]*c;a[12]=b[12]*c;a[13]=b[13]*c;a[14]=b[14]*c;a[15]=b[15]*c;return a};e.multiplyScalarAndAdd=
-function(a,b,c,f){a[0]=b[0]+c[0]*f;a[1]=b[1]+c[1]*f;a[2]=b[2]+c[2]*f;a[3]=b[3]+c[3]*f;a[4]=b[4]+c[4]*f;a[5]=b[5]+c[5]*f;a[6]=b[6]+c[6]*f;a[7]=b[7]+c[7]*f;a[8]=b[8]+c[8]*f;a[9]=b[9]+c[9]*f;a[10]=b[10]+c[10]*f;a[11]=b[11]+c[11]*f;a[12]=b[12]+c[12]*f;a[13]=b[13]+c[13]*f;a[14]=b[14]+c[14]*f;a[15]=b[15]+c[15]*f;return a};e.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]&&a[9]===b[9]&&a[10]===b[10]&&a[11]===
-b[11]&&a[12]===b[12]&&a[13]===b[13]&&a[14]===b[14]&&a[15]===b[15]};e.equals=function(a,b){var d=a[0],f=a[1],l=a[2],g=a[3],e=a[4],k=a[5],m=a[6],h=a[7],p=a[8],I=a[9],u=a[10],x=a[11],J=a[12],v=a[13],A=a[14];a=a[15];var t=b[0],z=b[1],H=b[2],q=b[3],G=b[4],L=b[5],K=b[6],D=b[7],E=b[8],Q=b[9],N=b[10],O=b[11],F=b[12],y=b[13],M=b[14];b=b[15];return Math.abs(d-t)<=c.b*Math.max(1,Math.abs(d),Math.abs(t))&&Math.abs(f-z)<=c.b*Math.max(1,Math.abs(f),Math.abs(z))&&Math.abs(l-H)<=c.b*Math.max(1,Math.abs(l),Math.abs(H))&&
-Math.abs(g-q)<=c.b*Math.max(1,Math.abs(g),Math.abs(q))&&Math.abs(e-G)<=c.b*Math.max(1,Math.abs(e),Math.abs(G))&&Math.abs(k-L)<=c.b*Math.max(1,Math.abs(k),Math.abs(L))&&Math.abs(m-K)<=c.b*Math.max(1,Math.abs(m),Math.abs(K))&&Math.abs(h-D)<=c.b*Math.max(1,Math.abs(h),Math.abs(D))&&Math.abs(p-E)<=c.b*Math.max(1,Math.abs(p),Math.abs(E))&&Math.abs(I-Q)<=c.b*Math.max(1,Math.abs(I),Math.abs(Q))&&Math.abs(u-N)<=c.b*Math.max(1,Math.abs(u),Math.abs(N))&&Math.abs(x-O)<=c.b*Math.max(1,Math.abs(x),Math.abs(O))&&
-Math.abs(J-F)<=c.b*Math.max(1,Math.abs(J),Math.abs(F))&&Math.abs(v-y)<=c.b*Math.max(1,Math.abs(v),Math.abs(y))&&Math.abs(A-M)<=c.b*Math.max(1,Math.abs(A),Math.abs(M))&&Math.abs(a-b)<=c.b*Math.max(1,Math.abs(a),Math.abs(b))};var c=m(4);e.mul=k;e.sub=f},function(p,e,m){function k(){var a=new d.a(4);a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a}function f(a,b,c){c*=.5;var d=Math.sin(c);a[0]=d*b[0];a[1]=d*b[1];a[2]=d*b[2];a[3]=Math.cos(c);return a}function c(a,b,c){var d=b[0],g=b[1],l=b[2];b=b[3];var f=c[0],e=
-c[1],k=c[2];c=c[3];a[0]=d*c+b*f+g*k-l*e;a[1]=g*c+b*e+l*f-d*k;a[2]=l*c+b*k+d*e-g*f;a[3]=b*c-d*f-g*e-l*k;return a}function a(a,b,c,d){var g=b[0],h=b[1],l=b[2];b=b[3];var f=c[0],e=c[1],k=c[2];c=c[3];var m=g*f+h*e+l*k+b*c;0>m&&(m=-m,f=-f,e=-e,k=-k,c=-c);if(1E-6<1-m){var n=Math.acos(m);var r=Math.sin(n);m=Math.sin((1-d)*n)/r;d=Math.sin(d*n)/r}else m=1-d;a[0]=m*g+d*f;a[1]=m*h+d*e;a[2]=m*l+d*k;a[3]=m*b+d*c;return a}function b(a,b){var c=b[0]+b[4]+b[8];if(0<c)c=Math.sqrt(c+1),a[3]=.5*c,c=.5/c,a[0]=(b[5]-
-b[7])*c,a[1]=(b[6]-b[2])*c,a[2]=(b[1]-b[3])*c;else{var d=0;b[4]>b[0]&&(d=1);b[8]>b[3*d+d]&&(d=2);var g=(d+1)%3,l=(d+2)%3;c=Math.sqrt(b[3*d+d]-b[3*g+g]-b[3*l+l]+1);a[d]=.5*c;c=.5/c;a[3]=(b[3*g+l]-b[3*l+g])*c;a[g]=(b[3*g+d]+b[3*d+g])*c;a[l]=(b[3*l+d]+b[3*d+l])*c}return a}Object.defineProperty(e,"__esModule",{value:!0});e.create=k;e.identity=function(a){a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a};e.setAxisAngle=f;e.getAxisAngle=function(a,b){var c=2*Math.acos(b[3]),d=Math.sin(c/2);0!=d?(a[0]=b[0]/d,a[1]=b[1]/
-d,a[2]=b[2]/d):(a[0]=1,a[1]=0,a[2]=0);return c};e.multiply=c;e.rotateX=function(a,b,c){c*=.5;var d=b[0],g=b[1],l=b[2];b=b[3];var f=Math.sin(c);c=Math.cos(c);a[0]=d*c+b*f;a[1]=g*c+l*f;a[2]=l*c-g*f;a[3]=b*c-d*f;return a};e.rotateY=function(a,b,c){c*=.5;var d=b[0],g=b[1],l=b[2];b=b[3];var f=Math.sin(c);c=Math.cos(c);a[0]=d*c-l*f;a[1]=g*c+b*f;a[2]=l*c+d*f;a[3]=b*c-g*f;return a};e.rotateZ=function(a,b,c){c*=.5;var d=b[0],g=b[1],l=b[2];b=b[3];var f=Math.sin(c);c=Math.cos(c);a[0]=d*c+g*f;a[1]=g*c-d*f;a[2]=
-l*c+b*f;a[3]=b*c-l*f;return a};e.calculateW=function(a,b){var c=b[0],d=b[1];b=b[2];a[0]=c;a[1]=d;a[2]=b;a[3]=Math.sqrt(Math.abs(1-c*c-d*d-b*b));return a};e.slerp=a;e.invert=function(a,b){var c=b[0],d=b[1],g=b[2];b=b[3];var l=c*c+d*d+g*g+b*b;l=l?1/l:0;a[0]=-c*l;a[1]=-d*l;a[2]=-g*l;a[3]=b*l;return a};e.conjugate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=b[3];return a};e.fromMat3=b;e.fromEuler=function(a,b,c,d){var g=.5*Math.PI/180;b*=g;c*=g;d*=g;g=Math.sin(b);b=Math.cos(b);var h=Math.sin(c);
-c=Math.cos(c);var l=Math.sin(d);d=Math.cos(d);a[0]=g*c*d-b*h*l;a[1]=b*h*d+g*c*l;a[2]=b*c*l-g*h*d;a[3]=b*c*d+g*h*l;return a};e.str=function(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};var d=m(4),n=m(33),l=m(34);p=m(35);e.clone=p.b;e.fromValues=p.g;e.copy=p.c;e.set=p.l;e.add=p.a;e.mul=c;e.scale=p.k;e.dot=p.d;e.lerp=p.i;m=p.h;e.length=m;e.len=m;m=p.m;e.squaredLength=m;e.sqrLen=m;var g=p.j;e.normalize=g;e.exactEquals=p.f;e.equals=p.e;p=function(){var a=l.create(),b=l.fromValues(1,0,0),c=
-l.fromValues(0,1,0);return function(d,e,k){var h=l.dot(e,k);if(-.999999>h)return l.cross(a,b,e),1E-6>l.len(a)&&l.cross(a,c,e),l.normalize(a,a),f(d,a,Math.PI),d;if(.999999<h)return d[0]=0,d[1]=0,d[2]=0,d[3]=1,d;l.cross(a,e,k);d[0]=a[0];d[1]=a[1];d[2]=a[2];d[3]=1+h;return g(d,d)}}();e.rotationTo=p;p=function(){var b=k(),c=k();return function(d,g,l,f,e,k){a(b,g,e,k);a(c,l,f,k);a(d,b,c,2*k*(1-k));return d}}();e.sqlerp=p;p=function(){var a=n.a();return function(c,d,h,l){a[0]=h[0];a[3]=h[1];a[6]=h[2];a[1]=
-l[0];a[4]=l[1];a[7]=l[2];a[2]=-d[0];a[5]=-d[1];a[8]=-d[2];return g(c,b(c,a))}}();e.setAxes=p},function(p,e,m){function k(){var c=new f.a(2);c[0]=0;c[1]=0;return c}var f=m(4);(function(){var c=k();return function(a,b,d,f,l,g){b||(b=2);d||(d=0);for(f=f?Math.min(f*b+d,a.length):a.length;d<f;d+=b)c[0]=a[d],c[1]=a[d+1],l(c,c,g),a[d]=c[0],a[d+1]=c[1];return a}})()},function(p,e,m){var k=function(){function f(c,a){for(var b=0;b<a.length;b++){var d=a[b];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in
-d&&(d.writable=!0);Object.defineProperty(c,d.key,d)}}return function(c,a,b){a&&f(c.prototype,a);b&&f(c,b);return c}}();p=function(){function f(c){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");this.compare=c}k(f,[{key:"meld",value:function(c,a){if(null===a)return c;if(null===c)return a;var b=this.compare;b(a,c)&&(b=c,c=a,a=b);b=c.child0;a.next0=b;a.prev0=c;null!==b&&(b.prev0=a);c.child0=a;return c}},{key:"combineChildren",value:function(c){var a=c.child0;if(null===
-a)return null;for(c=null;;){var b=a.next0;if(null===b)var d=null;else d=b.next0,a=this.meld(a,b);a.next0=c;c=a;if(null===d)break;a=d}d=c;for(c=c.next0;null!==c;)a=c.next0,d=this.meld(d,c),c=a;d.prev0=null;d.next0=null;return d}},{key:"removeMin",value:function(c){var a=this.combineChildren(c);c.next0=null;c.prev0=null;c.child0=null;return a}},{key:"remove",value:function(c,a){if(c===a)return this.removeMin(c);var b=a.prev0,d=a.next0;b.child0===a?b.child0=d:b.next0=d;null!==d&&(d.prev0=b);c=this.meld(c,
-this.combineChildren(a));a.next0=null;a.prev0=null;a.child0=null;return c}},{key:"entries",value:function(c){function a(a,h){for(;;)switch(b){case 0:if(null===c){b=1;break}g=c.child0;b=2;return{value:c,done:!1};case 2:if(void 0===h){b=3;break}b=-1;throw h;case 3:case 4:if(null===g){b=5;break}l=g.next0;f=$jscomp.makeIterator(e.entries(g));case 6:if((d=f.next(a)).done){b=7;break}b=8;return{value:d.value,done:!1};case 8:if(void 0===h){b=9;break}b=-1;throw h;case 9:b=6;break;case 7:g=l;b=4;break;case 5:case 1:b=
--1;default:return{value:void 0,done:!0}}}var b=0,d,f,l,g,e=this,k={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();k[Symbol.iterator]=function(){return this};return k}},{key:"removedEntries",value:function(c){function a(a,h){for(;;)switch(b){case 0:if(null===c){b=1;break}g=c.child0;c.child0=null;c.next0=null;c.prev0=null;b=2;return{value:c,done:!1};case 2:if(void 0===h){b=3;break}b=-1;
-throw h;case 3:case 4:if(null===g){b=5;break}l=g.next0;g.child0=null;g.next0=null;g.prev0=null;f=$jscomp.makeIterator(e.entries(g));case 6:if((d=f.next(a)).done){b=7;break}b=8;return{value:d.value,done:!1};case 8:if(void 0===h){b=9;break}b=-1;throw h;case 9:b=6;break;case 7:g=l;b=4;break;case 5:case 1:b=-1;default:return{value:void 0,done:!0}}}var b=0,d,f,l,g,e=this,k={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();k[Symbol.iterator]=function(){return this};return k}}]);return f}();e.a=p},function(p,e,m){var k=function(){function f(c,a){for(var b=0;b<a.length;b++){var d=a[b];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(c,d.key,d)}}return function(c,a,b){a&&f(c.prototype,a);b&&f(c,b);return c}}();p=function(){function f(c){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");this.compare=c}k(f,[{key:"meld",
-value:function(c,a){if(null===a)return c;if(null===c)return a;var b=this.compare;b(a,c)&&(b=c,c=a,a=b);b=c.child1;a.next1=b;a.prev1=c;null!==b&&(b.prev1=a);c.child1=a;return c}},{key:"combineChildren",value:function(c){var a=c.child1;if(null===a)return null;for(c=null;;){var b=a.next1;if(null===b)var d=null;else d=b.next1,a=this.meld(a,b);a.next1=c;c=a;if(null===d)break;a=d}d=c;for(c=c.next1;null!==c;)a=c.next1,d=this.meld(d,c),c=a;d.prev1=null;d.next1=null;return d}},{key:"removeMin",value:function(c){var a=
-this.combineChildren(c);c.next1=null;c.prev1=null;c.child1=null;return a}},{key:"remove",value:function(c,a){if(c===a)return this.removeMin(c);var b=a.prev1,d=a.next1;b.child1===a?b.child1=d:b.next1=d;null!==d&&(d.prev1=b);c=this.meld(c,this.combineChildren(a));a.next1=null;a.prev1=null;a.child1=null;return c}},{key:"entries",value:function(c){function a(a,h){for(;;)switch(b){case 0:if(null===c){b=1;break}g=c.child1;b=2;return{value:c,done:!1};case 2:if(void 0===h){b=3;break}b=-1;throw h;case 3:case 4:if(null===
-g){b=5;break}l=g.next1;f=$jscomp.makeIterator(e.entries(g));case 6:if((d=f.next(a)).done){b=7;break}b=8;return{value:d.value,done:!1};case 8:if(void 0===h){b=9;break}b=-1;throw h;case 9:b=6;break;case 7:g=l;b=4;break;case 5:case 1:b=-1;default:return{value:void 0,done:!0}}}var b=0,d,f,l,g,e=this,k={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();k[Symbol.iterator]=function(){return this};
-return k}},{key:"removedEntries",value:function(c){function a(a,h){for(;;)switch(b){case 0:if(null===c){b=1;break}g=c.child1;c.child1=null;c.next1=null;c.prev1=null;b=2;return{value:c,done:!1};case 2:if(void 0===h){b=3;break}b=-1;throw h;case 3:case 4:if(null===g){b=5;break}l=g.next1;g.child1=null;g.next1=null;g.prev1=null;f=$jscomp.makeIterator(e.entries(g));case 6:if((d=f.next(a)).done){b=7;break}b=8;return{value:d.value,done:!1};case 8:if(void 0===h){b=9;break}b=-1;throw h;case 9:b=6;break;case 7:g=
-l;b=4;break;case 5:case 1:b=-1;default:return{value:void 0,done:!0}}}var b=0,d,f,l,g,e=this,k={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();k[Symbol.iterator]=function(){return this};return k}}]);return f}();e.a=p},function(p,e,m){m.d(e,"a",function(){return b});var k=m(1),f=m(3),c=m(8),a=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;
-d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),b=function(){function b(a){a=void 0===a?k.h.create():a;if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");this.transform=a;this.changed=new c.a}a(b,[{key:"reset",value:function(){k.h.copy(this.transform,k.c);this.changed.dispatch()}},{key:"toJSON",value:function(){if(!k.h.equals(k.c,this.transform)){var a=this.transform;return[[a[0],
-a[4],a[8],a[12]],[a[1],a[5],a[9],a[13]],[a[2],a[6],a[10],a[14]],[a[3],a[7],a[11],a[15]]]}}},{key:"restoreState",value:function(a){if(null==a)this.reset();else if(Array.isArray(a))if(4===a.length)try{for(var b=0;4>b;++b)Object(f.b)(this.transform.subarray(4*b,4*(b+1)),a[b]);k.h.transpose(this.transform,this.transform)}catch(C){this.reset()}else if(16===a.length)try{Object(f.b)(this.transform,a),k.h.transpose(this.transform,this.transform)}catch(C){this.reset()}else this.reset();else if("object"===
-typeof a){b=k.j.create();var c=k.m.create(),d=k.m.fromValues(1,1,1);try{Object(f.b)(b,a.rotation),k.j.normalize(b,b)}catch(C){k.j.identity(b)}try{Object(f.b)(c,a.translation)}catch(C){k.m.copy(c,k.g)}try{Object(f.b)(d,a.scale)}catch(C){k.m.copy(d,k.f)}k.h.fromRotationTranslationScale(this.transform,b,c,d);this.changed.dispatch()}else this.reset()}},{key:"clone",value:function(){return new b(k.h.clone(this.transform))}}]);return b}()},function(p,e,m){m.d(e,"a",function(){return c});var k=m(1),f=function(){function a(a,
-c){for(var b=0;b<c.length;b++){var d=c[b];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),c=function(){function a(b,c){c=void 0===c?k.c:c;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.size=k.m.clone(b);this.transform=k.h.clone(c);this.invTransform=k.h.invert(k.h.create(),c)}f(a,[{key:"toObject",value:function(a){a.size=this.size;a.transform=
-this.transform}},{key:"localSpatialToGlobal",value:function(a,c){return k.m.transformMat4(a,c,this.transform)}},{key:"globalToLocalSpatial",value:function(a,c){return k.m.transformMat4(a,c,this.invTransform)}},{key:"globalToLocalGrid",value:function(a,c){this.globalToLocalSpatial(a,c);k.m.divide(a,a,this.size);return a}},{key:"localSpatialVectorToGlobal",value:function(a,c){return Object(k.l)(a,c,this.transform)}},{key:"globalToLocalSpatialVector",value:function(a,c){return Object(k.l)(a,c,this.invTransform)}},
-{key:"assignLocalSpatialToGlobalMat4",value:function(a){return k.h.copy(a,this.transform)}}],[{key:"get",value:function(b,c){c=void 0===c?k.c:c;var d=a.cache,f=JSON.stringify([Array.from(b),Array.from(c)]),g=d.get(f);void 0===g&&(g=new a(b,c),d.set(f,g));return g}},{key:"fromObject",value:function(b){return a.get(b.size,b.transform)}}]);return a}();c.cache=new Map},function(p,e,m){e.a=function(e,f){return e===f?!0:1E-6>Math.abs(e-f)/Math.min(Math.abs(e),Math.abs(f))}},function(p,e,m){function k(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 f=m(24);p=m(0);var c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,
-d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),a=function n(a,b,c){null===a&&(a=Function.prototype);var g=Object.getOwnPropertyDescriptor(a,b);if(void 0===g){if(a=Object.getPrototypeOf(a),null!==a)return n(a,b,c)}else{if("value"in g)return g.value;b=g.get;return void 0===b?void 0:b.call(c)}};e=this&&this.__decorate||function(a,b,c,f){var g=arguments.length,l=3>g?b:null===f?f=Object.getOwnPropertyDescriptor(b,c):f,h;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)l=
-Reflect.decorate(a,b,c,f);else for(var e=a.length-1;0<=e;e--)if(h=a[e])l=(3>g?h(l):3<g?h(b,c,l):h(b,c))||l;return 3<g&&l&&Object.defineProperty(b,c,l),l};m=b=function(e){function l(a,b){b=void 0===b?{}:b;if(!(this instanceof l))throw new TypeError("Cannot call a class as a function");var c=(l.__proto__||Object.getPrototypeOf(l)).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.updatingValue_=
-!1;void 0!==a&&(c.base=new f.b(b.value),c.setupChangedHandler());return c}k(l,e);c(l,[{key:"initializeCounterpart",value:function(b,c){c=void 0===c?{}:c;c.value=this.value;a(l.prototype.__proto__||Object.getPrototypeOf(l.prototype),"initializeCounterpart",this).call(this,b,c)}},{key:"setupChangedHandler",value:function(){var a=this;this.registerDisposer(this.base.changed.add(function(){if(a.updatingValue_)a.updatingValue_=!1;else{var b=a.rpc;null!==b&&b.invoke("SharedWatchableValue.changed",{id:a.rpcId,
-value:a.value})}}))}},{key:"value",get:function(){return this.base.value},set:function(a){this.base.value=a}},{key:"changed",get:function(){return this.base.changed}}],[{key:"makeFromExisting",value:function(a,c){var g=new b;g.base=c;g.setupChangedHandler();g.initializeCounterpart(a);return g}},{key:"make",value:function(a,c){return b.makeFromExisting(a,new f.b(c))}}]);return l}(p.c);m=b=e([Object(p.g)("SharedWatchableValue")],m);Object(p.f)("SharedWatchableValue.changed",function(a){var b=this.get(a.id);
-b.updatingValue_=!0;b.base.value=a.value;b.updatingValue_=!1});var b},function(p,e,m){var k=m(36),f=m(70),c=m(73),a=Math.max,b=Math.min;p.exports=function(d,e,l){function g(a){var b=B,c=I;B=I=void 0;v=a;return u=d.apply(c,b)}function m(a){var b=a-J;a-=v;return void 0===J||b>=e||0>b||t&&a>=H}function n(){var a=f();if(m(a))return p(a);var c=setTimeout;var d=a-v;a=e-(a-J);d=t?b(a,H-d):a;x=c(n,d)}function p(a){x=void 0;if(z&&B)return g(a);B=I=void 0;return u}function h(){var a=f(),b=m(a);B=arguments;
-I=this;J=a;if(b){if(void 0===x)return v=a=J,x=setTimeout(n,e),A?g(a):u;if(t)return x=setTimeout(n,e),g(J)}void 0===x&&(x=setTimeout(n,e));return u}var B,I,u,x,J,v=0,A=!1,t=!1,z=!0;if("function"!=typeof d)throw new TypeError("Expected a function");e=c(e)||0;if(k(l)){A=!!l.leading;var H=(t="maxWait"in l)?a(c(l.maxWait)||0,e):H;z="trailing"in l?!!l.trailing:z}h.cancel=function(){void 0!==x&&clearTimeout(x);v=0;B=J=I=x=void 0};h.flush=function(){return void 0===x?u:p(f())};return h}},function(p,e,m){var k=
-m(37);p.exports=function(){return k.Date.now()}},function(p,e,m){e=m(72);p.exports="object"==typeof e&&e&&e.Object===Object&&e},function(p,e){e=function(){return this}();try{e=e||Function("return this")()||(0,eval)("this")}catch(m){"object"===typeof window&&(e=window)}p.exports=e},function(p,e,m){var k=m(36),f=m(74),c=0/0,a=/^\s+|\s+$/g,b=/^[-+]0x[0-9a-f]+$/i,d=/^0b[01]+$/i,n=/^0o[0-7]+$/i,l=parseInt;p.exports=function(g){if("number"==typeof g)return g;if(f(g))return c;k(g)&&(g="function"==typeof g.valueOf?
-g.valueOf():g,g=k(g)?g+"":g);if("string"!=typeof g)return 0===g?g:+g;g=g.replace(a,"");var e=d.test(g);return e||n.test(g)?l(g.slice(2),e?2:8):b.test(g)?c:+g}},function(p,e,m){var k=m(75),f=m(78);p.exports=function(c){return"symbol"==typeof c||f(c)&&"[object Symbol]"==k(c)}},function(p,e,m){e=m(38);var k=m(76),f=m(77),c=e?e.toStringTag:void 0;p.exports=function(a){return null==a?void 0===a?"[object Undefined]":"[object Null]":c&&c in Object(a)?k(a):f(a)}},function(p,e,m){e=m(38);m=Object.prototype;
-var k=m.hasOwnProperty,f=m.toString,c=e?e.toStringTag:void 0;p.exports=function(a){var b=k.call(a,c),d=a[c];try{a[c]=void 0;var e=!0}catch(g){}var l=f.call(a);e&&(b?a[c]=d:delete a[c]);return l}},function(p,e){var m=Object.prototype.toString;p.exports=function(e){return m.call(e)}},function(p,e){p.exports=function(e){return null!=e&&"object"==typeof e}},function(p,e,m){e.c="perspective_view/PerspectiveView";e.a="perspective_view/addLayer";e.b="perspective_view/removeLayer"},function(p,e,m){e.a=function(e){e=
-Math.ceil((void 0===e?128:e)/32);var f=new Uint32Array(e);crypto.getRandomValues(f);for(var c="",a=0;a<e;++a)c+=("00000000"+f[a].toString(16)).slice(-8);return c}},function(p,e,m){function k(c,a){if("function"!==typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function, not "+typeof a);c.prototype=Object.create(a&&a.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}});a&&(Object.setPrototypeOf?Object.setPrototypeOf(c,a):c.__proto__=a)}m.d(e,
-"k",function(){return f});p=m(9);e.d="annotation.MetadataChunkSource";e.c="annotation.GeometryChunkSource";e.j="annotation.SubsetGeometryChunkSource";e.f="annotation.reference.add";e.g="annotation.reference.delete";e.b="annotation.commit";e.a="annotation.commit";var f=function(c){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");var b=(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?this:b}k(a,c);return a}(p.i);e.e="annotation/PerspectiveRenderLayer";e.h="annotation/RenderLayer";e.i="annotation/RenderLayer.updateSegmentation"},function(p,e,m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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 c(a,b){if("function"!==
-typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){a&&(b.change_spec={change_stack_id:a.changeStackId},a.timeStamp&&(b.change_spec.time_stamp=a.timeStamp),a.skipEquivalences&&(b.change_spec.skip_equivalences=a.skipEquivalences))}function b(a,b){return Object(H.WithParameters)(Object(q.a)()(a),
-b)}function d(a,b){Object(K.c)(a,b,"fragmentKey");a.clipBounds&&(a.fragmentIds=n(a.fragmentIds,a.clipBounds));a.fragmentIds=r(a.fragmentIds);return a}function n(a,b){b;if(!a)return a;var c=[];a=$jscomp.makeIterator(a);for(var d=a.next();!d.done;d=a.next()){d=d.value;var g=O.m.clone([500,500,500]),h=d;var f=g;var q=new y.a;if(!q.tryParseString(h,16))throw Error("Couldn't parse fragmentId "+h+" as hex-encoded Uint64");if(q.high)throw Error("Fragment ids > 2^32 not supported yet");h=Object(O.a)(q);q=
-O.m.create();f=O.m.mul(q,h,f);h=O.m.create();O.m.scale(h,g,.5);q=O.m.create();O.m.add(q,f,h);l({center:q,size:g},b)&&c.push(d)}return c}function l(a,b){function c(a,b,c){return[].concat($jscomp.arrayFromIterable(a.map(function(a,d){return a+c*b[d]/2}).values()))}function d(a){return{min:O.m.clone(c(a.center,a.size,-1)),max:O.m.clone(c(a.center,a.size,1))}}a=d(a);b=d(b);return a.min[0]<=b.max[0]&&a.max[0]>=b.min[0]&&a.min[1]<=b.max[1]&&a.max[1]>=b.min[1]&&a.min[2]<=b.max[2]&&a.max[2]>=b.min[2]}function g(a,
-b){Object(F.i)(b);var c=Object(F.j)(b,"fragmentKey",F.m);b=Object(F.j)(b,"supervoxelId",F.m);if(c.length!==b.length)throw Error("Expected fragmentKey and supervoxelId arrays to have the same length.");b=b.map(function(a,b){return a+"\x00"+c[b]});a.clipBounds&&(b=n(b,a.clipBounds));a.fragmentIds=r(b)}function r(a){for(var b=[],c=0,d=a.length;c<d;)b.push(JSON.stringify(a.slice(c,c+100))),c+=100;return b}function C(a){var b=a.match(/(-?[0-9]+),(-?[0-9]+),(-?[0-9]+)/);if(null===b)throw Error("Error parsing number triplet: "+
-JSON.stringify(a)+".");return O.m.fromValues(parseFloat(b[1]),parseFloat(b[2]),parseFloat(b[3]))}function w(a){return a.volumeId+":"+a.changestack+":"}function h(a,b){if(!b.startsWith(a))throw Error("Received annotation id "+JSON.stringify(b)+" does not have expected prefix of "+JSON.stringify(a)+".");return b.substring(a.length)}function B(a){if(null!=a)return Object(F.a)(a,function(a){return y.a.parseString(""+a,10)})}function I(a,b,c){var d=Object(F.j)(a,"corner",function(a){return C(Object(F.l)(a))}),
-g=Object(F.j)(a,"size",function(a){return C(Object(F.l)(a))}),f=Object(F.j)(a,"payload",F.k),l=Object(F.j)(a,"type",F.l),q=Object(F.j)(a,"id",F.l);b=h(b,q);a=Object(F.j)(a,"objectLabels",B);if(void 0!==c&&b!==c)throw Error("Received annotation has unexpected id "+JSON.stringify(q)+".");switch(l){case "LOCATION":if(O.m.equals(g,O.g))return{type:t.b.POINT,id:b,point:d,description:f,segments:a};c=O.m.scale(O.m.create(),g,.5);d=O.m.add(O.m.create(),d,c);return{type:t.b.ELLIPSOID,id:b,center:d,radii:c,
-description:f,segments:a};case "LINE":return{type:t.b.LINE,id:b,pointA:d,pointB:O.m.add(O.m.create(),d,g),description:f,segments:a};case "VOLUME":return{type:t.b.AXIS_ALIGNED_BOUNDING_BOX,id:b,pointA:d,pointB:O.m.add(O.m.create(),d,g),description:f,segments:a};default:throw Error("Unknown spatial annotation type: "+JSON.stringify(l)+".");}}function u(a,b,c){Object(F.i)(a);a=Object(F.j)(a,"annotations",function(a){return Object(F.c)([void 0],a,F.i)})[0];return I(a,b,c)}function x(a,b){var c=new t.a,
-d=w(a.source.parent.parameters);b.forEach(function(a,b){try{Object(F.i)(a);var g=Object(F.j)(a,"annotations",function(a){return void 0===a?[]:a});if(!Array.isArray(g))throw Error("Expected array, but received "+JSON.stringify(typeof g)+".");for(var h=$jscomp.makeIterator(g),f=h.next();!f.done;f=h.next()){var l=f.value;try{c.add(I(l,d))}catch(Ja){throw Error("Error parsing annotation: "+Ja.message);}}}catch(Ja){throw Error("Error parsing "+jb[b]+" annotations: "+Ja.message);}});a.data=Object.assign(new z.AnnotationGeometryData,
-c.serialize())}function J(a){var b=a.indexOf(".");return a.substring(0,b)}function v(a){return Math.round(a[0])+","+Math.round(a[1])+","+Math.round(a[2])}function A(a){var b=a.description||"",c=void 0===a.segments?void 0:a.segments.map(function(a){return a.toString()});switch(a.type){case t.b.LINE:case t.b.AXIS_ALIGNED_BOUNDING_BOX:var d=a.pointA,g=a.pointB,h=O.m.min(O.m.create(),d,g);d=O.m.max(O.m.create(),d,g);d=O.m.subtract(d,d,h);return{type:a.type===t.b.LINE?"LINE":"VOLUME",corner:v(h),size:v(d),
-object_labels:c,payload:b};case t.b.POINT:return{type:"LOCATION",corner:v(a.point),size:"0,0,0",object_labels:c,payload:b};case t.b.ELLIPSOID:return h=O.m.subtract(O.m.create(),a.center,a.radii),a=O.m.scale(O.m.create(),a.radii,2),{type:"LOCATION",corner:v(h),size:v(a),object_labels:c,payload:b}}}Object.defineProperty(e,"__esModule",{value:!0});m.d(e,"BrainmapsVolumeChunkSource",function(){return ba});m.d(e,"BrainmapsMeshSource",function(){return kb});m.d(e,"BrainmapsSkeletonSource",function(){return P});
-m.d(e,"BrainmapsAnnotationSource",function(){return ib});var t=m(41),z=m(40),H=m(2),q=m(83),G=m(86),L=m(88),K=m(17),D=m(43);p=m(25);e=m(18);var E=m(23),Q=m(16),N=m(11),O=m(1),F=m(3),y=m(5);m=m(0);var M=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),R=this&&this.__decorate||function(a,b,c,d){var g=arguments.length,
-h=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,f;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)h=Reflect.decorate(a,b,c,d);else for(var l=a.length-1;0<=l;l--)if(f=a[l])h=(3>g?f(h):3<g?f(b,c,h):f(b,c))||h;return 3<g&&h&&Object.defineProperty(b,c,h),h},X=new Map([[L.d.RAW,E.a],[L.d.JPEG,e.a],[L.d.COMPRESSED_SEGMENTATION,p.a]]),ba=function(b){function d(){k(this,d);var a=f(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.chunkDecoder=X.get(a.parameters.encoding);
-return a}c(d,b);M(d,[{key:"applyEncodingParams",value:function(a){var b=this.parameters.encoding;switch(b){case L.d.RAW:a.subvolume_format="RAW";break;case L.d.JPEG:a.subvolume_format="SINGLE_IMAGE";a.image_format_options={image_format:"JPEG",jpeg_quality:70};break;case L.d.COMPRESSED_SEGMENTATION:a.subvolume_format="RAW";a.image_format_options={compressed_segmentation_block_size:Object(O.n)(this.spec.compressedSegmentationBlockSize)};break;default:throw Error("Invalid encoding: "+b);}}},{key:"download",
-value:function(b,c){var d=this,g=this.parameters,h=this.computeChunkBounds(b),f=b.chunkDataSize;var l="/v1/volumes/"+g.volumeId+"/subvolume:binary";h={geometry:{corner:Object(O.n)(h),size:Object(O.n)(f),scale:g.scaleIndex}};this.applyEncodingParams(h);a(g.changeSpec,h);return Object(G.a)(g.instance,this.credentialsProvider,{method:"POST",payload:JSON.stringify(h),path:l,responseType:"arraybuffer"},c).then(function(a){return d.chunkDecoder(b,a)})}}]);return d}(b(Q.a,L.e));ba=R([Object(m.g)()],ba);
-var kb=function(a){function b(){k(this,b);var a=f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.manifestDecoder=void 0!==a.parameters.changeSpec?g:d;var c=a.parameters.changeSpec;c=void 0!==c?"&header.changeStackId="+c.changeStackId+"&return_supervoxel_ids=true":"";a.listFragmentsParams=c;return a}c(b,a);M(b,[{key:"download",value:function(a,b){var c=this,d=this.parameters;return Object(G.a)(d.instance,this.credentialsProvider,{method:"GET",path:"/v1/objects/"+d.volumeId+"/meshes/"+
-(d.meshName+":listfragments?object_id="+a.objectId)+this.listFragmentsParams,responseType:"json"},b).then(function(b){return c.manifestDecoder(a,b)})}},{key:"downloadFragment",value:function(a,b){function c(b){for(var c=b.byteLength,e=0,k=new DataView(b);e<c;){if(e+32>c)throw Error("Invalid batch mesh fragment response.");if(void 0!==g.changeSpec){var m=k.getUint32(e,!0);var t=k.getUint32(e+4,!0);t=(new y.a(m,t)).toString()+"\x00"}else t="";e+=8;m=k.getUint32(e,!0);var n=k.getUint32(e+4,!0);e+=8;
-if(0!==n)throw Error("Invalid batch mesh fragment response.");if(e+m+8+8>c)throw Error("Invalid batch mesh fragment response.");n=(new TextDecoder).decode(new Uint8Array(b,e,m));t+=n;if(!h.delete(t))throw Error("Received unexpected fragment key: "+JSON.stringify(t)+".");e+=m;m=k.getUint32(e,!0);n=k.getUint32(e+4,!0);e+=8;t=k.getUint32(e,!0);var r=k.getUint32(e+4,!0);e+=8;if(0!==n||0!==r)throw Error("Invalid batch mesh fragment response.");n=e+12*t+12*m;if(n>c)throw Error("Invalid batch mesh fragment response.");
-f+=m;l+=3*t;q.push({buffer:b,verticesOffset:e,numVertices:m,indicesOffset:e+12*m,numIndices:3*t});e=n}if(0!==h.size)return d();b=new Float32Array(3*f);c=new Uint32Array(l);k=e=0;m=$jscomp.makeIterator(q);for(t=m.next();!t.done;t=m.next()){t=t.value;b.set(new Float32Array(t.buffer,t.verticesOffset,3*t.numVertices),3*e);n=t.numIndices;r=new Uint32Array(t.buffer,t.indicesOffset,n);Object(N.d)(r,N.b.LITTLE);for(var p=0;p<n;++p)c[k++]=r[p]+e;e+=t.numVertices}Object(N.d)(b,N.b.LITTLE);a.vertexPositions=
-b;a.indices=c;a.vertexNormals=Object(K.b)(b,c)}function d(){var d=[];if(void 0!==g.changeSpec)for(var f=$jscomp.makeIterator(h),l=f.next();!l.done;l=f.next()){var q=l.value,k=q.indexOf("\x00");l=q.substring(0,k);q=q.substring(k+1);void 0!==l&&d.push({object_id:l,fragment_keys:[]});d[d.length-1].fragment_keys.push(q)}else d.push({object_id:a.manifestChunk.objectId.toString(),fragment_keys:Array.from(h)});return Object(G.a)(g.instance,e,{method:"POST",path:"/v1/objects/meshes:batch",payload:JSON.stringify({volume_id:g.volumeId,
-mesh_name:g.meshName,batches:d}),responseType:"arraybuffer"},b).then(c)}var g=this.parameters,h=new Set(JSON.parse(a.fragmentId)),f=0,l=0,q=[],e=this.credentialsProvider;return d()}}]);return b}(b(K.a,L.b));kb=R([Object(m.g)()],kb);var P=function(b){function d(){k(this,d);return f(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}c(d,b);M(d,[{key:"download",value:function(b,c){var d=this.parameters,g={object_id:""+b.objectId},h="/v1/objects/"+d.volumeId+("/meshes/"+d.meshName)+"/skeleton:binary";
-a(d.changeSpec,g);return Object(G.a)(d.instance,this.credentialsProvider,{method:"POST",path:h,payload:JSON.stringify(g),responseType:"arraybuffer"},c).then(function(a){var c=new DataView(a),d=c.getUint32(0,!0);if(0!==c.getUint32(4,!0))throw Error("The number of vertices should not exceed 2^32-1.");var g=c.getUint32(8,!0);if(0!==c.getUint32(12,!0))throw Error("The number of edges should not exceed 2^32-1.");Object(D.b)(b,a,N.b.LITTLE,16,d,void 0,g)})}}]);return d}(b(D.a,L.c));P=R([Object(m.g)()],
-P);var jb=["LOCATION","LINE","VOLUME"],ib=function(a){function b(){k(this,b);return f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}c(b,a);M(b,[{key:"downloadGeometry",value:function(a,b){var c=this,d=this.parameters;return Promise.all(jb.map(function(a){return Object(G.a)(d.instance,c.credentialsProvider,{method:"POST",path:"/v1/changes/"+d.volumeId+"/"+d.changestack+"/spatials:get",payload:JSON.stringify({type:a,ignore_payload:!0}),responseType:"json"},b)})).then(function(b){x(a,
-b)})}},{key:"downloadSegmentFilteredGeometry",value:function(a,b){var c=this,d=this.parameters;return Promise.all(jb.map(function(g){return Object(G.a)(d.instance,c.credentialsProvider,{method:"POST",path:"/v1/changes/"+d.volumeId+"/"+d.changestack+"/spatials:get",payload:JSON.stringify({type:g,object_labels:[a.objectId.toString()],ignore_payload:!0}),responseType:"json"},b)})).then(function(b){x(a,b)})}},{key:"downloadMetadata",value:function(a,b){var c=this.parameters,d=a.key;return Object(G.a)(c.instance,
-this.credentialsProvider,{method:"POST",path:"/v1/changes/"+c.volumeId+"/"+c.changestack+"/spatials:get",payload:JSON.stringify({type:J(d),id:c.volumeId+":"+c.changestack+":"+d}),responseType:"json"},b).then(function(b){a.annotation=u(b,w(c),d)},function(){a.annotation=null})}},{key:"add",value:function(a){var b=this,c=this.parameters;a=A(a);return Object(G.a)(c.instance,this.credentialsProvider,{method:"POST",path:"/v1/changes/"+c.volumeId+"/"+c.changestack+"/spatials:push",payload:JSON.stringify({annotations:[a]}),
-responseType:"json"}).then(function(a){Object(F.i)(a);a=Object(F.j)(a,"ids",F.m);if(1!==a.length)throw Error("Expected list of 1 id, but received "+JSON.stringify(a)+".");var c=w(b.parameters);return h(c,a[0])})}},{key:"update",value:function(a,b){var c=this.parameters;b=A(b);b.id=c.volumeId+":"+c.changestack+":"+a;return Object(G.a)(c.instance,this.credentialsProvider,{method:"POST",path:"/v1/changes/"+c.volumeId+"/"+c.changestack+"/spatials:push",payload:JSON.stringify({annotations:[b]}),responseType:"json"})}},
-{key:"delete",value:function(a){var b=this.parameters;return Object(G.a)(b.instance,this.credentialsProvider,{method:"POST",path:"/v1/changes/"+b.volumeId+"/"+b.changestack+"/spatials:delete",payload:JSON.stringify({type:J(a),ids:[b.volumeId+":"+b.changestack+":"+a]}),responseType:"json"})}}]);return b}(b(z.AnnotationSource,L.a));ib=R([Object(m.g)()],ib)},function(p,e,m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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 c(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}e.a=function(){return function(a){return function(a){function b(a){for(var c=[],d=0;d<arguments.length;++d)c[d-0]=arguments[d];k(this,
-b);var g;d=f(this,(g=b.__proto__||Object.getPrototypeOf(b)).call.apply(g,[].concat([this],$jscomp.arrayFromIterable(c))));d.credentialsProvider=d.rpc.getRef(c[1].credentialsProvider);return d}c(b,a);return b}(a)}};var a=m(84),b=m(85);p=m(0);e=this&&this.__decorate||function(a,b,c,g){var d=arguments.length,f=3>d?b:null===g?g=Object.getOwnPropertyDescriptor(b,c):g,l;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(a,b,c,g);else for(var h=a.length-1;0<=h;h--)if(l=
-a[h])f=(3>d?l(f):3<d?l(b,c,f):l(b,c))||f;return 3<d&&f&&Object.defineProperty(b,c,f),f};m=function(d){function e(){k(this,e);var c=f(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments));c.get=Object(a.a)(function(a,d){return c.rpc.promiseInvoke(b.a,{providerId:c.rpcId,invalidCredentials:a},d)});return c}c(e,d);return e}(p.c);m=e([Object(p.g)(b.b)],m)},function(p,e,m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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 c(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}e.a=function(b){var c,d,f;return function(g,h){if(void 0!==d&&(void 0===c||void 0===g||c.generation!==g.generation))return void 0===
-c&&f.addConsumer(h),d;c=void 0;f=new a.c;return d=b(g,f).then(function(a){c=a;f=void 0;return a},function(a){f.isCanceled&&(d=f=void 0);throw a;})}};var a=m(12);p=m(13);var b=m(31),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();(function(a){function b(){k(this,b);return f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,
-arguments))}c(b,a);return b})(p.a);var n=function(){function a(){k(this,a);this.providers=new Map}d(a,[{key:"register",value:function(a,b){this.providers.set(a,b)}},{key:"getCredentialsProvider",value:function(a,b){var c=this.providers.get(a);if(void 0===c)throw Error("No registered credentials provider: "+JSON.stringify(a));return c(b)}}]);return a}();(function(a){function b(){k(this,b);return f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,new n))}c(b,a);d(b,[{key:"register",value:function(a,
-b){this.base.register(a,b)}}]);return b})(function(a){function g(a){k(this,g);var c=f(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));c.base=a;c.memoize=new b.a;return c}c(g,a);d(g,[{key:"getCredentialsProvider",value:function(a,b){var c=this;return this.memoize.get({key:a,parameters:b},function(){return c.registerDisposer(c.base.getCredentialsProvider(a,b).addRef())})}}]);return g}(p.a))},function(p,e,m){e.b="CredentialsProvider";e.a="CredentialsProvider.get"},function(p,e,m){e.a=function(c,
-a,b,d){d=void 0===d?k.e:d;var e=void 0;return new Promise(function(l,g){function m(k){null!==e&&(e=Object(f.c)(c.serverUrls,b.path,b.method),e.responseType=b.responseType,e.setRequestHeader("Authorization",k.credentials.tokenType+" "+k.credentials.accessToken),e.onloadend=function(){if(null!==e){var b=this.status;200<=b&&300>b?(d.remove(n),l(this.response)):401===b?a.get(k,d).then(m):504===b||503===b?a.get(void 0,d).then(m):(d.remove(n),g(f.a.fromXhr(this)))}},e.send(b.payload))}var n=function(){var a=
-e;e=null;null!=a&&a.abort();g(k.a)};d.add(n);a.get(void 0,d).then(m)})};var k=m(12),f=m(15)},function(p,e,m){e.a=function(e){for(var f=0,c=e.length,a=0;a<c;++a)f=31*f+e.charCodeAt(a)|0;return f}},function(p,e,m){function k(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 f(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}m.d(e,"d",function(){return c});m.d(e,"e",function(){return a});m.d(e,"b",function(){return b});m.d(e,"c",function(){return d});m.d(e,"a",function(){return n});var c;(function(a){a[a.RAW=0]="RAW";a[a.JPEG=1]="JPEG";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION"})(c||(c={}));var a=function g(){f(this,g)};a.RPC_ID="brainmaps/VolumeChunkSource";var b=function r(){f(this,r)};b.RPC_ID=
-"brainmaps/MeshSource";var d=function(a){function b(){f(this,b);var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}k(b,a);return b}(b);d.RPC_ID="brainmaps/SkeletonSource";var n=function C(){f(this,C)};n.RPC_ID="brainmaps/Annotation"},function(p,e,m){e.b="mesh/MeshLayer";e.a="mesh/FragmentSource"},function(p,e,m){function k(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 f=m(91),c=m(3),a=m(8),b=m(5);p=m(0);var d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,
-d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),n=function C(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return C(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};e=this&&this.__decorate||function(a,b,c,d){var g=arguments.length,f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,h;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=
-Reflect.decorate(a,b,c,d);else for(var e=a.length-1;0<=e;e--)if(h=a[e])f=(3>g?h(f):3<g?h(b,c,f):h(b,c))||f;return 3<g&&f&&Object.defineProperty(b,c,f),f};m=function(g){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var b=(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");b=!b||"object"!==typeof b&&"function"!==typeof b?this:b;b.disjointSets=new f.a;
-b.changed=new a.a;return b}k(e,g);d(e,[{key:"disposed",value:function(){this.changed=this.disjointSets=void 0;n(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}},{key:"link",value:function(a,b){if(this.disjointSets.link(a,b)){var c=this.rpc;c&&c.invoke("DisjointUint64Sets.add",{id:this.rpcId,al:a.low,ah:a.high,bl:b.low,bh:b.high});this.changed.dispatch()}}},{key:"get",value:function(a){return this.disjointSets.get(a)}},{key:"clear",value:function(){if(this.disjointSets.clear()){var a=
-this.rpc;a&&a.invoke("DisjointUint64Sets.clear",{id:this.rpcId});this.changed.dispatch()}}},{key:"setElements",value:function(a){return this.disjointSets.setElements(a)}},{key:"toJSON",value:function(){return this.disjointSets.toJSON()}},{key:"restoreState",value:function(a){var d=this;this.clear();if(void 0!==a){var g=[new b.a,new b.a];Object(c.a)(a,function(a){Object(c.a)(a,function(a,b){g[b%2].parseString(String(a),10);0!==b&&d.link(g[0],g[1])})})}}},{key:"size",get:function(){return this.disjointSets.size}}],
-[{key:"makeWithCounterpart",value:function(a){var b=new this;b.initializeCounterpart(a);return b}}]);return e}(p.c);m=e([Object(p.g)("DisjointUint64Sets")],m);var l=new b.a,g=new b.a;Object(p.f)("DisjointUint64Sets.add",function(a){var b=this.get(a.id);l.low=a.al;l.high=a.ah;g.low=a.bl;g.high=a.bh;b.disjointSets.link(l,g)&&b.changed.dispatch()});Object(p.f)("DisjointUint64Sets.clear",function(a){a=this.get(a.id);a.disjointSets.clear()&&a.changed.dispatch()})},function(p,e,m){function k(a){for(var b=
-a,c=a[d];c!==a;)a=c,c=a[d];for(a=b[d];c!==a;)b[d]=c,b=a,a=b[d];return c}function f(a){function b(b,f){for(;;)switch(c){case 0:g=!0,d=a;case 1:if(!g&&d===a){c=3;break}c=4;return{value:d,done:!1};case 4:if(void 0===f){c=5;break}c=-1;throw f;case 5:d=d[n];case 2:g=!1;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,d,g,f={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();
-f[Symbol.iterator]=function(){return this};return f}m.d(e,"a",function(){return r});var c=m(5),a=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();$jscomp.initSymbol();var b=Symbol("disjoint_sets:rank");$jscomp.initSymbol();var d=Symbol("disjoint_sets:parent");$jscomp.initSymbol();var n=Symbol("disjoint_sets:next");
-$jscomp.initSymbol();var l=Symbol("disjoint_sets:prev");$jscomp.initSymbol();var g=Symbol("disjoint_sets:min"),r=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.map=new Map;this.generation=0}$jscomp.initSymbol();$jscomp.initSymbolIterator();a(e,[{key:"get",value:function(a){var b=this.map.get(a.toString());return void 0===b?a:k(b)[g]}},{key:"isMinElement",value:function(a){var b=this.get(a);return b===a||c.a.equal(b,a)}},{key:"makeSet",
-value:function(a){var c=a.toString(),f=this.map,e=f.get(c);return void 0===e?(a=e=a.clone(),a[d]=a,a[b]=0,a[n]=a[l]=a,e[g]=e,f.set(c,e),e):k(e)}},{key:"link",value:function(a,f){a=this.makeSet(a);f=this.makeSet(f);if(a===f)return!1;this.generation++;var e=a;var h=f,k=e[b],m=h[b];k>m?h[d]=e:(e[d]=h,k===m&&(h[b]=m+1),e=h);h=a;k=f;m=h[l];var p=k[l];k[l]=m;m[n]=k;h[l]=p;p[n]=h;a=a[g];f=f[g];e[g]=c.a.less(a,f)?a:f;return!0}},{key:"setElements",value:function(a){function b(b,h){for(;;)switch(c){case 0:l=
-a.toString();e=k.map.get(l);if(void 0!==e){c=1;break}c=3;return{value:a,done:!1};case 3:if(void 0===h){c=4;break}c=-1;throw h;case 4:c=2;break;case 1:g=$jscomp.makeIterator(f(e));case 5:if((d=g.next(b)).done){c=6;break}c=7;return{value:d.value,done:!1};case 7:if(void 0===h){c=8;break}c=-1;throw h;case 8:c=5;break;case 6:case 2:c=-1;default:return{value:void 0,done:!0}}}var c=0,d,g,e,l,k=this,m={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");
-}};$jscomp.initSymbolIterator();m[Symbol.iterator]=function(){return this};return m}},{key:"clear",value:function(){var a=this.map;if(0===a.size)return!1;++this.generation;a.clear();return!0}},{key:"mappings",value:function(a){function b(b,h){for(;;)switch(c){case 0:a=void 0===a?Array(2):a,e=$jscomp.makeIterator(l.map.values()),f=e.next();case 1:if(f.done){c=3;break}d=f.value;a[0]=d;a[1]=k(d)[g];c=4;return{value:a,done:!1};case 4:if(void 0===h){c=5;break}c=-1;throw h;case 5:case 2:f=e.next();c=1;
-break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,d,f,e,l=this,m={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();m[Symbol.iterator]=function(){return this};return m}},{key:Symbol.iterator,value:function(){return this.mappings()}},{key:"toJSON",value:function(){for(var a=[],b=$jscomp.makeIterator(this.map.values()),g=b.next();!g.done;g=b.next()){var e=g.value;if(e[d]===e){g=
-[];e=$jscomp.makeIterator(f(e));for(var l=e.next();!l.done;l=e.next())g.push(l.value);g.sort(c.a.compare);a.push(g)}}a.sort(function(a,b){return c.a.compare(a[0],b[0])});return a.map(function(a){return a.map(function(a){return a.toString()})})}},{key:"size",get:function(){return this.map.size}}]);return e}()},function(p,e,m){function k(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 f=m(93),c=m(8);p=m(0);var a=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),b=function l(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,
-b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return l(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};e=this&&this.__decorate||function(a,b,c,d){var g=arguments.length,f=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,e;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var l=a.length-1;0<=l;l--)if(e=a[l])f=(3>g?e(f):3<g?e(b,c,f):e(b,c))||f;return 3<g&&f&&Object.defineProperty(b,c,f),f};
-m=d=function(e){function g(){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var a=(g.__proto__||Object.getPrototypeOf(g)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a.hashTable=new f.a;a.changed=new c.b;return a}k(g,e);$jscomp.initSymbol();$jscomp.initSymbolIterator();a(g,[{key:"disposed",value:function(){b(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),
-"disposed",this).call(this);this.changed=this.hashTable=void 0}},{key:"add_",value:function(a){return this.hashTable.add(a)}},{key:"add",value:function(a){if(this.add_(a)){var b=this.rpc;b&&b.invoke("Uint64Set.add",{id:this.rpcId,value:a});this.changed.dispatch(a,!0)}}},{key:"has",value:function(a){return this.hashTable.has(a)}},{key:Symbol.iterator,value:function(){return this.hashTable.keys()}},{key:"delete_",value:function(a){return this.hashTable.delete(a)}},{key:"delete",value:function(a){if(this.delete_(a)){var b=
-this.rpc;b&&b.invoke("Uint64Set.delete",{id:this.rpcId,value:a});this.changed.dispatch(a,!1)}}},{key:"clear",value:function(){if(this.hashTable.clear()){var a=this.rpc;a&&a.invoke("Uint64Set.clear",{id:this.rpcId});this.changed.dispatch(null,!1)}}},{key:"toJSON",value:function(){for(var a=[],b=$jscomp.makeIterator(this),c=b.next();!c.done;c=b.next())a.push(c.value.toString());a.sort();return a}},{key:"size",get:function(){return this.hashTable.size}}],[{key:"makeWithCounterpart",value:function(a){var b=
-new d;b.initializeCounterpart(a);return b}}]);return g}(p.c);m=d=e([Object(p.g)("Uint64Set")],m);Object(p.f)("Uint64Set.add",function(a){var b=this.get(a.id);b.add_(a.value)&&b.changed.dispatch()});Object(p.f)("Uint64Set.delete",function(a){var b=this.get(a.id);b.delete_(a.value)&&b.changed.dispatch()});Object(p.f)("Uint64Set.clear",function(a){a=this.get(a.id);a.hashTable.clear()&&a.changed.dispatch()});var d},function(p,e,m){function k(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 f(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){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}m.d(e,"a",function(){return w});var a=
-m(94),b=m(5),d=function J(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return J(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},n=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),
-l=0,g=0,r=0,C=0;p=function(){function d(a){a=void 0===a?d.generateHashFunctions(3):a;c(this,d);this.loadFactor=.9;this.size=0;this.growFactor=1.2;this.maxHeight=8192;this.emptyHigh=this.emptyLow=4294967295;this.maxAttempts=this.maxRehashAttempts=5;this.maxWidth=4096/this.entryStride;this.generation=0;this.mungedEmptyKey=-1;this.hashFunctions=a;this.allocate(4,1)}n(d,[{key:"updateHashFunctions",value:function(a){this.hashFunctions=d.generateHashFunctions(a);this.mungedEmptyKey=-1}},{key:"tableWithMungedEmptyKey",
-value:function(a){for(var b=this.hashFunctions.length,c=Array(b),d=0;d<b;++d)c[d]=this.getHash(d,this.emptyLow,this.emptyHigh);d=this.mungedEmptyKey;if(-1===d)a:for(;;){d=16777216*Math.random()>>>0;for(var g=0;g<b;++g)for(var f=this.getHash(g,d,d),e=0;e<b;++e)if(c[e]===f)continue a;this.mungedEmptyKey=d;break}g=this.table;f=this.emptyLow;e=this.emptyHigh;for(var h=0;h<b;++h){var l=c[h];g[l]===f&&g[l+1]===e&&(g[l]=d,g[l+1]=d)}try{a(g)}finally{for(a=0;a<b;++a)h=c[a],g[h]===d&&g[h+1]===d&&(g[h]=f,g[h+
-1]=e)}}},{key:"getHash",value:function(a,b,c){a=this.hashFunctions[a];var d=this.width,g=this.height;d=a[0].compute(b,c)%d;b=a[1].compute(b,c)%g;return this.entryStride*(b*this.width+d)}},{key:"keys",value:function(a){function c(c,q){for(;;)switch(d){case 0:a=void 0===a?new b.a:a,r=v,p=r.emptyLow,n=r.emptyHigh,m=r.entryStride,k=v,l=k.table,h=0,e=l.length;case 1:if(!(h<e)){d=3;break}f=l[h];g=l[h+1];if(f===p&&g===n){d=4;break}a.low=f;a.high=g;d=5;return{value:a,done:!1};case 5:if(void 0===q){d=6;break}d=
--1;throw q;case 6:case 4:case 2:h+=m;d=1;break;case 3:d=-1;default:return{value:void 0,done:!0}}}var d=0,g,f,e,h,l,k,m,n,p,r,v=this,u={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();u[Symbol.iterator]=function(){return this};return u}},{key:"indexOfPair",value:function(a,b){var c=this.table,d=this.emptyHigh;if(a===this.emptyLow&&b===d)return-1;d=0;for(var g=this.hashFunctions.length;d<
-g;++d){var f=this.getHash(d,a,b);if(c[f]===a&&c[f+1]===b)return f}return-1}},{key:"indexOf",value:function(a){return this.indexOfPair(a.low,a.high)}},{key:"chooseAnotherEmptyKey",value:function(){for(var a=this.emptyLow,b=this.emptyHigh,c=this.table,d=this.entryStride,g,f;g=4294967296*Math.random()>>>0,f=4294967296*Math.random()>>>0,g===a&&f===b||this.hasPair(g,f););this.emptyLow=g;this.emptyHigh=f;for(var e=0,h=c.length;e<h;e+=d)c[e]===a&&c[e+1]===b&&(c[e]=g,c[e+1]=f)}},{key:"has",value:function(a){return-1!==
-this.indexOf(a)}},{key:"hasPair",value:function(a,b){return-1!==this.indexOfPair(a,b)}},{key:"delete",value:function(a){a=this.indexOf(a);if(-1!==a){var b=this.table;b[a]=this.emptyLow;b[a+1]=this.emptyHigh;++this.generation;this.size--;return!0}return!1}},{key:"clearTable",value:function(){for(var a=this.table,b=this.entryStride,c=this.emptyLow,d=this.emptyHigh,g=a.length,f=0;f<g;f+=b)a[f]=c,a[f+1]=d}},{key:"clear",value:function(){if(0===this.size)return!1;this.size=0;++this.generation;this.clearTable();
-return!0}},{key:"swapPending",value:function(a,b){var c=l,d=g;this.storePending(a,b);a[b]=c;a[b+1]=d}},{key:"storePending",value:function(a,b){l=a[b];g=a[b+1]}},{key:"backupPending",value:function(){r=l;C=g}},{key:"restorePending",value:function(){l=r;g=C}},{key:"tryToInsert",value:function(){for(var a=0,b=this.emptyLow,c=this.emptyHigh,d=this.maxAttempts,f=this.table,e=this.hashFunctions.length,h=Math.floor(Math.random()*e);;){var k=this.getHash(h,l,g);this.swapPending(f,k);if(l===b&&g===c)return!0;
-if(++a===d)break;h=(h+Math.floor(Math.random()*(e-1))+1)%e}return!1}},{key:"allocate",value:function(a,b){var c=a*b;this.width=a;this.height=b;this.table=new Uint32Array(c*this.entryStride);this.maxAttempts=c;this.clearTable();this.capacity=c*this.loadFactor;this.mungedEmptyKey=-1}},{key:"rehash",value:function(a,b,c){this.allocate(b,c);this.updateHashFunctions(this.hashFunctions.length);b=this.emptyLow;c=this.emptyHigh;for(var d=this.entryStride,g=0,f=a.length;g<f;g+=d){var e=a[g+1];if(a[g]!==b||
-e!==c)if(this.storePending(a,g),!this.tryToInsert())return!1}return!0}},{key:"grow",value:function(a){for(var b=this.table,c=this.width,d=this.height,g=this.maxWidth,f=this.maxHeight;;){var e=c*d;c=Math.min(g,Math.ceil(a/this.height));c*d<a&&(d=Math.min(f,Math.ceil(a/c)));var h=c*d;if(h<a&&h===e)throw Error("Maximum table size exceeded");for(e=0;e<this.maxRehashAttempts;++e)if(this.rehash(b,c,d))return;a=Math.ceil(this.growFactor*a)}}},{key:"insertInternal",value:function(){++this.generation;l===
-this.emptyLow&&g===this.emptyHigh&&this.chooseAnotherEmptyKey();++this.size>this.capacity&&(this.backupPending(),this.grow(Math.ceil(this.growFactor*this.width*this.height)),this.restorePending());for(;!this.tryToInsert();)this.backupPending(),this.grow(this.width*this.height),this.restorePending()}}],[{key:"generateHashFunctions",value:function(b){b=void 0===b?3:b;for(var c=[],d=0;d<b;++d){var g=[a.a.generate(),a.a.generate()];c.push(g)}return c}}]);return d}();var w=function(a){function b(){c(this,
-b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}f(b,a);$jscomp.initSymbol();$jscomp.initSymbolIterator();n(b,[{key:"add",value:function(a){var b=a.low;a=a.high;if(this.hasPair(b,a))return!1;l=b;g=a;this.insertInternal();return!0}},{key:Symbol.iterator,value:function(){return this.keys()}}]);return b}(p);w.prototype.entryStride=2;var h=0,B=0,I=0,u=0;(function(a){function e(){c(this,e);return k(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}f(e,a);
-$jscomp.initSymbol();$jscomp.initSymbolIterator();n(e,[{key:"set",value:function(a,b){var c=a.low;a=a.high;if(this.hasPair(c,a))return!1;l=c;g=a;h=b.low;B=b.high;this.insertInternal();return!0}},{key:"get",value:function(a,b){a=this.indexOf(a);if(-1===a)return!1;var c=this.table;b.low=c[a+2];b.high=c[a+3];return!0}},{key:"swapPending",value:function(a,b){var c=h,g=B;d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"swapPending",this).call(this,a,b);a[b+2]=c;a[b+3]=g}},{key:"storePending",
-value:function(a,b){d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"storePending",this).call(this,a,b);h=a[b+2];B=a[b+3]}},{key:"backupPending",value:function(){d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"backupPending",this).call(this);I=h;u=B}},{key:"restorePending",value:function(){d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"restorePending",this).call(this);h=I;B=u}},{key:Symbol.iterator,value:function(){return this.entries()}},{key:"entries",value:function(a){function c(c,
-q){for(;;)switch(d){case 0:a=void 0===a?[new b.a,new b.a]:a,M=R,y=M.emptyLow,u=M.emptyHigh,r=M.entryStride,p=R,n=p.table,m=$jscomp.makeIterator(a),k=m.next().value,l=m.next().value,h=0,e=n.length;case 1:if(!(h<e)){d=3;break}f=n[h];g=n[h+1];if(f===y&&g===u){d=4;break}k.low=f;k.high=g;l.low=n[h+2];l.high=n[h+3];d=5;return{value:a,done:!1};case 5:if(void 0===q){d=6;break}d=-1;throw q;case 6:case 4:case 2:h+=r;d=1;break;case 3:d=-1;default:return{value:void 0,done:!0}}}var d=0,g,f,e,h,l,k,m,n,p,r,u,y,
-M,R=this,v={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();v[Symbol.iterator]=function(){return this};return v}}]);return e})(p).prototype.entryStride=4},function(p,e,m){m.d(e,"a",function(){return f});var k=function(){function c(a,b){for(var c=0;c<b.length;c++){var f=b[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(a,
-b,d){b&&c(a.prototype,b);d&&c(a,d);return a}}(),f=function(){function c(a,b,d,f){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.a0=a;this.a1=b;this.b=d;this.c=f}k(c,[{key:"computeDotProduct",value:function(a,b){var c=this.a0,f=this.a1;return c[0]*(a&255)+c[1]*(a>>8&255)+c[2]*(a>>16&255)+c[3]*(a>>24&255)+(f[0]*(b&255)+f[1]*(b>>8&255)+f[2]*(b>>16&255)+f[3]*(b>>24&255))}},{key:"compute",value:function(a,b){var c=this.b,f=this.c;a=this.computeDotProduct(a,b);return(a+
-a*a%4093*f+c)%4093}},{key:"toString",value:function(){return"new HashFunction(Float32Array.of("+this.a0+"), "+("Float32Array.of("+this.a1+"), "+this.b+", "+this.c+")")}}],[{key:"generate",value:function(){function a(){return Math.floor(4093*Math.random())}return new c(Float32Array.of(a(),a(),a(),a()),Float32Array.of(a(),a(),a(),a()),a(),a())}}]);return c}()},function(p,e,m){e.a="skeleton/SkeletonLayer"},function(p,e,m){function k(c,e,k,m,h,p,I,u){var g=h[0],r=h[1],v=h[2];h=m[0];var w=m[1];m=m[2];
-var t=k[0],z=k[1],C=k[2];C-=z*r;z-=t*g;if(0===g*r*v)return[0,0];k=h*w*m+31;if(void 0===a||a.length<k)a=new Uint32Array(k),b=new Uint32Array(1*k),d=new Uint32Array(1*k),n=new Uint32Array(k),l=new Uint32Array(k);k=a.subarray(0,k);k.fill(0);for(var q=b,G=d,L=n,K=l,D=0,E=c[e]+1>>>0,B=0,N=h-g,O=h*w-h*r,F=0;F<v;++F,e+=C,B+=O)for(var y=0;y<r;++y,e+=z,B+=N)for(var M=0;M<g;++M,e+=t){var R=c[e];R!==E&&(E=q[1*D]=R,L[D]=D++);k[B++]=D}L.subarray(0,D).sort(function(a,b){return q[a]-q[b]});c=-1;g=q[1*L[0]]+1>>>
-0;for(r=0;r<D;++r)v=L[r],t=q[1*v],t!==g&&(++c,g=G[1*c]=t),K[v+1]=c;++c;return Object(f.c)(u,p,I,h*w*m,c,G,k,K,1)}e.a=function(a,b,d,e,h,l){h=void 0===h?0:h;l=void 0===l?Object(c.a)(e,1):l;return Object(f.b)(a,b,d,e,h,l,k)};var f=m(22),c=m(20),a,b,d,n,l},function(p,e,m){function k(c,e,k,m,h,p,I,u){var g=h[0],r=h[1],v=h[2];h=m[0];var w=m[1];m=m[2];var t=k[0],z=k[1],H=k[2];H-=z*r;z-=t*g;if(0===g*r*v)return[0,0];k=h*w*m+31;if(void 0===a||a.length<k)a=new Uint32Array(k),b=new Uint32Array(2*k),d=new Uint32Array(2*
-k),n=new Uint32Array(k),l=new Uint32Array(k);k=a.subarray(0,k);k.fill(0);for(var q=b,G=d,L=n,K=l,D=0,C=c[e]+1>>>0,B=0,N=0,O=h-g,F=h*w-h*r,y=0;y<v;++y,e+=H,N+=F)for(var M=0;M<r;++M,e+=z,N+=O)for(var R=0;R<g;++R,e+=t){var X=c[e],ba=c[e+1];if(X!==C||ba!==B)C=q[2*D]=X,B=q[2*D+1]=ba,L[D]=D++;k[N++]=D}L.subarray(0,D).sort(function(a,b){var c=q[2*a],d=q[2*b];return q[2*a+1]-q[2*b+1]||c-d});c=-1;g=q[2*L[0]]+1>>>0;for(r=z=0;r<D;++r){v=L[r];H=2*v;t=q[H];H=q[H+1];if(t!==g||H!==z)++c,z=2*c,g=G[z]=t,z=G[z+1]=
-H;K[v+1]=c}++c;return Object(f.c)(u,p,I,h*w*m,c,G,k,K,2)}e.a=function(a,b,d,e,h,l){h=void 0===h?0:h;l=void 0===l?Object(c.a)(e,2):l;return Object(f.b)(a,b,d,e,h,l,k)};var f=m(22),c=m(20),a,b,d,n,l},function(p,e,m){m.d(e,"a",function(){return f});var k=function(){function c(a,b){for(var c=0;c<b.length;c++){var f=b[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(a,b,d){b&&c(a.prototype,b);d&&c(a,d);return a}}(),f=function(){function c(a){a=
-void 0===a?16:a;if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.length=0;this.data=new Uint32Array(a)}k(c,[{key:"resize",value:function(a){var b=this.data;if(a>b.length){var c=new Uint32Array(Math.max(a,2*b.length));c.set(b.subarray(0,this.length));this.data=c}this.length=a}},{key:"shrinkToFit",value:function(){this.data=new Uint32Array(this.view)}},{key:"clear",value:function(){this.length=0}},{key:"appendArray",value:function(a){var b=this.length;this.resize(b+
-a.length);this.data.set(a,b)}},{key:"eraseRange",value:function(a,b){this.data.copyWithin(a,b,this.length);this.length-=b-a}},{key:"view",get:function(){var a=this.data;return new Uint32Array(a.buffer,a.byteOffset,this.length)}}]);return c}()},function(p,e,m){e.a=function(a,b,d){var e=new k.JpegDecoder;e.parse(a);if(e.width*e.height!==b[0]*b[1]*b[2])throw Error("JPEG data does not have the expected dimensions: "+("width="+e.width+", height="+e.height+", ")+("chunkDataSize="+c.m.str(b)));if(e.numComponents!==
-d)throw Error("JPEG data does not have the expected number of components: "+("components="+e.numComponents+", expected="+d));if(1===e.numComponents)return e.getData(e.width,e.height,!1);if(3===e.numComponents)return a=e.getData(e.width,e.height,!1),Object(f.c)(a,e.width*e.height,3);throw Error("JPEG data has an unsupported number of components: components="+e.numComponents);};var k=m(100);m.n(k);var f=m(20),c=m(1)},function(p,e,m){function k(c,a){if(0===c.indexOf("data:")){var b=c.indexOf("base64,")+
-7;c=atob(c.substring(b));b=new Uint8Array(c.length);for(var d=c.length-1;0<=d;d--)b[d]=c.charCodeAt(d);a(b.buffer)}else{var f=new XMLHttpRequest;f.open("GET",c,!0);f.responseType="arraybuffer";f.onload=function(){a(f.response)};f.send(null)}}e=function(){function c(){this._src=null;this._parser=new f.JpegImage;this.onload=null}c.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;k(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,c=a.height,f=b*c*4;a=a.data;if(1===this._parser.numComponents){var e=this._parser.getData(b,c,!1);for(c=b=0;b<f;){var g=e[c++];a[b++]=g;a[b++]=g;a[b++]=g;a[b++]=
-255}}else for(e=this._parser.getData(b,c,!0),c=b=0;b<f;)a[b++]=e[c++],a[b++]=e[c++],a[b++]=e[c++],a[b++]=255}};return c}();var f;(function(c){function a(a){for(var b=1,c=0;a>b;)b<<=1,c++;return c}function b(a,b){return a[b]<<8|a[b+1]}function d(a,b){return(a[b]<<24|a[b+1]<<16|a[b+2]<<8|a[b+3])>>>0}function f(a,b,c){Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!1});return c}var e=function(){function a(){}function b(a,b){for(var c=0,d=[],g,f,e=16;0<e&&!a[e-1];)e--;d.push({children:[],
-index:0});var h=d[0],k;for(g=0;g<e;g++){for(f=0;f<a[g];f++){h=d.pop();for(h.children[h.index]=b[c];0<h.index;)h=d.pop();h.index++;for(d.push(h);d.length<=g;)d.push(k={children:[],index:0}),h.children[h.index]=k.children,h=k;c++}g+1<e&&(d.push(k={children:[],index:0}),h.children[h.index]=k.children,h=k)}return d[0].children}function c(a,b,c,d,g,e,h,k,l){function q(){if(0<K)return K--,v>>K&1;v=a[b++];if(255===v){var c=a[b++];if(c)throw"unexpected marker: "+(v<<8|c).toString(16);}K=7;return v>>>7}function m(a){for(;;){a=
-a[q()];if("number"===typeof a)return a;if("object"!==typeof a)throw"invalid huffman sequence";}}function t(a){for(var b=0;0<a;)b=b<<1|q(),a--;return b}function n(a){if(1===a)return 1===q()?1:-1;var b=t(a);return b>=1<<a-1?b:b+(-1<<a)+1}function y(a,b){var c=m(a.huffmanTableDC);c=0===c?0:n(c);a.blockData[b]=a.pred+=c;for(c=1;64>c;){var d=m(a.huffmanTableAC),g=d&15;d>>=4;if(0===g){if(15>d)break;c+=16}else c+=d,a.blockData[b+f[c]]=n(g),c++}}function p(a,b){var c=m(a.huffmanTableDC);c=0===c?0:n(c)<<l;
-a.blockData[b]=a.pred+=c}function r(a,b){a.blockData[b]|=q()<<l}function L(a,b){if(0<D)D--;else for(var c=e;c<=h;){var d=m(a.huffmanTableAC),g=d&15;d>>=4;if(0===g){if(15>d){D=t(d)+(1<<d)-1;break}c+=16}else c+=d,a.blockData[b+f[c]]=n(g)*(1<<l),c++}}function G(a,b){for(var c=e,d=0,g;c<=h;){g=f[c];switch(w){case 0:d=m(a.huffmanTableAC);g=d&15;d>>=4;if(0===g)15>d?(D=t(d)+(1<<d),w=4):(d=16,w=1);else{if(1!==g)throw"invalid ACn encoding";x=n(g);w=d?2:3}continue;case 1:case 2:a.blockData[b+g]?a.blockData[b+
-g]+=q()<<l:(d--,0===d&&(w=2===w?3:0));break;case 3:a.blockData[b+g]?a.blockData[b+g]+=q()<<l:(a.blockData[b+g]=x<<l,w=0);break;case 4:a.blockData[b+g]&&(a.blockData[b+g]+=q()<<l)}c++}4===w&&(D--,0===D&&(w=0))}var z=c.mcusPerLine,u=b,v=0,K=0,D=0,w=0,x,A=d.length,C,H,E,J;k=c.progressive?0===e?0===k?p:r:0===k?L:G:y;var B=0;c=1===A?d[0].blocksPerLine*d[0].blocksPerColumn:z*c.mcusPerColumn;g||(g=c);for(var I,Ja;B<c;){for(C=0;C<A;C++)d[C].pred=0;D=0;if(1===A){var Z=d[0];for(J=0;J<g;J++)k(Z,64*((Z.blocksPerLine+
-1)*(B/Z.blocksPerLine|0)+B%Z.blocksPerLine)),B++}else for(J=0;J<g;J++){for(C=0;C<A;C++)for(Z=d[C],I=Z.h,Ja=Z.v,H=0;H<Ja;H++)for(E=0;E<I;E++)k(Z,64*((Z.blocksPerLine+1)*((B/z|0)*Z.v+H)+(B%z*Z.h+E)));B++}K=0;Z=a[b]<<8|a[b+1];if(65280>=Z)throw"marker was not found";if(65488<=Z&&65495>=Z)b+=2;else break}return b-u}function d(a,b){a=b.blocksPerLine;for(var c=b.blocksPerColumn,d=new Int16Array(64),g=0;g<c;g++)for(var f=0;f<a;f++){for(var e,h,k,l,m,t,n,y,p,r,z,u,v=64*((b.blocksPerLine+1)*g+f),P=d,w=b.quantizationTable,
-x=b.blockData,A=0;64>A;A+=8)e=x[v+A],y=x[v+A+1],n=x[v+A+2],t=x[v+A+3],m=x[v+A+4],l=x[v+A+5],k=x[v+A+6],h=x[v+A+7],e*=w[A],0===(y|n|t|m|l|k|h)?(e=5793*e+512>>10,P[A]=e,P[A+1]=e,P[A+2]=e,P[A+3]=e,P[A+4]=e,P[A+5]=e,P[A+6]=e,P[A+7]=e):(y*=w[A+1],n*=w[A+2],t*=w[A+3],m*=w[A+4],l*=w[A+5],k*=w[A+6],h*=w[A+7],u=5793*e+128>>8,z=5793*m+128>>8,r=n,p=k,m=2896*(y-h)+128>>8,h=2896*(y+h)+128>>8,t<<=4,l<<=4,u=u+z+1>>1,z=u-z,e=3784*r+1567*p+128>>8,r=1567*r-3784*p+128>>8,p=e,m=m+l+1>>1,l=m-l,h=h+t+1>>1,t=h-t,u=u+p+
-1>>1,p=u-p,z=z+r+1>>1,r=z-r,e=2276*m+3406*h+2048>>12,m=3406*m-2276*h+2048>>12,h=e,e=799*t+4017*l+2048>>12,t=4017*t-799*l+2048>>12,l=e,P[A]=u+h,P[A+7]=u-h,P[A+1]=z+l,P[A+6]=z-l,P[A+2]=r+t,P[A+5]=r-t,P[A+3]=p+m,P[A+4]=p-m);for(w=0;8>w;++w)e=P[w],y=P[w+8],n=P[w+16],t=P[w+24],m=P[w+32],l=P[w+40],k=P[w+48],h=P[w+56],0===(y|n|t|m|l|k|h)?(e=5793*e+8192>>14,e=-2040>e?0:2024<=e?255:e+2056>>4,x[v+w]=e,x[v+w+8]=e,x[v+w+16]=e,x[v+w+24]=e,x[v+w+32]=e,x[v+w+40]=e,x[v+w+48]=e,x[v+w+56]=e):(u=5793*e+2048>>12,z=5793*
-m+2048>>12,r=n,p=k,m=2896*(y-h)+2048>>12,h=2896*(y+h)+2048>>12,u=(u+z+1>>1)+4112,z=u-z,e=3784*r+1567*p+2048>>12,r=1567*r-3784*p+2048>>12,p=e,m=m+l+1>>1,l=m-l,h=h+t+1>>1,t=h-t,u=u+p+1>>1,p=u-p,z=z+r+1>>1,r=z-r,e=2276*m+3406*h+2048>>12,m=3406*m-2276*h+2048>>12,h=e,e=799*t+4017*l+2048>>12,t=4017*t-799*l+2048>>12,l=e,e=u+h,h=u-h,y=z+l,k=z-l,n=r+t,l=r-t,t=p+m,m=p-m,e=16>e?0:4080<=e?255:e>>4,y=16>y?0:4080<=y?255:y>>4,n=16>n?0:4080<=n?255:n>>4,t=16>t?0:4080<=t?255:t>>4,m=16>m?0:4080<=m?255:m>>4,l=16>l?0:
-4080<=l?255:l>>4,k=16>k?0:4080<=k?255:k>>4,h=16>h?0:4080<=h?255:h>>4,x[v+w]=e,x[v+w+8]=y,x[v+w+16]=n,x[v+w+24]=t,x[v+w+32]=m,x[v+w+40]=l,x[v+w+48]=k,x[v+w+56]=h)}return b.blockData}function g(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 g(){var b=a[l]<<8|a[l+1];l+=2;return b}
-function e(){var b=g();b=a.subarray(l,l+b-2);l+=b.length;return b}function h(a){for(var b=Math.ceil(a.samplesPerLine/8/a.maxH),c=Math.ceil(a.scanLines/8/a.maxV),d=0;d<a.components.length;d++){P=a.components[d];var g=Math.ceil(Math.ceil(a.samplesPerLine/8)*P.h/a.maxH),e=Math.ceil(Math.ceil(a.scanLines/8)*P.v/a.maxV);P.blockData=new Int16Array(64*c*P.v*(b*P.h+1));P.blocksPerLine=g;P.blocksPerColumn=e}a.mcusPerLine=b;a.mcusPerColumn=c}var l=0,k=null,m=null,t=[],n=[],p=[];var r=g();if(65496!==r)throw"SOI not found";
-for(r=g();65497!==r;){switch(r){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:var u=e();65504===r&&74===u[0]&&70===u[1]&&73===u[2]&&70===u[3]&&0===u[4]&&(k={version:{major:u[5],minor:u[6]},densityUnits:u[7],xDensity:u[8]<<8|u[9],yDensity:u[10]<<8|u[11],thumbWidth:u[12],thumbHeight:u[13],thumbData:u.subarray(14,14+3*u[12]*u[13])});65518===r&&65===u[0]&&100===
-u[1]&&111===u[2]&&98===u[3]&&101===u[4]&&0===u[5]&&(m={version:u[6],flags0:u[7]<<8|u[8],flags1:u[9]<<8|u[10],transformCode:u[11]});break;case 65499:r=g()+l-2;for(var v;l<r;){var y=a[l++],M=new Uint16Array(64);if(0===y>>4)for(u=0;64>u;u++)v=f[u],M[v]=a[l++];else if(1===y>>4)for(u=0;64>u;u++)v=f[u],M[v]=g();else throw"DQT: invalid table spec";t[y&15]=M}break;case 65472:case 65473:case 65474:if(w)throw"Only single frame JPEGs supported";g();var w={};w.extended=65473===r;w.progressive=65474===r;w.precision=
-a[l++];w.scanLines=g();w.samplesPerLine=g();w.components=[];w.componentIds={};u=a[l++];for(r=M=y=0;r<u;r++){v=a[l];var X=a[l+1]>>4;var ba=a[l+1]&15;y<X&&(y=X);M<ba&&(M=ba);X=w.components.push({h:X,v:ba,quantizationTable:t[a[l+2]]});w.componentIds[v]=X-1;l+=3}w.maxH=y;w.maxV=M;h(w);break;case 65476:v=g();for(r=2;r<v;){y=a[l++];M=new Uint8Array(16);for(u=X=0;16>u;u++,l++)X+=M[u]=a[l];ba=new Uint8Array(X);for(u=0;u<X;u++,l++)ba[u]=a[l];r+=17+X;(0===y>>4?p:n)[y&15]=b(M,ba)}break;case 65501:g();var A=
-g();break;case 65498:g();v=a[l++];u=[];for(r=0;r<v;r++){y=w.componentIds[a[l++]];var P=w.components[y];y=a[l++];P.huffmanTableDC=p[y>>4];P.huffmanTableAC=n[y&15];u.push(P)}r=a[l++];v=a[l++];y=a[l++];r=c(a,l,w,u,A,r,v,y>>4,y&15);l+=r;break;case 65535:255!==a[l]&&l--;break;default:if(255===a[l-3]&&192<=a[l-2]&&254>=a[l-2])l-=3;else throw"unknown JPEG marker "+r.toString(16);}r=g()}this.width=w.samplesPerLine;this.height=w.scanLines;this.jfif=k;this.adobe=m;this.components=[];for(r=0;r<w.components.length;r++)P=
-w.components[r],this.components.push({output:d(w,P),scaleX:P.h/w.maxH,scaleY:P.v/w.maxV,blocksPerLine:P.blocksPerLine,blocksPerColumn:P.blocksPerColumn});this.numComponents=this.components.length},_getLinearizedBlockData:function(a,b){var c=this.width/a,d=this.height/b,g,e,f=this.components.length,h=a*b*f,l=new Uint8Array(h),k=new Uint32Array(a);for(e=0;e<f;e++){var m=this.components[e];var t=m.scaleX*c;var n=m.scaleY*d;var y=e;var p=m.output;var r=m.blocksPerLine+1<<3;for(g=0;g<a;g++)m=0|g*t,k[g]=
-(m&4294967288)<<3|m&7;for(t=0;t<b;t++)for(m=0|t*n,m=r*(m&4294967288)|(m&7)<<3,g=0;g<a;g++)l[y]=p[m+k[g]],y+=f}if(b=this.decodeTransform)for(e=0;e<h;)for(a=m=0;m<f;m++,e++,a+=2)l[e]=(l[e]*b[a]>>8)+b[a+1];return l},_isColorConversionNeeded:function(){return this.adobe&&this.adobe.transformCode?!0:3===this.numComponents?!0:!1},_convertYccToRgb:function(a){for(var b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],a[e]=g(b-179.456+1.402*d),a[e+1]=g(b+135.459-.344*c-.714*d),a[e+2]=g(b-226.816+1.772*
-c);return a},_convertYcckToRgb:function(a){for(var b,c,d,e,f=0,h=0,l=a.length;h<l;h+=4){b=a[h];c=a[h+1];d=a[h+2];e=a[h+3];var k=-122.67195406894+c*(-6.60635669420364E-5*c+4.37130475926232E-4*d-5.4080610064599E-5*b+4.8449797120281E-4*e-.154362151871126)+d*(-9.57964378445773E-4*d+8.17076911346625E-4*b-.00477271405408747*e+1.53380253221734)+b*(9.61250184130688E-4*b-.00266257332283933*e+.48357088451265)+e*(-3.36197177618394E-4*e+.484791561490776),m=107.268039397724+c*(2.19927104525741E-5*c-6.40992018297945E-4*
-d+6.59397001245577E-4*b+4.26105652938837E-4*e-.176491792462875)+d*(-7.78269941513683E-4*d+.00130872261408275*b+7.70482631801132E-4*e-.151051492775562)+b*(.00126935368114843*b-.00265090189010898*e+.25802910206845)+e*(-3.18913117588328E-4*e-.213742400323665);b=-20.810012546947+c*(-5.70115196973677E-4*c-2.63409051004589E-5*d+.0020741088115012*b-.00288260236853442*e+.814272968359295)+d*(-1.53496057440975E-5*d-1.32689043961446E-4*b+5.60833691242812E-4*e-.195152027534049)+b*(.00174418132927582*b-.00255243321439347*
-e+.116935020465145)+e*(-3.43531996510555E-4*e+.24165260232407);a[f++]=g(k);a[f++]=g(m);a[f++]=g(b)}return a},_convertYcckToCmyk:function(a){for(var b,c,d,e=0,f=a.length;e<f;e+=4)b=a[e],c=a[e+1],d=a[e+2],a[e]=g(434.456-b-1.402*d),a[e+1]=g(119.541-b+.344*c+.714*d),a[e+2]=g(481.816-b-1.772*c);return a},_convertCmykToRgb:function(a){for(var b,c,d,g,e=0,f=1/255/255,h=0,l=a.length;h<l;h+=4){b=a[h];c=a[h+1];d=a[h+2];g=a[h+3];var k=b*(-4.387332384609988*b+54.48615194189176*c+18.82290502165302*d+212.25662451639585*
-g-72734.4411664936)+c*(1.7149763477362134*c-5.6096736904047315*d-17.873870861415444*g-1401.7366389350734)+d*(-2.5217340131683033*d-21.248923337353073*g+4465.541406466231)-g*(21.86122147463605*g+48317.86113160301),m=b*(8.841041422036149*b+60.118027045597366*c+6.871425592049007*d+31.159100130055922*g-20220.756542821975)+c*(-15.310361306967817*c+17.575251261109482*d+131.35250912493976*g-48691.05921601825)+d*(4.444339102852739*d+9.8632861493405*g-6341.191035517494)-g*(20.737325471181034*g+47890.15695978492);
-b=b*(.8842522430003296*b+8.078677503112928*c+30.89978309703729*d-.23883238689178934*g-3616.812083916688)+c*(10.49593273432072*c+63.02378494754052*d+50.606957656360734*g-28620.90484698408)+d*(.03296041114873217*d+115.60384449646641*g-49363.43385999684)-g*(22.33816807309886*g+45932.16563550634);a[e++]=0<=k?255:-16581375>=k?0:255+k*f|0;a[e++]=0<=m?255:-16581375>=m?0:255+m*f|0;a[e++]=0<=b?255:-16581375>=b?0:255+b*f|0}return a},getData:function(a,b,c){if(4<this.numComponents)throw"Unsupported color mode";
-a=this._getLinearizedBlockData(a,b);if(3===this.numComponents)return this._convertYccToRgb(a);if(4===this.numComponents){if(this._isColorConversionNeeded())return c?this._convertYcckToRgb(a):this._convertYcckToCmyk(a);if(c)return this._convertCmykToRgb(a)}return a}};return a}();"use strict";var g=function(){function a(a,b,c){this.data=a;this.bp=b;this.dataEnd=c;this.chigh=a[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 b=[{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,b=this.bp;255===a[b]?143<a[b+1]?(this.clow+=65280,this.ct=8):(b++,this.clow+=a[b]<<9,this.ct=7,this.bp=b):(b++,this.clow+=b<this.dataEnd?a[b]<<
-8:65280,this.ct=8,this.bp=b);65535<this.clow&&(this.chigh+=this.clow>>16,this.clow&=65535)},readBit:function(a,c){var d=a[c]>>1,g=a[c]&1;d=b[d];var e=d.qe,f=this.a-e;if(this.chigh<e)f<e?(f=e,e=g,d=d.nmps):(f=e,e=1^g,1===d.switchFlag&&(g=e),d=d.nlps);else{this.chigh-=e;if(0!==(f&32768))return this.a=f,g;f<e?(e=1^g,1===d.switchFlag&&(g=e),d=d.nlps):(e=g,d=d.nmps)}do 0===this.ct&&this.byteIn(),f<<=1,this.chigh=this.chigh<<1&65535|this.clow>>15&1,this.clow=this.clow<<1&65535,this.ct--;while(0===(f&32768));
-this.a=f;a[c]=d<<1|g;return e}};return a}();"use strict";var k=function(){function c(){this.failOnCorruptedImage=!1}function e(a,b,c){a=c.xcb_;c=c.ycb_;var d=1<<a,g=1<<c,e=b.tbx0>>a,f=b.tby0>>c,h=b.tbx1+d-1>>a,l=b.tby1+g-1>>c,k=b.resolution.precinctParameters,q=[],m=[],n,y;for(y=f;y<l;y++)for(n=e;n<h;n++){var t={cbx:n,cby:y,tbx0:d*n,tby0:g*y,tbx1:d*(n+1),tby1:g*(y+1)};t.tbx0_=Math.max(b.tbx0,t.tbx0);t.tby0_=Math.max(b.tby0,t.tby0);t.tbx1_=Math.min(b.tbx1,t.tbx1);t.tby1_=Math.min(b.tby1,t.tby1);var p=
-Math.floor((t.tbx0_-b.tbx0)/k.precinctWidthInSubband)+Math.floor((t.tby0_-b.tby0)/k.precinctHeightInSubband)*k.numprecinctswide;t.precinctNumber=p;t.subbandType=b.type;t.Lblock=3;if(!(t.tbx1_<=t.tbx0_||t.tby1_<=t.tby0_)){q.push(t);var r=m[p];void 0!==r?(n<r.cbxMin?r.cbxMin=n:n>r.cbxMax&&(r.cbxMax=n),y<r.cbyMin?r.cbxMin=y:y>r.cbyMax&&(r.cbyMax=y)):m[p]=r={cbxMin:n,cbyMin:y,cbxMax:n,cbyMax:y};t.precinct=r}}b.codeblockParameters={codeblockWidth:a,codeblockHeight:c,numcodeblockwide:h-e+1,numcodeblockhigh:l-
-f+1};b.codeblocks=q;b.precincts=m}function f(a,b,c){var d=[];a=a.subbands;for(var g=0,e=a.length;g<e;g++)for(var f=a[g].codeblocks,h=0,l=f.length;h<l;h++){var k=f[h];k.precinctNumber===b&&d.push(k)}return{layerNumber:c,codeblocks:d}}function l(a){var b=a.tiles[a.currentTile.index],c=b.codingStyleDefaultParameters.layersCount,d=a.SIZ.Csiz,g=0;for(a=0;a<d;a++)g=Math.max(g,b.components[a].codingStyleParameters.decompositionLevelsCount);var e=0,h=0,l=0,k=0;this.nextPacket=function(){for(;e<c;e++){for(;h<=
-g;h++){for(;l<d;l++){var a=b.components[l];if(!(h>a.codingStyleParameters.decompositionLevelsCount)){a=a.resolutions[h];for(var q=a.precinctParameters.numprecincts;k<q;)return a=f(a,k,e),k++,a;k=0}}l=0}h=0}throw Error("JPX Error: Out of packets");}}function k(a){var b=a.tiles[a.currentTile.index],c=b.codingStyleDefaultParameters.layersCount,d=a.SIZ.Csiz,g=0;for(a=0;a<d;a++)g=Math.max(g,b.components[a].codingStyleParameters.decompositionLevelsCount);var e=0,h=0,l=0,k=0;this.nextPacket=function(){for(;e<=
-g;e++){for(;h<c;h++){for(;l<d;l++){var a=b.components[l];if(!(e>a.codingStyleParameters.decompositionLevelsCount)){a=a.resolutions[e];for(var q=a.precinctParameters.numprecincts;k<q;)return a=f(a,k,h),k++,a;k=0}}l=0}h=0}throw Error("JPX Error: Out of packets");}}function m(a){var b=a.tiles[a.currentTile.index],c=b.codingStyleDefaultParameters.layersCount,d=a.SIZ.Csiz,g,e,h,l=0;for(h=0;h<d;h++)l=Math.max(l,b.components[h].codingStyleParameters.decompositionLevelsCount);var k=new Int32Array(l+1);for(e=
-0;e<=l;++e){for(h=a=0;h<d;++h){var q=b.components[h].resolutions;e<q.length&&(a=Math.max(a,q[e].precinctParameters.numprecincts))}k[e]=a}var m=h=e=g=0;this.nextPacket=function(){for(;e<=l;e++){for(;m<k[e];m++){for(;h<d;h++){var a=b.components[h];if(!(e>a.codingStyleParameters.decompositionLevelsCount||(a=a.resolutions[e],m>=a.precinctParameters.numprecincts))){for(;g<c;)return a=f(a,m,g),g++,a;g=0}}h=0}m=0}throw Error("JPX Error: Out of packets");}}function n(a){var b=a.tiles[a.currentTile.index],
-c=b.codingStyleDefaultParameters.layersCount,d=a.SIZ.Csiz,g=q(b),e=0,h=0,l=0,k=0,m=0;this.nextPacket=function(){for(;m<g.maxNumHigh;m++){for(;k<g.maxNumWide;k++){for(;l<d;l++){for(var a=b.components[l],q=a.codingStyleParameters.decompositionLevelsCount;h<=q;h++){var n=a.resolutions[h],t=r(k,m,g.components[l].resolutions[h],g,n);if(null!==t){for(;e<c;)return a=f(n,t,e),e++,a;e=0}}h=0}l=0}k=0}throw Error("JPX Error: Out of packets");}}function p(a){var b=a.tiles[a.currentTile.index],c=b.codingStyleDefaultParameters.layersCount,
-d=a.SIZ.Csiz,g=q(b),e=0,h=0,l=0,k=0,m=0;this.nextPacket=function(){for(;l<d;++l){for(var a=b.components[l],q=g.components[l],n=a.codingStyleParameters.decompositionLevelsCount;m<q.maxNumHigh;m++){for(;k<q.maxNumWide;k++){for(;h<=n;h++){var t=a.resolutions[h],y=r(k,m,q.resolutions[h],q,t);if(null!==y){for(;e<c;)return a=f(t,y,e),e++,a;e=0}}h=0}k=0}m=0}throw Error("JPX Error: Out of packets");}}function r(a,b,c,d,g){a*=d.minWidth;b*=d.minHeight;return 0!==a%c.width||0!==b%c.height?null:a/c.height+b/
-c.width*g.precinctParameters.numprecinctswide}function q(a){for(var b=a.components.length,c=Number.MAX_VALUE,d=Number.MAX_VALUE,g=0,e=0,f=Array(b),h=0;h<b;h++){for(var l=a.components[h],k=l.codingStyleParameters.decompositionLevelsCount,q=Array(k+1),m=Number.MAX_VALUE,n=Number.MAX_VALUE,t=0,p=0,r=1;0<=k;--k){var u=l.resolutions[k],L=r*u.precinctParameters.precinctWidth,w=r*u.precinctParameters.precinctHeight;m=Math.min(m,L);n=Math.min(n,w);t=Math.max(t,u.precinctParameters.numprecinctswide);p=Math.max(p,
-u.precinctParameters.numprecinctshigh);q[k]={width:L,height:w};r<<=1}c=Math.min(c,m);d=Math.min(d,n);g=Math.max(g,t);e=Math.max(e,p);f[h]={resolutions:q,minWidth:m,minHeight:n,maxNumWide:t,maxNumHigh:p}}return{components:f,minWidth:c,minHeight:d,maxNumWide:g,maxNumHigh:e}}function w(b,c,d,g){function e(a){for(;q<a;){var b=c[d+l];l++;m?(k=k<<7|b,q+=7,m=!1):(k=k<<8|b,q+=8);255===b&&(m=!0)}q-=a;return k>>>q&(1<<a)-1}function f(a){return 255===c[d+l-1]&&c[d+l]===a?(l+=1,!0):255===c[d+l]&&c[d+l+1]===a?
-(l+=2,!0):!1}function h(){if(0===e(1))return 1;if(0===e(1))return 2;var a=e(2);if(3>a)return a+3;a=e(5);if(31>a)return a+6;a=e(7);return a+37}var l=0,k,q=0,m=!1,n=b.COD.sopMarkerUsed,t=b.COD.ephMarkerUsed;for(b=b.tiles[b.currentTile.index].packetsIterator;l<g;){q=0;m&&(l++,m=!1);n&&f(145)&&(l+=4);var y=b.nextPacket();if(e(1)){for(var p=y.layerNumber,r=[],u,L=0,w=y.codeblocks.length;L<w;L++){u=y.codeblocks[L];var M=u.precinct,v=u.cbx-M.cbxMin,z=u.cby-M.cbyMin,G=!1,A=!1;if(void 0!==u.included)G=!!e(1);
-else{M=u.precinct;if(void 0!==M.inclusionTree)var x=M.inclusionTree;else{var F=M.cbxMax-M.cbxMin+1;var R=M.cbyMax-M.cbyMin+1;x=new D(F,R,p);F=new C(F,R);M.inclusionTree=x;M.zeroBitPlanesTree=F}if(x.reset(v,z,p))for(;;)if(e(1)){if(R=!x.nextLevel()){G=A=u.included=!0;break}}else{x.incrementValue(p);break}}if(G){if(A){F=M.zeroBitPlanesTree;for(F.reset(v,z);;)if(e(1)){if(R=!F.nextLevel())break}else F.incrementValue();u.zeroBitPlanes=F.value}for(M=h();e(1);)u.Lblock++;v=a(M);v=e((M<1<<v?v-1:v)+u.Lblock);
-r.push({codeblock:u,codingpasses:M,dataLength:v})}}q=0;m&&(l++,m=!1);for(t&&f(146);0<r.length;)y=r.shift(),u=y.codeblock,void 0===u.data&&(u.data=[]),u.data.push({data:c,start:d+l,end:d+l+y.dataLength,codingpasses:y.codingpasses}),l+=y.dataLength}}return l}var L={LL:0,LH:1,HL:1,HH:2};c.prototype={parse:function(a){if(65359===b(a,0))this.parseCodestream(a,0,a.length);else for(var c=0,e=a.length;c<e;){var g=8,f=d(a,c),l=d(a,c+4);c+=g;1===f&&(f=4294967296*d(a,c)+d(a,c+4),c+=8,g+=8);0===f&&(f=e-c+g);
-if(f<g)throw Error("JPX Error: Invalid box field size");g=f-g;f=!0;switch(l){case 1785737832:f=!1;break;case 1668246642:l=a[c];if(1===l)switch(l=d(a,c+3),l){case 16:case 17:case 18:break;default:h("Unknown colorspace "+l)}else 2===l&&B("ICC profile not supported");break;case 1785737827:this.parseCodestream(a,c,c+g);break;case 1783636E3:218793738!==d(a,c)&&h("Invalid JP2 signature");break;case 1783634458:case 1718909296:case 1920099697:case 1919251232:case 1768449138:break;default:var k=String.fromCharCode(l>>
-24&255,l>>16&255,l>>8&255,l&255);h("Unsupported header type "+l+" ("+k+")")}f&&(c+=g)}},parseImageProperties:function(a){for(var b=a.getByte();0<=b;){var c=b;b=a.getByte();if(65361===(c<<8|b)){a.skip(4);b=a.getInt32()>>>0;c=a.getInt32()>>>0;var d=a.getInt32()>>>0,g=a.getInt32()>>>0;a.skip(16);a=a.getUint16();this.width=b-d;this.height=c-g;this.componentsCount=a;this.bitsPerComponent=8;return}}throw Error("JPX Error: No size marker found in JPX stream");},parseCodestream:function(a,c,f){var q={};try{var t=
-!1;for(var y=c;y+1<f;){var r=b(a,y);y+=2;var u=0,v;switch(r){case 65359:q.mainHeader=!0;break;case 65497:break;case 65361:u=b(a,y);var M={};M.Xsiz=d(a,y+4);M.Ysiz=d(a,y+8);M.XOsiz=d(a,y+12);M.YOsiz=d(a,y+16);M.XTsiz=d(a,y+20);M.YTsiz=d(a,y+24);M.XTOsiz=d(a,y+28);M.YTOsiz=d(a,y+32);var z=b(a,y+36);M.Csiz=z;var G=[];var A=y+38;for(var x=0;x<z;x++){var D={precision:(a[A]&127)+1,isSigned:!!(a[A]&128),XRsiz:a[A+1],YRsiz:a[A+1]},C=D,K=M;C.x0=Math.ceil(K.XOsiz/C.XRsiz);C.x1=Math.ceil(K.Xsiz/C.XRsiz);C.y0=
-Math.ceil(K.YOsiz/C.YRsiz);C.y1=Math.ceil(K.Ysiz/C.YRsiz);C.width=C.x1-C.x0;C.height=C.y1-C.y0;G.push(D)}q.SIZ=M;q.components=G;for(var B=void 0,J=q,H=G,F=J.SIZ,I=[],Q=Math.ceil((F.Xsiz-F.XTOsiz)/F.XTsiz),pc=Math.ceil((F.Ysiz-F.YTOsiz)/F.YTsiz),Ya=0;Ya<pc;Ya++)for(var Za=0;Za<Q;Za++)B={},B.tx0=Math.max(F.XTOsiz+Za*F.XTsiz,F.XOsiz),B.ty0=Math.max(F.YTOsiz+Ya*F.YTsiz,F.YOsiz),B.tx1=Math.min(F.XTOsiz+(Za+1)*F.XTsiz,F.Xsiz),B.ty1=Math.min(F.YTOsiz+(Ya+1)*F.YTsiz,F.Ysiz),B.width=B.tx1-B.tx0,B.height=B.ty1-
-B.ty0,B.components=[],I.push(B);J.tiles=I;for(var $a=0,qc=F.Csiz;$a<qc;$a++)for(var ab=H[$a],lb=0,rc=I.length;lb<rc;lb++){var ia={};B=I[lb];ia.tcx0=Math.ceil(B.tx0/ab.XRsiz);ia.tcy0=Math.ceil(B.ty0/ab.YRsiz);ia.tcx1=Math.ceil(B.tx1/ab.XRsiz);ia.tcy1=Math.ceil(B.ty1/ab.YRsiz);ia.width=ia.tcx1-ia.tcx0;ia.height=ia.tcy1-ia.tcy0;B.components[$a]=ia}q.QCC=[];q.COC=[];break;case 65372:u=b(a,y);var Ka={};A=y+2;var va=a[A++];switch(va&31){case 0:var na=8;var wa=!0;break;case 1:na=16;wa=!1;break;case 2:na=
-16;wa=!0;break;default:throw Error("JPX Error: Invalid SQcd value "+va);}Ka.noQuantization=8===na;Ka.scalarExpounded=wa;Ka.guardBits=va>>5;for(v=[];A<u+y;){var ja={};8===na?(ja.epsilon=a[A++]>>3,ja.mu=0):(ja.epsilon=a[A]>>3,ja.mu=(a[A]&7)<<8|a[A+1],A+=2);v.push(ja)}Ka.SPqcds=v;q.mainHeader?q.QCD=Ka:(q.currentTile.QCD=Ka,q.currentTile.QCC=[]);break;case 65373:u=b(a,y);var La={};A=y+2;if(257>q.SIZ.Csiz)var mb=a[A++];else mb=b(a,A),A+=2;va=a[A++];switch(va&31){case 0:na=8;wa=!0;break;case 1:na=16;wa=
-!1;break;case 2:na=16;wa=!0;break;default:throw Error("JPX Error: Invalid SQcd value "+va);}La.noQuantization=8===na;La.scalarExpounded=wa;La.guardBits=va>>5;for(v=[];A<u+y;)ja={},8===na?(ja.epsilon=a[A++]>>3,ja.mu=0):(ja.epsilon=a[A]>>3,ja.mu=(a[A]&7)<<8|a[A+1],A+=2),v.push(ja);La.SPqcds=v;q.mainHeader?q.QCC[mb]=La:q.currentTile.QCC[mb]=La;break;case 65362:u=b(a,y);var T={};A=y+2;var nb=a[A++];T.entropyCoderWithCustomPrecincts=!!(nb&1);T.sopMarkerUsed=!!(nb&2);T.ephMarkerUsed=!!(nb&4);T.progressionOrder=
-a[A++];T.layersCount=b(a,A);A+=2;T.multipleComponentTransform=a[A++];T.decompositionLevelsCount=a[A++];T.xcb=(a[A++]&15)+2;T.ycb=(a[A++]&15)+2;var Ma=a[A++];T.selectiveArithmeticCodingBypass=!!(Ma&1);T.resetContextProbabilities=!!(Ma&2);T.terminationOnEachCodingPass=!!(Ma&4);T.verticalyStripe=!!(Ma&8);T.predictableTermination=!!(Ma&16);T.segmentationSymbolUsed=!!(Ma&32);T.reversibleTransformation=a[A++];if(T.entropyCoderWithCustomPrecincts){for(var Mb=[];A<u+y;){var Nb=a[A++];Mb.push({PPx:Nb&15,PPy:Nb>>
-4})}T.precinctsSizes=Mb}var xa=[];T.selectiveArithmeticCodingBypass&&xa.push("selectiveArithmeticCodingBypass");T.resetContextProbabilities&&xa.push("resetContextProbabilities");T.terminationOnEachCodingPass&&xa.push("terminationOnEachCodingPass");T.verticalyStripe&&xa.push("verticalyStripe");T.predictableTermination&&xa.push("predictableTermination");if(0<xa.length)throw t=!0,Error("JPX Error: Unsupported COD options ("+xa.join(", ")+")");q.mainHeader?q.COD=T:(q.currentTile.COD=T,q.currentTile.COC=
-[]);break;case 65424:u=b(a,y);var Y={};Y.index=b(a,y+2);Y.length=d(a,y+4);Y.dataEnd=Y.length+y-2;Y.partIndex=a[y+8];Y.partsCount=a[y+9];q.mainHeader=!1;0===Y.partIndex&&(Y.COD=q.COD,Y.COC=q.COC.slice(0),Y.QCD=q.QCD,Y.QCC=q.QCC.slice(0));q.currentTile=Y;break;case 65427:Y=q.currentTile;if(0===Y.partIndex){for(var oa=q,sc=oa.SIZ.Csiz,Ob=oa.tiles[Y.index],ya=0;ya<sc;ya++){var Pb=Ob.components[ya];Pb.quantizationParameters=void 0!==oa.currentTile.QCC[ya]?oa.currentTile.QCC[ya]:oa.currentTile.QCD;Pb.codingStyleParameters=
-void 0!==oa.currentTile.COC[ya]?oa.currentTile.COC[ya]:oa.currentTile.COD}Ob.codingStyleDefaultParameters=oa.currentTile.COD;for(var ea=q,za=ea.tiles[ea.currentTile.index],tc=ea.SIZ.Csiz,ob=0;ob<tc;ob++){for(var U=za.components[ob],pb=U.codingStyleParameters.decompositionLevelsCount,Qb=[],Pa=[],Aa=0;Aa<=pb;Aa++){var bb=Aa,Ba=U.codingStyleParameters,ka={};Ba.entropyCoderWithCustomPrecincts?(ka.PPx=Ba.precinctsSizes[bb].PPx,ka.PPy=Ba.precinctsSizes[bb].PPy):(ka.PPx=15,ka.PPy=15);ka.xcb_=0<bb?Math.min(Ba.xcb,
-ka.PPx-1):Math.min(Ba.xcb,ka.PPx);ka.ycb_=0<bb?Math.min(Ba.ycb,ka.PPy-1):Math.min(Ba.ycb,ka.PPy);var ra=ka;var V={},sa=1<<pb-Aa;V.trx0=Math.ceil(U.tcx0/sa);V.try0=Math.ceil(U.tcy0/sa);V.trx1=Math.ceil(U.tcx1/sa);V.try1=Math.ceil(U.tcy1/sa);V.resLevel=Aa;var qb=1<<ra.PPx,rb=1<<ra.PPy,Rb=0===V.resLevel,Sb=V.trx1>V.trx0?Math.ceil(V.trx1/qb)-Math.floor(V.trx0/qb):0,Tb=V.try1>V.try0?Math.ceil(V.try1/rb)-Math.floor(V.try0/rb):0;V.precinctParameters={precinctWidth:qb,precinctHeight:rb,numprecinctswide:Sb,
-numprecinctshigh:Tb,numprecincts:Sb*Tb,precinctWidthInSubband:1<<ra.PPx+(Rb?0:-1),precinctHeightInSubband:1<<ra.PPy+(Rb?0:-1)};Qb.push(V);if(0===Aa){var S={type:"LL"};S.tbx0=Math.ceil(U.tcx0/sa);S.tby0=Math.ceil(U.tcy0/sa);S.tbx1=Math.ceil(U.tcx1/sa);S.tby1=Math.ceil(U.tcy1/sa);S.resolution=V;e(ea,S,ra);Pa.push(S);V.subbands=[S]}else{var fa=1<<pb-Aa+1,cb=[];S={type:"HL"};S.tbx0=Math.ceil(U.tcx0/fa-.5);S.tby0=Math.ceil(U.tcy0/fa);S.tbx1=Math.ceil(U.tcx1/fa-.5);S.tby1=Math.ceil(U.tcy1/fa);S.resolution=
-V;e(ea,S,ra);Pa.push(S);cb.push(S);S={type:"LH"};S.tbx0=Math.ceil(U.tcx0/fa);S.tby0=Math.ceil(U.tcy0/fa-.5);S.tbx1=Math.ceil(U.tcx1/fa);S.tby1=Math.ceil(U.tcy1/fa-.5);S.resolution=V;e(ea,S,ra);Pa.push(S);cb.push(S);S={type:"HH"};S.tbx0=Math.ceil(U.tcx0/fa-.5);S.tby0=Math.ceil(U.tcy0/fa-.5);S.tbx1=Math.ceil(U.tcx1/fa-.5);S.tby1=Math.ceil(U.tcy1/fa-.5);S.resolution=V;e(ea,S,ra);Pa.push(S);cb.push(S);V.subbands=cb}}U.resolutions=Qb;U.subbands=Pa}var Ub=za.codingStyleDefaultParameters.progressionOrder;
-switch(Ub){case 0:za.packetsIterator=new l(ea);break;case 1:za.packetsIterator=new k(ea);break;case 2:za.packetsIterator=new m(ea);break;case 3:za.packetsIterator=new n(ea);break;case 4:za.packetsIterator=new p(ea);break;default:throw Error("JPX Error: Unsupported progression order "+Ub);}}u=Y.dataEnd-y;w(q,a,y,u);break;case 65365:case 65367:case 65368:case 65380:u=b(a,y);break;case 65363:throw Error("JPX Error: Codestream code 0xFF53 (COC) is not implemented");default:throw Error("JPX Error: Unknown codestream code: "+
-r.toString(16));}y+=u}}catch(Vb){if(t||this.failOnCorruptedImage)throw Vb;h("Trying to recover from "+Vb.message)}for(var Wb=q.components,Na=q.SIZ.Csiz,Xb=[],sb=0,uc=q.tiles.length;sb<uc;sb++){var tb=q.tiles[sb],Ca=[],ha;for(ha=0;ha<Na;ha++){for(var vc=Ca,wc=ha,Da=tb.components[ha],ub=Da.codingStyleParameters,vb=Da.quantizationParameters,xc=ub.decompositionLevelsCount,db=vb.SPqcds,yc=vb.scalarExpounded,zc=vb.guardBits,Ac=ub.segmentationSymbolUsed,Bc=q.components[ha].precision,wb=ub.reversibleTransformation,
-Cc=wb?new O:new N,Yb=[],xb=0,Qa=0;Qa<=xc;Qa++){for(var Oa=Da.resolutions[Qa],yb=Oa.trx1-Oa.trx0,Zb=Oa.try1-Oa.try0,$b=new Float32Array(yb*Zb),zb=0,Dc=Oa.subbands.length;zb<Dc;zb++){if(yc){var ac=db[xb].mu;var Ab=db[xb].epsilon;xb++}else ac=db[0].mu,Ab=db[0].epsilon+(0<Qa?1-Qa:0);for(var bc=Oa.subbands[zb],Ec=L[bc.type],Fc=$b,cc=yb,ta=bc,Gc=wb?1:Math.pow(2,Bc+Ec-Ab)*(1+ac/2048),Bb=zc+Ab-1,dc=wb,Hc=Ac,Ic=ta.tbx0,Jc=ta.tby0,eb=ta.tbx1-ta.tbx0,ec=ta.codeblocks,Kc="H"===ta.type.charAt(0)?1:0,Lc="H"===
-ta.type.charAt(1)?cc:0,Cb=0,Mc=ec.length;Cb<Mc;++Cb){var la=ec[Cb],fb=la.tbx1_-la.tbx0_,Db=la.tby1_-la.tby0_;if(0!==fb&&0!==Db&&void 0!==la.data){var ua=new E(fb,Db,la.subbandType,la.zeroBitPlanes,Bb);var Eb=2;var gb=la.data,Fb=0,fc=0,hb;var ca=0;for(hb=gb.length;ca<hb;ca++){var Ea=gb[ca];Fb+=Ea.end-Ea.start;fc+=Ea.codingpasses}var gc=new Uint8Array(Fb),Fa=0;ca=0;for(hb=gb.length;ca<hb;ca++){Ea=gb[ca];var hc=Ea.data.subarray(Ea.start,Ea.end);gc.set(hc,Fa);Fa+=hc.length}var Nc=new g(gc,0,Fb);ua.setDecoder(Nc);
-for(ca=0;ca<fc;ca++){switch(Eb){case 0:ua.runSignificancePropogationPass();break;case 1:ua.runMagnitudeRefinementPass();break;case 2:ua.runCleanupPass(),Hc&&ua.checkSegmentationSymbol()}Eb=(Eb+1)%3}var Ra=la.tbx0_-Ic+(la.tby0_-Jc)*eb,Oc=ua.coefficentsSign,Pc=ua.coefficentsMagnitude,Qc=ua.bitsDecoded,Rc=dc?0:.5,Gb;Fa=0;var Sc="LL"!==ta.type;for(ca=0;ca<Db;ca++){var Tc=2*(Ra/eb|0)*(cc-eb)+Kc+Lc;for(Gb=0;Gb<fb;Gb++){var Ga=Pc[Fa];if(0!==Ga){Ga=(Ga+Rc)*Gc;0!==Oc[Fa]&&(Ga=-Ga);var ic=Qc[Fa];Fc[Sc?Tc+(Ra<<
-1):Ra]=dc&&ic>=Bb?Ga:Ga*(1<<Bb-ic)}Ra++;Fa++}Ra+=eb-fb}}}}Yb.push({width:yb,height:Zb,items:$b})}var Hb=Cc.calculate(Yb,Da.tcx0,Da.tcy0);vc[wc]={left:Da.tcx0,top:Da.tcy0,width:Hb.width,height:Hb.height,items:Hb.items}}var Sa=Ca[0],pa=new Uint8Array(Sa.items.length*Na),Uc={left:Sa.left,top:Sa.top,width:Sa.width,height:Sa.height,items:pa},aa=0,W;if(tb.codingStyleDefaultParameters.multipleComponentTransform){var jc=4===Na,Ib=Ca[0].items,kc=Ca[1].items,lc=Ca[2].items,Vc=jc?Ca[3].items:null;var da=Wb[0].precision-
-8;var Ta=(128<<da)+.5;var ma=255*(1<<da);var mc=.5*ma;var Jb=-mc;var Wc=tb.components[0],nc=Na-3;var Ua=Ib.length;if(Wc.codingStyleParameters.reversibleTransformation)for(W=0;W<Ua;W++,aa+=nc){var Va=Ib[W]+Ta;var Wa=kc[W];var Xa=lc[W];var qa=Va-(Xa+Wa>>2);var Ha=qa+Xa;var Ia=qa+Wa;pa[aa++]=0>=Ha?0:Ha>=ma?255:Ha>>da;pa[aa++]=0>=qa?0:qa>=ma?255:qa>>da;pa[aa++]=0>=Ia?0:Ia>=ma?255:Ia>>da}else for(W=0;W<Ua;W++,aa+=nc)Va=Ib[W]+Ta,Wa=kc[W],Xa=lc[W],Ha=Va+1.402*Xa,qa=Va-.34413*Wa-.71414*Xa,Ia=Va+1.772*Wa,
-pa[aa++]=0>=Ha?0:Ha>=ma?255:Ha>>da,pa[aa++]=0>=qa?0:qa>=ma?255:qa>>da,pa[aa++]=0>=Ia?0:Ia>=ma?255:Ia>>da;if(jc)for(W=0,aa=3;W<Ua;W++,aa+=4){var Kb=Vc[W];pa[aa]=Kb<=Jb?0:Kb>=mc?255:Kb+Ta>>da}}else for(ha=0;ha<Na;ha++){var oc=Ca[ha].items;da=Wb[ha].precision-8;Ta=(128<<da)+.5;ma=127.5*(1<<da);Jb=-ma;aa=ha;W=0;for(Ua=oc.length;W<Ua;W++){var Lb=oc[W];pa[aa]=Lb<=Jb?0:Lb>=ma?255:Lb+Ta>>da;aa+=Na}}Xb.push(Uc)}this.tiles=Xb;this.width=q.SIZ.Xsiz-q.SIZ.XOsiz;this.height=q.SIZ.Ysiz-q.SIZ.YOsiz;this.componentsCount=
-q.SIZ.Csiz}};var C=function(){function b(b,c){var d=a(Math.max(b,c))+1;this.levels=[];for(var g=0;g<d;g++)this.levels.push({width:b,height:c,items:[]}),b=Math.ceil(b/2),c=Math.ceil(c/2)}b.prototype={reset:function(a,b){for(var c=0,d=0,g;c<this.levels.length;){g=this.levels[c];var e=a+b*g.width;if(void 0!==g.items[e]){d=g.items[e];break}g.index=e;a>>=1;b>>=1;c++}c--;g=this.levels[c];g.items[g.index]=d;this.currentLevel=c;delete this.value},incrementValue:function(){var a=this.levels[this.currentLevel];
-a.items[a.index]++},nextLevel:function(){var a=this.currentLevel,b=this.levels[a],c=b.items[b.index];a--;if(0>a)return this.value=c,!1;this.currentLevel=a;b=this.levels[a];b.items[b.index]=c;return!0}};return b}(),D=function(){function b(b,c,d){var g=a(Math.max(b,c))+1;this.levels=[];for(var e=0;e<g;e++){for(var f=new Uint8Array(b*c),h=0,l=f.length;h<l;h++)f[h]=d;this.levels.push({width:b,height:c,items:f});b=Math.ceil(b/2);c=Math.ceil(c/2)}}b.prototype={reset:function(a,b,c){for(var d=0;d<this.levels.length;){var g=
-this.levels[d],e=a+b*g.width;g.index=e;g=g.items[e];if(255===g)break;if(g>c)return this.currentLevel=d,this.propagateValues(),!1;a>>=1;b>>=1;d++}this.currentLevel=d-1;return!0},incrementValue:function(a){var b=this.levels[this.currentLevel];b.items[b.index]=a+1;this.propagateValues()},propagateValues:function(){for(var a=this.currentLevel,b=this.levels[a],c=b.items[b.index];0<=--a;)b=this.levels[a],b.items[b.index]=c},nextLevel:function(){var a=this.currentLevel,b=this.levels[a],c=b.items[b.index];
-b.items[b.index]=255;a--;if(0>a)return!1;this.currentLevel=a;b=this.levels[a];b.items[b.index]=c;return!0}};return b}(),E=function(){function a(a,g,e,f,h){this.width=a;this.height=g;this.contextLabelTable="HH"===e?d:"HL"===e?c:b;a*=g;this.neighborsSignificance=new Uint8Array(a);this.coefficentsSign=new Uint8Array(a);this.coefficentsMagnitude=14<h?new Uint32Array(a):6<h?new Uint16Array(a):new Uint8Array(a);this.processingFlags=new Uint8Array(a);h=new Uint8Array(a);if(0!==f)for(g=0;g<a;g++)h[g]=f;this.bitsDecoded=
-h;this.reset()}var b=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]),c=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,b,c){var d=this.neighborsSignificance,g=this.width,e=this.height,f=0<b;b=b+1<g;if(0<a){var h=c-g;f&&(d[h-1]+=16);b&&(d[h+1]+=16);d[h]+=4}a+1<e&&(h=c+g,f&&(d[h-1]+=16),b&&(d[h+1]+=16),d[h]+=4);f&&(d[c-1]+=1);b&&(d[c+1]+=1);d[c]|=128},runSignificancePropogationPass:function(){for(var a=
-this.decoder,b=this.width,c=this.height,d=this.coefficentsMagnitude,g=this.coefficentsSign,e=this.neighborsSignificance,f=this.processingFlags,h=this.contexts,l=this.contextLabelTable,k=this.bitsDecoded,q=0;q<c;q+=4)for(var m=0;m<b;m++)for(var n=q*b+m,t=0;4>t;t++,n+=b){var y=q+t;if(y>=c)break;f[n]&=-2;if(!d[n]&&e[n]){if(a.readBit(h,l[e[n]])){var p=this.decodeSignBit(y,m,n);g[n]=p;d[n]=1;this.setNeighborsSignificance(y,m,n);f[n]|=2}k[n]++;f[n]|=1}}},decodeSignBit:function(a,b,c){var d=this.width,g=
-this.height,e=this.coefficentsMagnitude,f=this.coefficentsSign;var h=0<b&&0!==e[c-1];b+1<d&&0!==e[c+1]?(b=f[c+1],h?(h=f[c-1],b=1-b-h):b=1-b-b):h?(h=f[c-1],b=1-h-h):b=0;var l=3*b;h=0<a&&0!==e[c-d];a+1<g&&0!==e[c+d]?(b=f[c+d],h?(h=f[c-d],b=1-b-h+l):b=1-b-b+l):h?(h=f[c-d],b=1-h-h+l):b=l;return 0<=b?this.decoder.readBit(this.contexts,9+b):this.decoder.readBit(this.contexts,9-b)^1},runMagnitudeRefinementPass:function(){for(var a=this.decoder,b=this.width,c=this.coefficentsMagnitude,d=this.neighborsSignificance,
-g=this.contexts,e=this.bitsDecoded,f=this.processingFlags,h=b*this.height,l=4*b,k=0,q;k<h;k=q){q=Math.min(h,k+l);for(var m=0;m<b;m++)for(var n=k+m;n<q;n+=b)if(c[n]&&0===(f[n]&1)){var t=16;0!==(f[n]&2)&&(f[n]^=2,t=0===(d[n]&127)?15:14);t=a.readBit(g,t);c[n]=c[n]<<1|t;e[n]++;f[n]|=1}}},runCleanupPass:function(){for(var a=this.decoder,b=this.width,c=this.height,d=this.neighborsSignificance,g=this.coefficentsMagnitude,e=this.coefficentsSign,f=this.contexts,h=this.contextLabelTable,l=this.bitsDecoded,
-k=this.processingFlags,q=2*b,m=3*b,n,t=0;t<c;t=n){n=Math.min(t+4,c);for(var y=t*b,p=t+3<c,r=0;r<b;r++){var u=y+r,L=0,v=u,w=t;if(p&&0===k[u]&&0===k[u+b]&&0===k[u+q]&&0===k[u+m]&&0===d[u]&&0===d[u+b]&&0===d[u+q]&&0===d[u+m]){if(!a.readBit(f,18)){l[u]++;l[u+b]++;l[u+q]++;l[u+m]++;continue}L=a.readBit(f,17)<<1|a.readBit(f,17);0!==L&&(w=t+L,v+=L*b);var z=this.decodeSignBit(w,r,v);e[v]=z;g[v]=1;this.setNeighborsSignificance(w,r,v);k[v]|=2;v=u;for(u=t;u<=w;u++,v+=b)l[v]++;L++}for(w=t+L;w<n;w++,v+=b)g[v]||
-0!==(k[v]&1)||(1===a.readBit(f,h[d[v]])&&(z=this.decodeSignBit(w,r,v),e[v]=z,g[v]=1,this.setNeighborsSignificance(w,r,v),k[v]|=2),l[v]++)}}},checkSegmentationSymbol:function(){var a=this.decoder,b=this.contexts;if(10!==(a.readBit(b,17)<<3|a.readBit(b,17)<<2|a.readBit(b,17)<<1|a.readBit(b,17)))throw Error("JPX Error: Invalid segmentation symbol");}};return a}(),Q=function(){function a(){}a.prototype.calculate=function(a,b,c){for(var d=a[0],g=1,e=a.length;g<e;g++)d=this.iterate(d,a[g],b,c);return d};
-a.prototype.extend=function(a,b,c){var d=b-1,g=b+1,e=b+c-2;b+=c;a[d--]=a[g++];a[b++]=a[e--];a[d--]=a[g++];a[b++]=a[e--];a[d--]=a[g++];a[b++]=a[e--];a[d]=a[g];a[b]=a[e]};a.prototype.iterate=function(a,b,c,d){var g=a.width,e=a.height,f=a.items,h=b.width,l=b.height;b=b.items;var k,q,m;for(k=m=0;k<e;k++){var n=2*k*h;for(q=0;q<g;q++,m++,n+=2)b[n]=f[m]}a.items=null;a=new Float32Array(h+8);if(1===h){if(0!==(c&1))for(m=n=0;n<l;n++,m+=h)b[m]*=.5}else for(m=n=0;n<l;n++,m+=h)a.set(b.subarray(m,m+h),4),this.extend(a,
-4,h),this.filter(a,4,h),b.set(a.subarray(4,4+h),m);c=16;g=[];for(k=0;k<c;k++)g.push(new Float32Array(l+8));k=0;a=4+l;if(1===l){if(0!==(d&1))for(d=0;d<h;d++)b[d]*=.5}else for(d=0;d<h;d++){if(0===k){c=Math.min(h-d,c);m=d;for(n=4;n<a;m+=h,n++)for(e=0;e<c;e++)g[e][n]=b[m+e];k=c}k--;m=g[k];this.extend(m,4,l);this.filter(m,4,l);if(0===k)for(m=d-c+1,n=4;n<a;m+=h,n++)for(e=0;e<c;e++)b[m+e]=g[e][n]}return{width:h,height:l,items:b}};return a}(),N=function(){function a(){Q.call(this)}a.prototype=Object.create(Q.prototype);
-a.prototype.filter=function(a,b,c){c>>=1;b|=0;var d;var g=b-3;for(d=c+4;d--;g+=2)a[g]*=.8128930661159609;g=b-2;var e=.443506852043971*a[g-1];for(d=c+3;d--;g+=2){var f=.443506852043971*a[g+1];a[g]=1.230174104914001*a[g]-e-f;if(d--)g+=2,e=.443506852043971*a[g+1],a[g]=1.230174104914001*a[g]-e-f;else break}g=b-1;e=.882911075530934*a[g-1];for(d=c+2;d--;g+=2)if(f=.882911075530934*a[g+1],a[g]-=e+f,d--)g+=2,e=.882911075530934*a[g+1],a[g]-=e+f;else break;g=b;e=-.052980118572961*a[g-1];for(d=c+1;d--;g+=2)if(f=
--.052980118572961*a[g+1],a[g]-=e+f,d--)g+=2,e=-.052980118572961*a[g+1],a[g]-=e+f;else break;if(0!==c)for(g=b+1,e=-1.586134342059924*a[g-1],d=c;d--;g+=2)if(f=-1.586134342059924*a[g+1],a[g]-=e+f,d--)g+=2,e=-1.586134342059924*a[g+1],a[g]-=e+f;else break};return a}(),O=function(){function a(){Q.call(this)}a.prototype=Object.create(Q.prototype);a.prototype.filter=function(a,b,c){c>>=1;b|=0;var d;var g=b;for(d=c+1;d--;g+=2)a[g]-=a[g-1]+a[g+1]+2>>2;g=b+1;for(d=c;d--;g+=2)a[g]+=a[g-1]+a[g+1]>>1};return a}();
-return c}();"use strict";var m=function(){function c(){}function e(a,b,c){this.data=a;this.start=b;this.end=c}function h(a,b,c){function d(a){for(var b=0,d=0;d<a;d++){var f=c.readBit(g,e);e=256>e?e<<1|f:(e<<1|f)&511|256;b=b<<1|f}return b>>>0}var g=a.getContexts(b),e=1;a=d(1);b=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?b:0<b?-b:null}function l(a,b,c){a=a.getContexts("IAID");for(var d=1,g=0;g<c;g++){var e=b.readBit(a,d);d=d<<1|e}return 31>c?d&(1<<c)-1:d&
-2147483647}function k(a,b,c){var d=c.decoder;c=c.contextCache.getContexts("GB");var g,e,f,h=[];for(g=0;g<b;g++){var l=h[g]=new Uint8Array(a);var k=1>g?l:h[g-1];var q=2>g?l:h[g-2];var m=q[0]<<13|q[1]<<12|q[2]<<11|k[0]<<7|k[1]<<6|k[2]<<5|k[3]<<4;for(e=0;e<a;e++)l[e]=f=d.readBit(c,m),m=(m&31735)<<1|(e+3<a?q[e+3]<<11:0)|(e+4<a?k[e+4]<<4:0)|f}return h}function m(a,b,c,d,g,e,f,h){a&&p("JBIG2 error: MMR encoding is not supported");if(0===d&&!e&&!g&&4===f.length&&3===f[0].x&&-1===f[0].y&&-3===f[1].x&&-1===
-f[1].y&&2===f[2].x&&-2===f[2].y&&-2===f[3].x&&-2===f[3].y)return k(b,c,h);a=!!e;var l=C[d].concat(f);l.sort(function(a,b){return a.y-b.y||a.x-b.x});f=l.length;var q=new Int8Array(f),m=new Int8Array(f),n=[],t=0,r=0,y=0,u=0,L,v;for(v=0;v<f;v++)q[v]=l[v].x,m[v]=l[v].y,r=Math.min(r,l[v].x),y=Math.max(y,l[v].x),u=Math.min(u,l[v].y),v<f-1&&l[v].y===l[v+1].y&&l[v].x===l[v+1].x-1?t|=1<<f-1-v:n.push(v);var w=n.length,z=new Int8Array(w),A=new Int8Array(w),G=new Uint16Array(w);for(L=0;L<w;L++)v=n[L],z[L]=l[v].x,
-A[L]=l[v].y,G[L]=1<<f-1-v;l=-r;u=-u;y=b-y;d=B[d];n=new Uint8Array(b);r=[];L=h.decoder;h=h.contextCache.getContexts("GB");for(var D=0,x,M,K,N=0,J,H=0;H<c;H++){if(g&&(v=L.readBit(h,d),D^=v)){r.push(n);continue}n=new Uint8Array(n);r.push(n);for(x=0;x<b;x++)if(a&&e[H][x])n[x]=0;else{if(x>=l&&x<y&&H>=u)for(N=N<<1&t,v=0;v<w;v++){if(M=H+A[v],K=x+z[v],M=r[M][K])M=G[v],N|=M}else for(N=0,J=f-1,v=0;v<f;v++,J--)K=x+q[v],0<=K&&K<b&&(M=H+m[v],0<=M&&(M=r[M][K])&&(N|=M<<J));v=L.readBit(h,N);n[x]=v}}return r}function n(a,
-b,c,d,g,e,f,h,l){var k=D[c].coding;0===c&&(k=k.concat([h[0]]));var q=k.length,m=new Int32Array(q),n=new Int32Array(q),t;for(t=0;t<q;t++)m[t]=k[t].x,n[t]=k[t].y;var r=D[c].reference;0===c&&(r=r.concat([h[1]]));h=r.length;k=new Int32Array(h);var y=new Int32Array(h);for(t=0;t<h;t++)k[t]=r[t].x,y[t]=r[t].y;r=d[0].length;var u=d.length;c=Q[c];var L=[],v=l.decoder;l=l.contextCache.getContexts("GR");for(var w=0,z=0;z<b;z++){f&&(t=v.readBit(l,c),(w^=t)&&p("JBIG2 error: prediction is not supported"));var A=
-new Uint8Array(a);L.push(A);for(var G=0;G<a;G++){var x=0;for(t=0;t<q;t++){var M=z+n[t];var C=G+m[t];x=0>M||0>C||C>=a?x<<1:x<<1|L[M][C]}for(t=0;t<h;t++)M=z+y[t]+e,C=G+k[t]+g,x=0>M||M>=u||0>C||C>=r?x<<1:x<<1|d[M][C];t=v.readBit(l,x);A[G]=t}}return L}function r(a,b,c,d,g,e,f,k,q,m,t,r,u,L,v,w,z){a&&p("JBIG2 error: huffman is not supported");a=[];for(L=0;L<d;L++){var y=new Uint8Array(c);if(g)for(var A=0;A<c;A++)y[A]=g;a.push(y)}d=z.decoder;g=z.contextCache;A=-h(g,"IADT",d);var G=0;for(L=0;L<e;){var x=
-h(g,"IADT",d);A+=x;x=h(g,"IAFS",d);x=G+=x;do{var C=1===f?0:h(g,"IAIT",d);y=f*A+C;C=l(g,d,q);var D=b&&h(g,"IARI",d);C=k[C];var M=C[0].length,K=C.length;if(D){D=h(g,"IARDW",d);var B=h(g,"IARDH",d),N=h(g,"IARDX",d),H=h(g,"IARDY",d);M+=D;K+=B;C=n(M,K,v,C,(D>>1)+N,(B>>1)+H,!1,w,z)}D=y-(r&1?0:K);B=x-(r&2?M:0);if(m){for(N=0;N<K;N++)if(y=a[B+N]){var J=C[N];var E=Math.min(c-D,M);switch(u){case 0:for(H=0;H<E;H++)y[D+H]|=J[H];break;case 2:for(H=0;H<E;H++)y[D+H]^=J[H];break;default:p("JBIG2 error: operator "+
-u+" is not supported")}}x+=K-1}else{for(H=0;H<K;H++)if(y=a[D+H])switch(J=C[H],u){case 0:for(N=0;N<M;N++)y[B+N]|=J[N];break;case 2:for(N=0;N<M;N++)y[B+N]^=J[N];break;default:p("JBIG2 error: operator "+u+" is not supported")}x+=M-1}L++;C=h(g,"IADS",d);if(null===C)break;x+=C+t}while(1)}return a}function w(a,b){return{width:d(a,b),height:d(a,b+4),x:d(a,b+8),y:d(a,b+12),combinationOperator:a[b+16]&7}}function q(){}function G(){}c.prototype={getContexts:function(a){return a in this?this[a]:this[a]=new Int8Array(65536)}};
-e.prototype={get decoder(){var a=new g(this.data,this.start,this.end);return f(this,"decoder",a)},get contextCache(){var a=new c;return f(this,"contextCache",a)}};var L=["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"],C=[[{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}]],D=[{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}]}],B=[39717,1941,229,405],Q=[32,8];q.prototype={onPageInformation:function(a){this.currentPageInfo=a;var b=new Uint8Array((a.width+7>>3)*a.height);if(a.defaultPixelValue){a=0;for(var c=b.length;a<c;a++)b[a]=255}this.buffer=b},drawBitmap:function(a,b){var c=this.currentPageInfo,d=a.width,g=a.height,e=c.width+7>>3,f=c.combinationOperatorOverride?a.combinationOperator:c.combinationOperator;
-c=this.buffer;var h=128>>(a.x&7);a=a.y*e+(a.x>>3);var l;switch(f){case 0:for(f=0;f<g;f++){var k=h;var q=a;for(l=0;l<d;l++)b[f][l]&&(c[q]|=k),k>>=1,k||(k=128,q++);a+=e}break;case 2:for(f=0;f<g;f++){k=h;q=a;for(l=0;l<d;l++)b[f][l]&&(c[q]^=k),k>>=1,k||(k=128,q++);a+=e}break;default:p("JBIG2 error: operator "+f+" is not supported")}},onImmediateGenericRegion:function(a,b,c,d){var g=a.info;b=new e(b,c,d);a=m(a.mmr,g.width,g.height,a.template,a.prediction,null,a.at,b);this.drawBitmap(g,a)},onImmediateLosslessGenericRegion:function(){this.onImmediateGenericRegion.apply(this,
-arguments)},onSymbolDictionary:function(b,c,d,g,f,k){b.huffman&&p("JBIG2 error: huffman is not supported");var q=this.symbols;q||(this.symbols=q={});for(var t=[],y=0,u=d.length;y<u;y++)t=t.concat(q[d[y]]);k=new e(g,f,k);y=b.huffman;u=b.refinement;d=t;t=b.numberOfNewSymbols;var L=b.template,v=b.at,w=b.refinementTemplate,z=b.refinementAt;y&&p("JBIG2 error: huffman is not supported");b=[];var A=0,G=a(d.length+t);g=k.decoder;for(f=k.contextCache;b.length<t;){var C=h(f,"IADH",g);A+=C;for(C=0;;){var x=
-h(f,"IADW",g);if(null===x)break;C+=x;if(u)if(x=h(f,"IAAI",g),1<x)x=r(y,u,C,A,0,x,1,d.concat(b),G,0,0,1,0,void 0,w,z,k);else{x=l(f,g,G);var D=h(f,"IARDX",g),K=h(f,"IARDY",g);x=n(C,A,w,x<d.length?d[x]:b[x-d.length],D,K,!1,z,k)}else x=m(!1,C,A,L,!1,null,v,k);b.push(x)}}k=[];y=[];u=!1;for(L=d.length+t;y.length<L;){for(v=h(f,"IAEX",g);v--;)y.push(u);u=!u}g=0;for(f=d.length;g<f;g++)y[g]&&k.push(d[g]);for(d=0;d<t;g++,d++)y[g]&&k.push(b[d]);q[c]=k},onImmediateTextRegion:function(b,c,d,g,f){for(var h=b.info,
-l=this.symbols,k=[],q=0,m=c.length;q<m;q++)k=k.concat(l[c[q]]);c=a(k.length);d=new e(d,g,f);b=r(b.huffman,b.refinement,h.width,h.height,b.defaultPixelValue,b.numberOfSymbolInstances,b.stripSize,k,c,b.transposed,b.dsOffset,b.referenceCorner,b.combinationOperator,void 0,b.refinementTemplate,b.refinementAt,d);this.drawBitmap(h,b)},onImmediateLosslessTextRegion:function(){this.onImmediateTextRegion.apply(this,arguments)}};G.prototype={parseChunks:function(a){for(var c=new q,g=0,e=a.length;g<e;g++){for(var f=
-a[g],h={},l=f.data,k=f.end,m=[],n=f.start;n<k;){f=l;var t=n;n={};n.number=d(f,t);var r=f[t+4];var u=r&63;L[u]||p("JBIG2 error: invalid segment type: "+u);n.type=u;n.typeName=L[u];n.deferredNonRetain=!!(r&128);r=!!(r&64);var v=f[t+5],z=v>>5&7;var A=[v&31];t+=6;if(7===v)for(z=d(f,t-1)&536870911,t+=3,v=z+7>>3,A[0]=f[t++];0<--v;)A.push(f[t++]);else 5!==v&&6!==v||p("JBIG2 error: invalid referred-to flags");n.retainBits=A;v=256>=n.number?1:65536>=n.number?2:4;var G=[];for(A=0;A<z;A++){var x=1===v?f[t]:
-2===v?b(f,t):d(f,t);G.push(x);t+=v}n.referredTo=G;r?(n.pageAssociation=d(f,t),t+=4):n.pageAssociation=f[t++];n.length=d(f,t);t+=4;if(4294967295===n.length)if(38===u){r=w(f,t);z=!!(f[t+17]&1);u=new Uint8Array(6);z||(u[0]=255,u[1]=172);u[2]=r.height>>>24&255;u[3]=r.height>>16&255;u[4]=r.height>>8&255;u[5]=r.height&255;A=t;for(r=f.length;A<r;A++){for(z=0;6>z&&u[z]===f[A+z];)z++;if(6===z){n.length=A+6;break}}4294967295===n.length&&p("JBIG2 error: segment end was not found")}else p("JBIG2 error: invalid unknown segment length");
-n.headerEnd=t;f=n;n=f.headerEnd;t={header:f,data:l};h.randomAccess||(t.start=n,n+=f.length,t.end=n);m.push(t);if(51===f.type)break}if(h.randomAccess)for(h=0,l=m.length;h<l;h++)m[h].start=n,n+=m[h].header.length,m[h].end=n;h=c;l=0;for(k=m.length;l<k;l++){z=void 0;r=m[l];f=h;n=r.header;t=r.data;u=r.start;r=r.end;switch(n.type){case 0:G={};z=b(t,u);G.huffman=!!(z&1);G.refinement=!!(z&2);G.huffmanDHSelector=z>>2&3;G.huffmanDWSelector=z>>4&3;G.bitmapSizeSelector=z>>6&1;G.aggregationInstancesSelector=z>>
-7&1;G.bitmapCodingContextUsed=!!(z&256);G.bitmapCodingContextRetained=!!(z&512);G.template=z>>10&3;G.refinementTemplate=z>>12&1;u+=2;if(!G.huffman){v=0===G.template?4:1;A=[];for(z=0;z<v;z++)A.push({x:t[u]<<24>>24,y:t[u+1]<<24>>24}),u+=2;G.at=A}if(G.refinement&&!G.refinementTemplate){A=[];for(z=0;2>z;z++)A.push({x:t[u]<<24>>24,y:t[u+1]<<24>>24}),u+=2;G.refinementAt=A}G.numberOfExportedSymbols=d(t,u);u+=4;G.numberOfNewSymbols=d(t,u);z=[G,n.number,n.referredTo,t,u+4,r];break;case 6:case 7:v={};v.info=
-w(t,u);u+=17;z=b(t,u);u+=2;v.huffman=!!(z&1);v.refinement=!!(z&2);v.stripSize=1<<(z>>2&3);v.referenceCorner=z>>4&3;v.transposed=!!(z&64);v.combinationOperator=z>>7&3;v.defaultPixelValue=z>>9&1;v.dsOffset=z<<17>>27;v.refinementTemplate=z>>15&1;v.huffman&&(z=b(t,u),u+=2,v.huffmanFS=z&3,v.huffmanDS=z>>2&3,v.huffmanDT=z>>4&3,v.huffmanRefinementDW=z>>6&3,v.huffmanRefinementDH=z>>8&3,v.huffmanRefinementDX=z>>10&3,v.huffmanRefinementDY=z>>12&3,v.huffmanRefinementSizeSelector=!!(z&14));if(v.refinement&&!v.refinementTemplate){A=
-[];for(z=0;2>z;z++)A.push({x:t[u]<<24>>24,y:t[u+1]<<24>>24}),u+=2;v.refinementAt=A}v.numberOfSymbolInstances=d(t,u);u+=4;v.huffman&&p("JBIG2 error: huffman is not supported");z=[v,n.referredTo,t,u,r];break;case 38:case 39:G={};G.info=w(t,u);u+=17;z=t[u++];G.mmr=!!(z&1);G.template=z>>1&3;G.prediction=!!(z&8);if(!G.mmr){v=0===G.template?4:1;A=[];for(z=0;z<v;z++)A.push({x:t[u]<<24>>24,y:t[u+1]<<24>>24}),u+=2;G.at=A}z=[G,t,u,r];break;case 48:r={width:d(t,u),height:d(t,u+4),resolutionX:d(t,u+8),resolutionY:d(t,
-u+12)};4294967295===r.height&&delete r.height;z=t[u+16];b(t,u+17);r.lossless=!!(z&1);r.refinement=!!(z&2);r.defaultPixelValue=z>>2&1;r.combinationOperator=z>>3&3;r.requiresBuffer=!!(z&32);r.combinationOperatorOverride=!!(z&64);z=[r];break;case 49:break;case 50:break;case 51:break;case 62:break;default:p("JBIG2 error: segment type "+n.typeName+"("+n.type+") is not implemented")}n="on"+n.typeName;n in f&&f[n].apply(f,z)}}return c}};return G}(),p=function(){console.error.apply(console,arguments);throw Error("PDFJS error: "+
-arguments[0]);},h=function(){console.warn.apply(console,arguments)},B=function(){console.info.apply(console,arguments)};m.prototype.parse=function(a){var b=0,c=a.length;151===a[b]&&74===a[b+1]&&66===a[b+2]&&50===a[b+3]&&13===a[b+4]&&10===a[b+5]&&26===a[b+6]&&10===a[b+7]||p("JBIG2 error: invalid header");b+=8;a[b++]&2||(d(a,b),b+=4);a=this.parseChunks([{data:a,start:b,end:c}]);b=a.currentPageInfo.width;c=a.currentPageInfo.height;var g=a.buffer;a=new Uint8Array(b*c);for(var e=0,f=0,h=0;h<c;h++)for(var l=
-0,k,q=0;q<b;q++)l||(l=128,k=g[f++]),a[e++]=k&l?0:255,l>>=1;this.width=b;this.height=c;this.data=a};c.JpegImage=e;c.JpxImage=k;c.Jbig2Image=m})(f||(f={}));p.exports={JpegImage:e,JpegDecoder:f.JpegImage,JpxDecoder:f.JpxImage,Jbig2Decoder:f.Jbig2Image}},function(p,e,m){m.d(e,"a",function(){return k});var k=function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");};k.RPC_ID="ndstore/VolumeChunkSource"},function(p,e,m){e.a=function(d,e){e=Object(a.a)(Object(b.inflate)(new Uint8Array(e)));
-var l=d.chunkDataSize,g=d.source,m=g.spec.numChannels,n=e.shape;if(4!==n.length||n[0]!==m||n[1]!==l[2]||n[2]!==l[1]||n[3]!==l[0])throw Error("Shape "+JSON.stringify(n)+" does not match chunkDataSize "+Object(c.n)(l));l=e.dataType.dataType;g=g.spec;if(l!==g.dataType)throw Error("Data type "+f.a[l]+" does not match "+("expected data type "+f.a[g.dataType]));Object(k.a)(d,e.data)};var k=m(26),f=m(9),c=m(1),a=m(103),b=m(27);m.n(b)},function(p,e,m){e.a=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);b=(new DataView(a.buffer,a.byteOffset,a.byteLength)).getUint16(8,!0);d=(new TextDecoder("utf-8")).decode(a.subarray(10,b+10));b+=10;try{var e=Object(f.d)(d)}catch(u){throw Error("Failed to parse npy header: "+u);}var l=e.descr;d=e.shape;var h=1;if(!Array.isArray(d))throw Error("Invalid shape ${JSON.stringify(shape)}");for(var k=$jscomp.makeIterator(d),
-m=k.next();!m.done;m=k.next()){m=m.value;if("number"!==typeof m)throw Error("Invalid shape ${JSON.stringify(shape)}");h*=m}k=c.get(l);if(void 0===k)throw Error("Unsupported numpy data type "+JSON.stringify(l));l=k.arrayConstructor;h*=k.javascriptElementsPerArrayElement;if(l.BYTES_PER_ELEMENT*h+b!==a.byteLength)throw Error("Expected length does not match length of data");a=new l(a.buffer,a.byteOffset+b,h);k.fixEndianness(a);return new n(a,d,k,!0===e.fortran_order)};p=m(14);var k=m(11),f=m(3),c=new Map;
-c.set("|u1",{arrayConstructor:Uint8Array,fixEndianness:function(){},javascriptElementsPerArrayElement:1,elementBytes:1,dataType:p.b.UINT8});c.set("|i1",{arrayConstructor:Uint8Array,fixEndianness:function(){},javascriptElementsPerArrayElement:1,elementBytes:1,dataType:p.b.UINT8});m={};e=$jscomp.makeIterator([["<",k.b.LITTLE],[">",k.b.BIG]]);for(var a=e.next();!a.done;m={endianness:m.endianness},a=e.next()){var b=$jscomp.makeIterator(a.value);a=b.next().value;m.endianness=b.next().value;b=$jscomp.makeIterator(["u",
-"i"]);for(var d=b.next();!d.done;d=b.next())d=d.value,c.set(""+a+d+"2",{arrayConstructor:Uint16Array,elementBytes:2,fixEndianness:function(a){return function(b){Object(k.c)(b,a.endianness)}}(m),javascriptElementsPerArrayElement:1,dataType:p.b.UINT16}),c.set(""+a+d+"4",{arrayConstructor:Uint32Array,elementBytes:4,fixEndianness:function(a){return function(b){Object(k.d)(b,a.endianness)}}(m),javascriptElementsPerArrayElement:1,dataType:p.b.UINT32}),c.set(""+a+d+"8",{arrayConstructor:Uint32Array,elementBytes:8,
-fixEndianness:function(a){return function(b){Object(k.d)(b,a.endianness)}}(m),javascriptElementsPerArrayElement:2,dataType:p.b.UINT64});c.set(a+"f4",{arrayConstructor:Float32Array,elementBytes:4,fixEndianness:function(a){return function(b){Object(k.d)(b,a.endianness)}}(m),javascriptElementsPerArrayElement:1,dataType:p.b.FLOAT32})}var n=function g(a,b,c,d){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");this.data=a;this.shape=b;this.dataType=c;this.fortranOrder=d}},
-function(p,e,m){function k(g){if(!(this instanceof k))return new k(g);g=this.options=a.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},g||{});g.raw&&0<g.windowBits?g.windowBits=-g.windowBits:g.gzip&&0<g.windowBits&&16>g.windowBits&&(g.windowBits+=16);this.err=0;this.msg="";this.ended=!1;this.chunks=[];this.strm=new n;this.strm.avail_out=0;var e=c.deflateInit2(this.strm,g.level,g.method,g.windowBits,g.memLevel,g.strategy);if(0!==e)throw Error(d[e]);g.header&&c.deflateSetHeader(this.strm,
-g.header);if(g.dictionary){g="string"===typeof g.dictionary?b.string2buf(g.dictionary):"[object ArrayBuffer]"===l.call(g.dictionary)?new Uint8Array(g.dictionary):g.dictionary;e=c.deflateSetDictionary(this.strm,g);if(0!==e)throw Error(d[e]);this._dict_set=!0}}function f(a,b){b=new k(b);b.push(a,!0);if(b.err)throw b.msg||d[b.err];return b.result}var c=m(105),a=m(6),b=m(48),d=m(28),n=m(49),l=Object.prototype.toString;k.prototype.push=function(d,e){var g=this.strm,f=this.options.chunkSize;if(this.ended)return!1;
-e=e===~~e?e:!0===e?4:0;"string"===typeof d?g.input=b.string2buf(d):"[object ArrayBuffer]"===l.call(d)?g.input=new Uint8Array(d):g.input=d;g.next_in=0;g.avail_in=g.input.length;do{0===g.avail_out&&(g.output=new a.Buf8(f),g.next_out=0,g.avail_out=f);d=c.deflate(g,e);if(1!==d&&0!==d)return this.onEnd(d),this.ended=!0,!1;if(0===g.avail_out||0===g.avail_in&&(4===e||2===e))if("string"===this.options.to)this.onData(b.buf2binstring(a.shrinkBuf(g.output,g.next_out)));else this.onData(a.shrinkBuf(g.output,
-g.next_out))}while((0<g.avail_in||0===g.avail_out)&&1!==d);if(4===e)return d=c.deflateEnd(this.strm),this.onEnd(d),this.ended=!0,0===d;2===e&&(this.onEnd(0),g.avail_out=0);return!0};k.prototype.onData=function(a){this.chunks.push(a)};k.prototype.onEnd=function(b){0===b&&(this.result="string"===this.options.to?this.chunks.join(""):a.flattenChunks(this.chunks));this.chunks=[];this.err=b;this.msg=this.strm.msg};e.Deflate=k;e.deflate=f;e.deflateRaw=function(a,b){b=b||{};b.raw=!0;return f(a,b)};e.gzip=
-function(a,b){b=b||{};b.gzip=!0;return f(a,b)}},function(p,e,m){function k(a,b){a.msg=z[b];return b}function f(a){for(var b=a.length;0<=--b;)a[b]=0}function c(a){var b=a.state,c=b.pending;c>a.avail_out&&(c=a.avail_out);0!==c&&(J.arraySet(a.output,b.pending_buf,b.pending_out,c,a.next_out),a.next_out+=c,b.pending_out+=c,a.total_out+=c,a.avail_out-=c,b.pending-=c,0===b.pending&&(b.pending_out=0))}function a(a,b){v._tr_flush_block(a,0<=a.block_start?a.block_start:-1,a.strstart-a.block_start,b);a.block_start=
-a.strstart;c(a.strm)}function b(a,b){a.pending_buf[a.pending++]=b}function d(a,b){a.pending_buf[a.pending++]=b>>>8&255;a.pending_buf[a.pending++]=b&255}function n(a,b){var c=a.max_chain_length,d=a.strstart,g=a.prev_length,e=a.nice_match,f=a.strstart>a.w_size-262?a.strstart-(a.w_size-262):0,h=a.window,l=a.w_mask,k=a.prev,m=a.strstart+258,q=h[d+g-1],t=h[d+g];a.prev_length>=a.good_match&&(c>>=2);e>a.lookahead&&(e=a.lookahead);do{var n=b;if(h[n+g]===t&&h[n+g-1]===q&&h[n]===h[d]&&h[++n]===h[d+1]){d+=2;
-for(n++;h[++d]===h[++n]&&h[++d]===h[++n]&&h[++d]===h[++n]&&h[++d]===h[++n]&&h[++d]===h[++n]&&h[++d]===h[++n]&&h[++d]===h[++n]&&h[++d]===h[++n]&&d<m;);n=258-(m-d);d=m-258;if(n>g){a.match_start=b;g=n;if(n>=e)break;q=h[d+g-1];t=h[d+g]}}}while((b=k[b&l])>f&&0!==--c);return g<=a.lookahead?g:a.lookahead}function l(a){var b=a.w_size,c;do{var d=a.window_size-a.lookahead-a.strstart;if(a.strstart>=b+(b-262)){J.arraySet(a.window,a.window,b,b,0);a.match_start-=b;a.strstart-=b;a.block_start-=b;var g=c=a.hash_size;
-do{var e=a.head[--g];a.head[g]=e>=b?e-b:0}while(--c);g=c=b;do e=a.prev[--g],a.prev[g]=e>=b?e-b:0;while(--c);d+=b}if(0===a.strm.avail_in)break;g=a.strm;c=a.window;e=a.strstart+a.lookahead;var f=g.avail_in;f>d&&(f=d);0===f?c=0:(g.avail_in-=f,J.arraySet(c,g.input,g.next_in,f,e),1===g.state.wrap?g.adler=A(g.adler,c,f,e):2===g.state.wrap&&(g.adler=t(g.adler,c,f,e)),g.next_in+=f,g.total_in+=f,c=f);a.lookahead+=c;if(3<=a.lookahead+a.insert)for(d=a.strstart-a.insert,a.ins_h=a.window[d],a.ins_h=(a.ins_h<<
-a.hash_shift^a.window[d+1])&a.hash_mask;a.insert&&!(a.ins_h=(a.ins_h<<a.hash_shift^a.window[d+3-1])&a.hash_mask,a.prev[d&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=d,d++,a.insert--,3>a.lookahead+a.insert););}while(262>a.lookahead&&0!==a.strm.avail_in)}function g(b,c){for(var d;;){if(262>b.lookahead){l(b);if(262>b.lookahead&&0===c)return 1;if(0===b.lookahead)break}d=0;3<=b.lookahead&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+3-1])&b.hash_mask,d=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],
-b.head[b.ins_h]=b.strstart);0!==d&&b.strstart-d<=b.w_size-262&&(b.match_length=n(b,d));if(3<=b.match_length)if(d=v._tr_tally(b,b.strstart-b.match_start,b.match_length-3),b.lookahead-=b.match_length,b.match_length<=b.max_lazy_match&&3<=b.lookahead){b.match_length--;do b.strstart++,b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+3-1])&b.hash_mask,b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart;while(0!==--b.match_length);b.strstart++}else b.strstart+=b.match_length,b.match_length=
-0,b.ins_h=b.window[b.strstart],b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+1])&b.hash_mask;else d=v._tr_tally(b,0,b.window[b.strstart]),b.lookahead--,b.strstart++;if(d&&(a(b,!1),0===b.strm.avail_out))return 1}b.insert=2>b.strstart?b.strstart:2;return 4===c?(a(b,!0),0===b.strm.avail_out?3:4):b.last_lit&&(a(b,!1),0===b.strm.avail_out)?1:2}function r(b,c){for(var d,g;;){if(262>b.lookahead){l(b);if(262>b.lookahead&&0===c)return 1;if(0===b.lookahead)break}d=0;3<=b.lookahead&&(b.ins_h=(b.ins_h<<
-b.hash_shift^b.window[b.strstart+3-1])&b.hash_mask,d=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart);b.prev_length=b.match_length;b.prev_match=b.match_start;b.match_length=2;0!==d&&b.prev_length<b.max_lazy_match&&b.strstart-d<=b.w_size-262&&(b.match_length=n(b,d),5>=b.match_length&&(1===b.strategy||3===b.match_length&&4096<b.strstart-b.match_start)&&(b.match_length=2));if(3<=b.prev_length&&b.match_length<=b.prev_length){g=b.strstart+b.lookahead-3;d=v._tr_tally(b,b.strstart-
-1-b.prev_match,b.prev_length-3);b.lookahead-=b.prev_length-1;b.prev_length-=2;do++b.strstart<=g&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+3-1])&b.hash_mask,b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart);while(0!==--b.prev_length);b.match_available=0;b.match_length=2;b.strstart++;if(d&&(a(b,!1),0===b.strm.avail_out))return 1}else if(b.match_available){if((d=v._tr_tally(b,0,b.window[b.strstart-1]))&&a(b,!1),b.strstart++,b.lookahead--,0===b.strm.avail_out)return 1}else b.match_available=
-1,b.strstart++,b.lookahead--}b.match_available&&(v._tr_tally(b,0,b.window[b.strstart-1]),b.match_available=0);b.insert=2>b.strstart?b.strstart:2;return 4===c?(a(b,!0),0===b.strm.avail_out?3:4):b.last_lit&&(a(b,!1),0===b.strm.avail_out)?1:2}function C(b,c){for(var d,g,e,f=b.window;;){if(258>=b.lookahead){l(b);if(258>=b.lookahead&&0===c)return 1;if(0===b.lookahead)break}b.match_length=0;if(3<=b.lookahead&&0<b.strstart&&(g=b.strstart-1,d=f[g],d===f[++g]&&d===f[++g]&&d===f[++g])){for(e=b.strstart+258;d===
-f[++g]&&d===f[++g]&&d===f[++g]&&d===f[++g]&&d===f[++g]&&d===f[++g]&&d===f[++g]&&d===f[++g]&&g<e;);b.match_length=258-(e-g);b.match_length>b.lookahead&&(b.match_length=b.lookahead)}3<=b.match_length?(d=v._tr_tally(b,1,b.match_length-3),b.lookahead-=b.match_length,b.strstart+=b.match_length,b.match_length=0):(d=v._tr_tally(b,0,b.window[b.strstart]),b.lookahead--,b.strstart++);if(d&&(a(b,!1),0===b.strm.avail_out))return 1}b.insert=0;return 4===c?(a(b,!0),0===b.strm.avail_out?3:4):b.last_lit&&(a(b,!1),
-0===b.strm.avail_out)?1:2}function w(b,c){for(var d;;){if(0===b.lookahead&&(l(b),0===b.lookahead)){if(0===c)return 1;break}b.match_length=0;d=v._tr_tally(b,0,b.window[b.strstart]);b.lookahead--;b.strstart++;if(d&&(a(b,!1),0===b.strm.avail_out))return 1}b.insert=0;return 4===c?(a(b,!0),0===b.strm.avail_out?3:4):b.last_lit&&(a(b,!1),0===b.strm.avail_out)?1:2}function h(a,b,c,d,g){this.good_length=a;this.max_lazy=b;this.nice_length=c;this.max_chain=d;this.func=g}function B(){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 J.Buf16(1146);this.dyn_dtree=new J.Buf16(122);this.bl_tree=new J.Buf16(78);f(this.dyn_ltree);f(this.dyn_dtree);f(this.bl_tree);this.bl_desc=this.d_desc=this.l_desc=null;this.bl_count=new J.Buf16(16);this.heap=new J.Buf16(573);f(this.heap);this.heap_max=this.heap_len=0;this.depth=new J.Buf16(573);f(this.depth);this.bi_valid=this.bi_buf=this.insert=this.matches=this.static_len=this.opt_len=this.d_buf=this.last_lit=this.lit_bufsize=
-this.l_buf=0}function I(a){if(!a||!a.state)return k(a,-2);a.total_in=a.total_out=0;a.data_type=2;var b=a.state;b.pending=0;b.pending_out=0;0>b.wrap&&(b.wrap=-b.wrap);b.status=b.wrap?42:113;a.adler=2===b.wrap?0:1;b.last_flush=0;v._tr_init(b);return 0}function u(a){var b=I(a);0===b&&(a=a.state,a.window_size=2*a.w_size,f(a.head),a.max_lazy_match=H[a.level].max_lazy,a.good_match=H[a.level].good_length,a.nice_match=H[a.level].nice_length,a.max_chain_length=H[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 b}function x(a,b,c,d,g,e){if(!a)return-2;var f=1;-1===b&&(b=6);0>d?(f=0,d=-d):15<d&&(f=2,d-=16);if(1>g||9<g||8!==c||8>d||15<d||0>b||9<b||0>e||4<e)return k(a,-2);8===d&&(d=9);var h=new B;a.state=h;h.strm=a;h.wrap=f;h.gzhead=null;h.w_bits=d;h.w_size=1<<h.w_bits;h.w_mask=h.w_size-1;h.hash_bits=g+7;h.hash_size=1<<h.hash_bits;h.hash_mask=h.hash_size-1;h.hash_shift=~~((h.hash_bits+3-1)/3);h.window=new J.Buf8(2*
-h.w_size);h.head=new J.Buf16(h.hash_size);h.prev=new J.Buf16(h.w_size);h.lit_bufsize=1<<g+6;h.pending_buf_size=4*h.lit_bufsize;h.pending_buf=new J.Buf8(h.pending_buf_size);h.d_buf=1*h.lit_bufsize;h.l_buf=3*h.lit_bufsize;h.level=b;h.strategy=e;h.method=c;return u(a)}var J=m(6),v=m(106),A=m(46),t=m(47),z=m(28);var H=[new h(0,0,0,0,function(b,c){var d=65535;for(d>b.pending_buf_size-5&&(d=b.pending_buf_size-5);;){if(1>=b.lookahead){l(b);if(0===b.lookahead&&0===c)return 1;if(0===b.lookahead)break}b.strstart+=
-b.lookahead;b.lookahead=0;var g=b.block_start+d;if(0===b.strstart||b.strstart>=g)if(b.lookahead=b.strstart-g,b.strstart=g,a(b,!1),0===b.strm.avail_out)return 1;if(b.strstart-b.block_start>=b.w_size-262&&(a(b,!1),0===b.strm.avail_out))return 1}b.insert=0;if(4===c)return a(b,!0),0===b.strm.avail_out?3:4;b.strstart>b.block_start&&a(b,!1);return 1}),new h(4,4,8,4,g),new h(4,5,16,8,g),new h(4,6,32,32,g),new h(4,4,16,16,r),new h(8,16,32,32,r),new h(8,16,128,128,r),new h(8,32,128,256,r),new h(32,128,258,
-1024,r),new h(32,258,258,4096,r)];e.deflateInit=function(a,b){return x(a,b,8,15,8,0)};e.deflateInit2=x;e.deflateReset=u;e.deflateResetKeep=I;e.deflateSetHeader=function(a,b){if(!a||!a.state||2!==a.state.wrap)return-2;a.state.gzhead=b;return 0};e.deflate=function(a,g){if(!a||!a.state||5<g||0>g)return a?k(a,-2):-2;var e=a.state;if(!a.output||!a.input&&0!==a.avail_in||666===e.status&&4!==g)return k(a,0===a.avail_out?-5:-2);e.strm=a;var h=e.last_flush;e.last_flush=g;if(42===e.status)if(2===e.wrap)a.adler=
-0,b(e,31),b(e,139),b(e,8),e.gzhead?(b(e,(e.gzhead.text?1:0)+(e.gzhead.hcrc?2:0)+(e.gzhead.extra?4:0)+(e.gzhead.name?8:0)+(e.gzhead.comment?16:0)),b(e,e.gzhead.time&255),b(e,e.gzhead.time>>8&255),b(e,e.gzhead.time>>16&255),b(e,e.gzhead.time>>24&255),b(e,9===e.level?2:2<=e.strategy||2>e.level?4:0),b(e,e.gzhead.os&255),e.gzhead.extra&&e.gzhead.extra.length&&(b(e,e.gzhead.extra.length&255),b(e,e.gzhead.extra.length>>8&255)),e.gzhead.hcrc&&(a.adler=t(a.adler,e.pending_buf,e.pending,0)),e.gzindex=0,e.status=
-69):(b(e,0),b(e,0),b(e,0),b(e,0),b(e,0),b(e,9===e.level?2:2<=e.strategy||2>e.level?4:0),b(e,3),e.status=113);else{var l=8+(e.w_bits-8<<4)<<8;l|=(2<=e.strategy||2>e.level?0:6>e.level?1:6===e.level?2:3)<<6;0!==e.strstart&&(l|=32);e.status=113;d(e,l+(31-l%31));0!==e.strstart&&(d(e,a.adler>>>16),d(e,a.adler&65535));a.adler=1}if(69===e.status)if(e.gzhead.extra){for(l=e.pending;e.gzindex<(e.gzhead.extra.length&65535)&&(e.pending!==e.pending_buf_size||(e.gzhead.hcrc&&e.pending>l&&(a.adler=t(a.adler,e.pending_buf,
-e.pending-l,l)),c(a),l=e.pending,e.pending!==e.pending_buf_size));)b(e,e.gzhead.extra[e.gzindex]&255),e.gzindex++;e.gzhead.hcrc&&e.pending>l&&(a.adler=t(a.adler,e.pending_buf,e.pending-l,l));e.gzindex===e.gzhead.extra.length&&(e.gzindex=0,e.status=73)}else e.status=73;if(73===e.status)if(e.gzhead.name){l=e.pending;do{if(e.pending===e.pending_buf_size&&(e.gzhead.hcrc&&e.pending>l&&(a.adler=t(a.adler,e.pending_buf,e.pending-l,l)),c(a),l=e.pending,e.pending===e.pending_buf_size)){var m=1;break}m=e.gzindex<
-e.gzhead.name.length?e.gzhead.name.charCodeAt(e.gzindex++)&255:0;b(e,m)}while(0!==m);e.gzhead.hcrc&&e.pending>l&&(a.adler=t(a.adler,e.pending_buf,e.pending-l,l));0===m&&(e.gzindex=0,e.status=91)}else e.status=91;if(91===e.status)if(e.gzhead.comment){l=e.pending;do{if(e.pending===e.pending_buf_size&&(e.gzhead.hcrc&&e.pending>l&&(a.adler=t(a.adler,e.pending_buf,e.pending-l,l)),c(a),l=e.pending,e.pending===e.pending_buf_size)){m=1;break}m=e.gzindex<e.gzhead.comment.length?e.gzhead.comment.charCodeAt(e.gzindex++)&
-255:0;b(e,m)}while(0!==m);e.gzhead.hcrc&&e.pending>l&&(a.adler=t(a.adler,e.pending_buf,e.pending-l,l));0===m&&(e.status=103)}else e.status=103;103===e.status&&(e.gzhead.hcrc?(e.pending+2>e.pending_buf_size&&c(a),e.pending+2<=e.pending_buf_size&&(b(e,a.adler&255),b(e,a.adler>>8&255),a.adler=0,e.status=113)):e.status=113);if(0!==e.pending){if(c(a),0===a.avail_out)return e.last_flush=-1,0}else if(0===a.avail_in&&(g<<1)-(4<g?9:0)<=(h<<1)-(4<h?9:0)&&4!==g)return k(a,-5);if(666===e.status&&0!==a.avail_in)return k(a,
--5);if(0!==a.avail_in||0!==e.lookahead||0!==g&&666!==e.status){h=2===e.strategy?w(e,g):3===e.strategy?C(e,g):H[e.level].func(e,g);if(3===h||4===h)e.status=666;if(1===h||3===h)return 0===a.avail_out&&(e.last_flush=-1),0;if(2===h&&(1===g?v._tr_align(e):5!==g&&(v._tr_stored_block(e,0,0,!1),3===g&&(f(e.head),0===e.lookahead&&(e.strstart=0,e.block_start=0,e.insert=0))),c(a),0===a.avail_out))return e.last_flush=-1,0}if(4!==g)return 0;if(0>=e.wrap)return 1;2===e.wrap?(b(e,a.adler&255),b(e,a.adler>>8&255),
-b(e,a.adler>>16&255),b(e,a.adler>>24&255),b(e,a.total_in&255),b(e,a.total_in>>8&255),b(e,a.total_in>>16&255),b(e,a.total_in>>24&255)):(d(e,a.adler>>>16),d(e,a.adler&65535));c(a);0<e.wrap&&(e.wrap=-e.wrap);return 0!==e.pending?0:1};e.deflateEnd=function(a){if(!a||!a.state)return-2;var b=a.state.status;if(42!==b&&69!==b&&73!==b&&91!==b&&103!==b&&113!==b&&666!==b)return k(a,-2);a.state=null;return 113===b?k(a,-3):0};e.deflateSetDictionary=function(a,b){var c=b.length;if(!a||!a.state)return-2;var d=a.state;
-var e=d.wrap;if(2===e||1===e&&42!==d.status||d.lookahead)return-2;1===e&&(a.adler=A(a.adler,b,c,0));d.wrap=0;if(c>=d.w_size){0===e&&(f(d.head),d.strstart=0,d.block_start=0,d.insert=0);var g=new J.Buf8(d.w_size);J.arraySet(g,b,c-d.w_size,d.w_size,0);b=g;c=d.w_size}g=a.avail_in;var h=a.next_in;var k=a.input;a.avail_in=c;a.next_in=0;a.input=b;for(l(d);3<=d.lookahead;){b=d.strstart;c=d.lookahead-2;do d.ins_h=(d.ins_h<<d.hash_shift^d.window[b+3-1])&d.hash_mask,d.prev[b&d.w_mask]=d.head[d.ins_h],d.head[d.ins_h]=
-b,b++;while(--c);d.strstart=b;d.lookahead=2;l(d)}d.strstart+=d.lookahead;d.block_start=d.strstart;d.insert=d.lookahead;d.lookahead=0;d.match_length=d.prev_length=2;d.match_available=0;a.next_in=h;a.input=k;a.avail_in=g;d.wrap=e;return 0};e.deflateInfo="pako deflate (from Nodeca project)"},function(p,e,m){function k(a){for(var b=a.length;0<=--b;)a[b]=0}function f(a,b,c,d,e){this.static_tree=a;this.extra_bits=b;this.extra_base=c;this.elems=d;this.max_length=e;this.has_stree=a&&a.length}function c(a,
-b){this.dyn_tree=a;this.max_code=0;this.stat_desc=b}function a(a,b){a.pending_buf[a.pending++]=b&255;a.pending_buf[a.pending++]=b>>>8&255}function b(b,c,d){b.bi_valid>16-d?(b.bi_buf|=c<<b.bi_valid&65535,a(b,b.bi_buf),b.bi_buf=c>>16-b.bi_valid,b.bi_valid+=d-16):(b.bi_buf|=c<<b.bi_valid&65535,b.bi_valid+=d)}function d(a,c,d){b(a,d[2*c],d[2*c+1])}function n(a,b){var c=0;do c|=a&1,a>>>=1,c<<=1;while(0<--b);return c>>>1}function l(a,b,c){var d=Array(16),e=0,g;for(g=1;15>=g;g++)d[g]=e=e+c[g-1]<<1;for(c=
-0;c<=b;c++)e=a[2*c+1],0!==e&&(a[2*c]=n(d[e]++,e))}function g(a){var b;for(b=0;286>b;b++)a.dyn_ltree[2*b]=0;for(b=0;30>b;b++)a.dyn_dtree[2*b]=0;for(b=0;19>b;b++)a.bl_tree[2*b]=0;a.dyn_ltree[512]=1;a.opt_len=a.static_len=0;a.last_lit=a.matches=0}function r(b){8<b.bi_valid?a(b,b.bi_buf):0<b.bi_valid&&(b.pending_buf[b.pending++]=b.bi_buf);b.bi_buf=0;b.bi_valid=0}function C(a,b,c,d){var e=2*b,g=2*c;return a[e]<a[g]||a[e]===a[g]&&d[b]<=d[c]}function w(a,b,c){for(var d=a.heap[c],e=c<<1;e<=a.heap_len;){e<
-a.heap_len&&C(b,a.heap[e+1],a.heap[e],a.depth)&&e++;if(C(b,d,a.heap[e],a.depth))break;a.heap[c]=a.heap[e];c=e;e<<=1}a.heap[c]=d}function h(a,c,e){var g=0;if(0!==a.last_lit){do{var f=a.pending_buf[a.d_buf+2*g]<<8|a.pending_buf[a.d_buf+2*g+1];var h=a.pending_buf[a.l_buf+g];g++;if(0===f)d(a,h,c);else{var l=K[h];d(a,l+256+1,c);var k=A[l];0!==k&&(h-=D[l],b(a,h,k));f--;l=256>f?L[f]:L[256+(f>>>7)];d(a,l,e);k=t[l];0!==k&&(f-=E[l],b(a,f,k))}}while(g<a.last_lit)}d(a,256,c)}function B(a,b){var c=b.dyn_tree,
-d=b.stat_desc.static_tree,e=b.stat_desc.has_stree,g=b.stat_desc.elems,f,h=-1;a.heap_len=0;a.heap_max=573;for(f=0;f<g;f++)0!==c[2*f]?(a.heap[++a.heap_len]=h=f,a.depth[f]=0):c[2*f+1]=0;for(;2>a.heap_len;){var k=a.heap[++a.heap_len]=2>h?++h:0;c[2*k]=1;a.depth[k]=0;a.opt_len--;e&&(a.static_len-=d[2*k+1])}b.max_code=h;for(f=a.heap_len>>1;1<=f;f--)w(a,c,f);k=g;do f=a.heap[1],a.heap[1]=a.heap[a.heap_len--],w(a,c,1),d=a.heap[1],a.heap[--a.heap_max]=f,a.heap[--a.heap_max]=d,c[2*k]=c[2*f]+c[2*d],a.depth[k]=
-(a.depth[f]>=a.depth[d]?a.depth[f]:a.depth[d])+1,c[2*f+1]=c[2*d+1]=k,a.heap[1]=k++,w(a,c,1);while(2<=a.heap_len);a.heap[--a.heap_max]=a.heap[1];f=b.dyn_tree;k=b.max_code;d=b.stat_desc.static_tree;e=b.stat_desc.has_stree;g=b.stat_desc.extra_bits;var m=b.stat_desc.extra_base,n=b.stat_desc.max_length,t,p=0;for(t=0;15>=t;t++)a.bl_count[t]=0;f[2*a.heap[a.heap_max]+1]=0;for(b=a.heap_max+1;573>b;b++){var q=a.heap[b];t=f[2*f[2*q+1]+1]+1;t>n&&(t=n,p++);f[2*q+1]=t;if(!(q>k)){a.bl_count[t]++;var r=0;q>=m&&(r=
-g[q-m]);var u=f[2*q];a.opt_len+=u*(t+r);e&&(a.static_len+=u*(d[2*q+1]+r))}}if(0!==p){do{for(t=n-1;0===a.bl_count[t];)t--;a.bl_count[t]--;a.bl_count[t+1]+=2;a.bl_count[n]--;p-=2}while(0<p);for(t=n;0!==t;t--)for(q=a.bl_count[t];0!==q;)d=a.heap[--b],d>k||(f[2*d+1]!==t&&(a.opt_len+=(t-f[2*d+1])*f[2*d],f[2*d+1]=t),q--)}l(c,h,a.bl_count)}function I(a,b,c){var d,e=-1,g=b[1],f=0,h=7,l=4;0===g&&(h=138,l=3);b[2*(c+1)+1]=65535;for(d=0;d<=c;d++){var k=g;g=b[2*(d+1)+1];++f<h&&k===g||(f<l?a.bl_tree[2*k]+=f:0!==
-k?(k!==e&&a.bl_tree[2*k]++,a.bl_tree[32]++):10>=f?a.bl_tree[34]++:a.bl_tree[36]++,f=0,e=k,0===g?(h=138,l=3):k===g?(h=6,l=3):(h=7,l=4))}}function u(a,c,e){var g,f=-1,h=c[1],l=0,k=7,m=4;0===h&&(k=138,m=3);for(g=0;g<=e;g++){var t=h;h=c[2*(g+1)+1];if(!(++l<k&&t===h)){if(l<m){do d(a,t,a.bl_tree);while(0!==--l)}else 0!==t?(t!==f&&(d(a,t,a.bl_tree),l--),d(a,16,a.bl_tree),b(a,l-3,2)):10>=l?(d(a,17,a.bl_tree),b(a,l-3,3)):(d(a,18,a.bl_tree),b(a,l-11,7));l=0;f=t;0===h?(k=138,m=3):t===h?(k=6,m=3):(k=7,m=4)}}}
-function x(a){var b=4093624447,c;for(c=0;31>=c;c++,b>>>=1)if(b&1&&0!==a.dyn_ltree[2*c])return 0;if(0!==a.dyn_ltree[18]||0!==a.dyn_ltree[20]||0!==a.dyn_ltree[26])return 1;for(c=32;256>c;c++)if(0!==a.dyn_ltree[2*c])return 1;return 0}function J(c,d,e,g){b(c,0+(g?1:0),3);r(c);a(c,e);a(c,~e);v.arraySet(c.pending_buf,c.window,d,e,c.pending);c.pending+=e}var v=m(6),A=[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],t=[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],z=[0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=Array(576);k(q);var G=Array(60);k(G);var L=Array(512);k(L);var K=Array(256);k(K);var D=Array(29);k(D);var E=Array(30);k(E);var Q,N,O,F=!1;e._tr_init=function(a){if(!F){var b,d,e,h=Array(16);for(e=d=0;28>e;e++)for(D[e]=d,b=0;b<1<<A[e];b++)K[d++]=e;K[d-1]=e;for(e=d=0;16>e;e++)for(E[e]=d,b=0;b<1<<t[e];b++)L[d++]=e;for(d>>=7;30>e;e++)for(E[e]=d<<7,b=0;b<1<<t[e]-7;b++)L[256+d++]=e;for(b=0;15>=b;b++)h[b]=0;for(b=0;143>=
-b;)q[2*b+1]=8,b++,h[8]++;for(;255>=b;)q[2*b+1]=9,b++,h[9]++;for(;279>=b;)q[2*b+1]=7,b++,h[7]++;for(;287>=b;)q[2*b+1]=8,b++,h[8]++;l(q,287,h);for(b=0;30>b;b++)G[2*b+1]=5,G[2*b]=n(b,5);Q=new f(q,A,257,286,15);N=new f(G,t,0,30,15);O=new f([],z,0,19,7);F=!0}a.l_desc=new c(a.dyn_ltree,Q);a.d_desc=new c(a.dyn_dtree,N);a.bl_desc=new c(a.bl_tree,O);a.bi_buf=0;a.bi_valid=0;g(a)};e._tr_stored_block=J;e._tr_flush_block=function(a,c,d,e){var f=0;if(0<a.level){2===a.strm.data_type&&(a.strm.data_type=x(a));B(a,
-a.l_desc);B(a,a.d_desc);I(a,a.dyn_ltree,a.l_desc.max_code);I(a,a.dyn_dtree,a.d_desc.max_code);B(a,a.bl_desc);for(f=18;3<=f&&0===a.bl_tree[2*H[f]+1];f--);a.opt_len+=3*(f+1)+14;var l=a.opt_len+3+7>>>3;var k=a.static_len+3+7>>>3;k<=l&&(l=k)}else l=k=d+5;if(d+4<=l&&-1!==c)J(a,c,d,e);else if(4===a.strategy||k===l)b(a,2+(e?1:0),3),h(a,q,G);else{b(a,4+(e?1:0),3);c=a.l_desc.max_code+1;d=a.d_desc.max_code+1;f+=1;b(a,c-257,5);b(a,d-1,5);b(a,f-4,4);for(l=0;l<f;l++)b(a,a.bl_tree[2*H[l]+1],3);u(a,a.dyn_ltree,
-c-1);u(a,a.dyn_dtree,d-1);h(a,a.dyn_ltree,a.dyn_dtree)}g(a);e&&r(a)};e._tr_tally=function(a,b,c){a.pending_buf[a.d_buf+2*a.last_lit]=b>>>8&255;a.pending_buf[a.d_buf+2*a.last_lit+1]=b&255;a.pending_buf[a.l_buf+a.last_lit]=c&255;a.last_lit++;0===b?a.dyn_ltree[2*c]++:(a.matches++,b--,a.dyn_ltree[2*(K[c]+256+1)]++,a.dyn_dtree[2*(256>b?L[b]:L[256+(b>>>7)])]++);return a.last_lit===a.lit_bufsize-1};e._tr_align=function(c){b(c,2,3);d(c,256,q);16===c.bi_valid?(a(c,c.bi_buf),c.bi_buf=0,c.bi_valid=0):8<=c.bi_valid&&
-(c.pending_buf[c.pending++]=c.bi_buf&255,c.bi_buf>>=8,c.bi_valid-=8)}},function(p,e,m){function k(b){if(!(this instanceof k))return new k(b);var e=this.options=a.assign({chunkSize:16384,windowBits:0,to:""},b||{});e.raw&&0<=e.windowBits&&16>e.windowBits&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15));!(0<=e.windowBits&&16>e.windowBits)||b&&b.windowBits||(e.windowBits+=32);15<e.windowBits&&48>e.windowBits&&0===(e.windowBits&15)&&(e.windowBits|=15);this.err=0;this.msg="";this.ended=
-!1;this.chunks=[];this.strm=new l;this.strm.avail_out=0;b=c.inflateInit2(this.strm,e.windowBits);if(b!==d.Z_OK)throw Error(n[b]);this.header=new g;c.inflateGetHeader(this.strm,this.header)}function f(a,b){b=new k(b);b.push(a,!0);if(b.err)throw b.msg||n[b.err];return b.result}var c=m(108),a=m(6),b=m(48),d=m(50),n=m(28),l=m(49),g=m(111),r=Object.prototype.toString;k.prototype.push=function(e,g){var f=this.strm,l=this.options.chunkSize,k=this.options.dictionary,m=!1;if(this.ended)return!1;g=g===~~g?
-g:!0===g?d.Z_FINISH:d.Z_NO_FLUSH;"string"===typeof e?f.input=b.binstring2buf(e):"[object ArrayBuffer]"===r.call(e)?f.input=new Uint8Array(e):f.input=e;f.next_in=0;f.avail_in=f.input.length;do{0===f.avail_out&&(f.output=new a.Buf8(l),f.next_out=0,f.avail_out=l);e=c.inflate(f,d.Z_NO_FLUSH);e===d.Z_NEED_DICT&&k&&(e="string"===typeof k?b.string2buf(k):"[object ArrayBuffer]"===r.call(k)?new Uint8Array(k):k,e=c.inflateSetDictionary(this.strm,e));e===d.Z_BUF_ERROR&&!0===m&&(e=d.Z_OK,m=!1);if(e!==d.Z_STREAM_END&&
-e!==d.Z_OK)return this.onEnd(e),this.ended=!0,!1;if(f.next_out&&(0===f.avail_out||e===d.Z_STREAM_END||0===f.avail_in&&(g===d.Z_FINISH||g===d.Z_SYNC_FLUSH)))if("string"===this.options.to){var n=b.utf8border(f.output,f.next_out);var p=f.next_out-n;var v=b.buf2string(f.output,n);f.next_out=p;f.avail_out=l-p;p&&a.arraySet(f.output,f.output,n,p,0);this.onData(v)}else this.onData(a.shrinkBuf(f.output,f.next_out));0===f.avail_in&&0===f.avail_out&&(m=!0)}while((0<f.avail_in||0===f.avail_out)&&e!==d.Z_STREAM_END);
-e===d.Z_STREAM_END&&(g=d.Z_FINISH);if(g===d.Z_FINISH)return e=c.inflateEnd(this.strm),this.onEnd(e),this.ended=!0,e===d.Z_OK;g===d.Z_SYNC_FLUSH&&(this.onEnd(d.Z_OK),f.avail_out=0);return!0};k.prototype.onData=function(a){this.chunks.push(a)};k.prototype.onEnd=function(b){b===d.Z_OK&&(this.result="string"===this.options.to?this.chunks.join(""):a.flattenChunks(this.chunks));this.chunks=[];this.err=b;this.msg=this.strm.msg};e.Inflate=k;e.inflate=f;e.inflateRaw=function(a,b){b=b||{};b.raw=!0;return f(a,
-b)};e.ungzip=f},function(p,e,m){function k(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}function f(){this.mode=0;this.last=!1;this.wrap=0;this.havedict=!1;this.total=this.check=this.dmax=this.flags=0;this.head=null;this.wnext=this.whave=this.wsize=this.wbits=0;this.window=null;this.extra=this.offset=this.length=this.bits=this.hold=0;this.distcode=this.lencode=null;this.have=this.ndist=this.nlen=this.ncode=this.distbits=this.lenbits=0;this.next=null;this.lens=new l.Buf16(320);this.work=
-new l.Buf16(288);this.distdyn=this.lendyn=null;this.was=this.back=this.sane=0}function c(a){if(!a||!a.state)return-2;var b=a.state;a.total_in=a.total_out=b.total=0;a.msg="";b.wrap&&(a.adler=b.wrap&1);b.mode=1;b.last=0;b.havedict=0;b.dmax=32768;b.head=null;b.hold=0;b.bits=0;b.lencode=b.lendyn=new l.Buf32(852);b.distcode=b.distdyn=new l.Buf32(592);b.sane=1;b.back=-1;return 0}function a(a){if(!a||!a.state)return-2;var b=a.state;b.wsize=0;b.whave=0;b.wnext=0;return c(a)}function b(b,c){if(!b||!b.state)return-2;
-var d=b.state;if(0>c){var e=0;c=-c}else e=(c>>4)+1,48>c&&(c&=15);if(c&&(8>c||15<c))return-2;null!==d.window&&d.wbits!==c&&(d.window=null);d.wrap=e;d.wbits=c;return a(b)}function d(a,c){if(!a)return-2;var d=new f;a.state=d;d.window=null;c=b(a,c);0!==c&&(a.state=null);return c}function n(a,b,c,d){var e=a.state;null===e.window&&(e.wsize=1<<e.wbits,e.wnext=0,e.whave=0,e.window=new l.Buf8(e.wsize));d>=e.wsize?(l.arraySet(e.window,b,c-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(a=e.wsize-e.wnext,a>d&&
-(a=d),l.arraySet(e.window,b,c-d,a,e.wnext),(d-=a)?(l.arraySet(e.window,b,c-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 l=m(6),g=m(46),r=m(47),C=m(109),w=m(110),h=!0,B,I;e.inflateReset=a;e.inflateReset2=b;e.inflateResetKeep=c;e.inflateInit=function(a){return d(a,15)};e.inflateInit2=d;e.inflate=function(a,b){var c,d=new l.Buf8(4),e=[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;var f=a.state;12===f.mode&&(f.mode=13);var m=a.next_out;var p=a.output;var q=a.avail_out;var u=a.next_in;var x=a.input;var K=a.avail_in;var D=f.hold;var E=f.bits;var Q=K;var N=q;var O=0;a:for(;;)switch(f.mode){case 1:if(0===f.wrap){f.mode=13;break}for(;16>E;){if(0===K)break a;K--;D+=x[u++]<<E;E+=8}if(f.wrap&2&&35615===D){f.check=0;d[0]=D&255;d[1]=D>>>8&255;f.check=r(f.check,d,2,0);E=D=0;f.mode=2;break}f.flags=0;f.head&&(f.head.done=!1);if(!(f.wrap&1)||(((D&255)<<8)+(D>>8))%31){a.msg=
-"incorrect header check";f.mode=30;break}if(8!==(D&15)){a.msg="unknown compression method";f.mode=30;break}D>>>=4;E-=4;var F=(D&15)+8;if(0===f.wbits)f.wbits=F;else if(F>f.wbits){a.msg="invalid window size";f.mode=30;break}f.dmax=1<<F;a.adler=f.check=1;f.mode=D&512?10:12;E=D=0;break;case 2:for(;16>E;){if(0===K)break a;K--;D+=x[u++]<<E;E+=8}f.flags=D;if(8!==(f.flags&255)){a.msg="unknown compression method";f.mode=30;break}if(f.flags&57344){a.msg="unknown header flags set";f.mode=30;break}f.head&&(f.head.text=
-D>>8&1);f.flags&512&&(d[0]=D&255,d[1]=D>>>8&255,f.check=r(f.check,d,2,0));E=D=0;f.mode=3;case 3:for(;32>E;){if(0===K)break a;K--;D+=x[u++]<<E;E+=8}f.head&&(f.head.time=D);f.flags&512&&(d[0]=D&255,d[1]=D>>>8&255,d[2]=D>>>16&255,d[3]=D>>>24&255,f.check=r(f.check,d,4,0));E=D=0;f.mode=4;case 4:for(;16>E;){if(0===K)break a;K--;D+=x[u++]<<E;E+=8}f.head&&(f.head.xflags=D&255,f.head.os=D>>8);f.flags&512&&(d[0]=D&255,d[1]=D>>>8&255,f.check=r(f.check,d,2,0));E=D=0;f.mode=5;case 5:if(f.flags&1024){for(;16>E;){if(0===
-K)break a;K--;D+=x[u++]<<E;E+=8}f.length=D;f.head&&(f.head.extra_len=D);f.flags&512&&(d[0]=D&255,d[1]=D>>>8&255,f.check=r(f.check,d,2,0));E=D=0}else f.head&&(f.head.extra=null);f.mode=6;case 6:if(f.flags&1024){var y=f.length;y>K&&(y=K);y&&(f.head&&(F=f.head.extra_len-f.length,f.head.extra||(f.head.extra=Array(f.head.extra_len)),l.arraySet(f.head.extra,x,u,y,F)),f.flags&512&&(f.check=r(f.check,x,y,u)),K-=y,u+=y,f.length-=y);if(f.length)break a}f.length=0;f.mode=7;case 7:if(f.flags&2048){if(0===K)break a;
-y=0;do F=x[u+y++],f.head&&F&&65536>f.length&&(f.head.name+=String.fromCharCode(F));while(F&&y<K);f.flags&512&&(f.check=r(f.check,x,y,u));K-=y;u+=y;if(F)break a}else f.head&&(f.head.name=null);f.length=0;f.mode=8;case 8:if(f.flags&4096){if(0===K)break a;y=0;do F=x[u+y++],f.head&&F&&65536>f.length&&(f.head.comment+=String.fromCharCode(F));while(F&&y<K);f.flags&512&&(f.check=r(f.check,x,y,u));K-=y;u+=y;if(F)break a}else f.head&&(f.head.comment=null);f.mode=9;case 9:if(f.flags&512){for(;16>E;){if(0===
-K)break a;K--;D+=x[u++]<<E;E+=8}if(D!==(f.check&65535)){a.msg="header crc mismatch";f.mode=30;break}E=D=0}f.head&&(f.head.hcrc=f.flags>>9&1,f.head.done=!0);a.adler=f.check=0;f.mode=12;break;case 10:for(;32>E;){if(0===K)break a;K--;D+=x[u++]<<E;E+=8}a.adler=f.check=k(D);E=D=0;f.mode=11;case 11:if(0===f.havedict)return a.next_out=m,a.avail_out=q,a.next_in=u,a.avail_in=K,f.hold=D,f.bits=E,2;a.adler=f.check=1;f.mode=12;case 12:if(5===b||6===b)break a;case 13:if(f.last){D>>>=E&7;E-=E&7;f.mode=27;break}for(;3>
-E;){if(0===K)break a;K--;D+=x[u++]<<E;E+=8}f.last=D&1;D>>>=1;--E;switch(D&3){case 0:f.mode=14;break;case 1:F=f;if(h){B=new l.Buf32(512);I=new l.Buf32(32);for(y=0;144>y;)F.lens[y++]=8;for(;256>y;)F.lens[y++]=9;for(;280>y;)F.lens[y++]=7;for(;288>y;)F.lens[y++]=8;w(1,F.lens,0,288,B,0,F.work,{bits:9});for(y=0;32>y;)F.lens[y++]=5;w(2,F.lens,0,32,I,0,F.work,{bits:5});h=!1}F.lencode=B;F.lenbits=9;F.distcode=I;F.distbits=5;f.mode=20;if(6===b){D>>>=2;E-=2;break a}break;case 2:f.mode=17;break;case 3:a.msg=
-"invalid block type",f.mode=30}D>>>=2;E-=2;break;case 14:D>>>=E&7;for(E-=E&7;32>E;){if(0===K)break a;K--;D+=x[u++]<<E;E+=8}if((D&65535)!==(D>>>16^65535)){a.msg="invalid stored block lengths";f.mode=30;break}f.length=D&65535;E=D=0;f.mode=15;if(6===b)break a;case 15:f.mode=16;case 16:if(y=f.length){y>K&&(y=K);y>q&&(y=q);if(0===y)break a;l.arraySet(p,x,u,y,m);K-=y;u+=y;q-=y;m+=y;f.length-=y;break}f.mode=12;break;case 17:for(;14>E;){if(0===K)break a;K--;D+=x[u++]<<E;E+=8}f.nlen=(D&31)+257;D>>>=5;E-=5;
-f.ndist=(D&31)+1;D>>>=5;E-=5;f.ncode=(D&15)+4;D>>>=4;E-=4;if(286<f.nlen||30<f.ndist){a.msg="too many length or distance symbols";f.mode=30;break}f.have=0;f.mode=18;case 18:for(;f.have<f.ncode;){for(;3>E;){if(0===K)break a;K--;D+=x[u++]<<E;E+=8}f.lens[e[f.have++]]=D&7;D>>>=3;E-=3}for(;19>f.have;)f.lens[e[f.have++]]=0;f.lencode=f.lendyn;f.lenbits=7;y={bits:f.lenbits};O=w(0,f.lens,0,19,f.lencode,0,f.work,y);f.lenbits=y.bits;if(O){a.msg="invalid code lengths set";f.mode=30;break}f.have=0;f.mode=19;case 19:for(;f.have<
-f.nlen+f.ndist;){for(;;){var M=f.lencode[D&(1<<f.lenbits)-1];y=M>>>24;M&=65535;if(y<=E)break;if(0===K)break a;K--;D+=x[u++]<<E;E+=8}if(16>M)D>>>=y,E-=y,f.lens[f.have++]=M;else{if(16===M){for(F=y+2;E<F;){if(0===K)break a;K--;D+=x[u++]<<E;E+=8}D>>>=y;E-=y;if(0===f.have){a.msg="invalid bit length repeat";f.mode=30;break}F=f.lens[f.have-1];y=3+(D&3);D>>>=2;E-=2}else if(17===M){for(F=y+3;E<F;){if(0===K)break a;K--;D+=x[u++]<<E;E+=8}D>>>=y;E-=y;F=0;y=3+(D&7);D>>>=3;E-=3}else{for(F=y+7;E<F;){if(0===K)break a;
-K--;D+=x[u++]<<E;E+=8}D>>>=y;E-=y;F=0;y=11+(D&127);D>>>=7;E-=7}if(f.have+y>f.nlen+f.ndist){a.msg="invalid bit length repeat";f.mode=30;break}for(;y--;)f.lens[f.have++]=F}}if(30===f.mode)break;if(0===f.lens[256]){a.msg="invalid code -- missing end-of-block";f.mode=30;break}f.lenbits=9;y={bits:f.lenbits};O=w(1,f.lens,0,f.nlen,f.lencode,0,f.work,y);f.lenbits=y.bits;if(O){a.msg="invalid literal/lengths set";f.mode=30;break}f.distbits=6;f.distcode=f.distdyn;y={bits:f.distbits};O=w(2,f.lens,f.nlen,f.ndist,
-f.distcode,0,f.work,y);f.distbits=y.bits;if(O){a.msg="invalid distances set";f.mode=30;break}f.mode=20;if(6===b)break a;case 20:f.mode=21;case 21:if(6<=K&&258<=q){a.next_out=m;a.avail_out=q;a.next_in=u;a.avail_in=K;f.hold=D;f.bits=E;C(a,N);m=a.next_out;p=a.output;q=a.avail_out;u=a.next_in;x=a.input;K=a.avail_in;D=f.hold;E=f.bits;12===f.mode&&(f.back=-1);break}for(f.back=0;;){M=f.lencode[D&(1<<f.lenbits)-1];y=M>>>24;F=M>>>16&255;M&=65535;if(y<=E)break;if(0===K)break a;K--;D+=x[u++]<<E;E+=8}if(F&&0===
-(F&240)){var R=y;var X=F;for(c=M;;){M=f.lencode[c+((D&(1<<R+X)-1)>>R)];y=M>>>24;F=M>>>16&255;M&=65535;if(R+y<=E)break;if(0===K)break a;K--;D+=x[u++]<<E;E+=8}D>>>=R;E-=R;f.back+=R}D>>>=y;E-=y;f.back+=y;f.length=M;if(0===F){f.mode=26;break}if(F&32){f.back=-1;f.mode=12;break}if(F&64){a.msg="invalid literal/length code";f.mode=30;break}f.extra=F&15;f.mode=22;case 22:if(f.extra){for(F=f.extra;E<F;){if(0===K)break a;K--;D+=x[u++]<<E;E+=8}f.length+=D&(1<<f.extra)-1;D>>>=f.extra;E-=f.extra;f.back+=f.extra}f.was=
-f.length;f.mode=23;case 23:for(;;){M=f.distcode[D&(1<<f.distbits)-1];y=M>>>24;F=M>>>16&255;M&=65535;if(y<=E)break;if(0===K)break a;K--;D+=x[u++]<<E;E+=8}if(0===(F&240)){R=y;X=F;for(c=M;;){M=f.distcode[c+((D&(1<<R+X)-1)>>R)];y=M>>>24;F=M>>>16&255;M&=65535;if(R+y<=E)break;if(0===K)break a;K--;D+=x[u++]<<E;E+=8}D>>>=R;E-=R;f.back+=R}D>>>=y;E-=y;f.back+=y;if(F&64){a.msg="invalid distance code";f.mode=30;break}f.offset=M;f.extra=F&15;f.mode=24;case 24:if(f.extra){for(F=f.extra;E<F;){if(0===K)break a;K--;
-D+=x[u++]<<E;E+=8}f.offset+=D&(1<<f.extra)-1;D>>>=f.extra;E-=f.extra;f.back+=f.extra}if(f.offset>f.dmax){a.msg="invalid distance too far back";f.mode=30;break}f.mode=25;case 25:if(0===q)break a;y=N-q;if(f.offset>y){y=f.offset-y;if(y>f.whave&&f.sane){a.msg="invalid distance too far back";f.mode=30;break}y>f.wnext?(y-=f.wnext,F=f.wsize-y):F=f.wnext-y;y>f.length&&(y=f.length);R=f.window}else R=p,F=m-f.offset,y=f.length;y>q&&(y=q);q-=y;f.length-=y;do p[m++]=R[F++];while(--y);0===f.length&&(f.mode=21);
-break;case 26:if(0===q)break a;p[m++]=f.length;q--;f.mode=21;break;case 27:if(f.wrap){for(;32>E;){if(0===K)break a;K--;D|=x[u++]<<E;E+=8}N-=q;a.total_out+=N;f.total+=N;N&&(a.adler=f.check=f.flags?r(f.check,p,N,m-N):g(f.check,p,N,m-N));N=q;if((f.flags?D:k(D))!==f.check){a.msg="incorrect data check";f.mode=30;break}E=D=0}f.mode=28;case 28:if(f.wrap&&f.flags){for(;32>E;){if(0===K)break a;K--;D+=x[u++]<<E;E+=8}if(D!==(f.total&4294967295)){a.msg="incorrect length check";f.mode=30;break}E=D=0}f.mode=29;
-case 29:O=1;break a;case 30:O=-3;break a;case 31:return-4;default:return-2}a.next_out=m;a.avail_out=q;a.next_in=u;a.avail_in=K;f.hold=D;f.bits=E;if((f.wsize||N!==a.avail_out&&30>f.mode&&(27>f.mode||4!==b))&&n(a,a.output,a.next_out,N-a.avail_out))return f.mode=31,-4;Q-=a.avail_in;N-=a.avail_out;a.total_in+=Q;a.total_out+=N;f.total+=N;f.wrap&&N&&(a.adler=f.check=f.flags?r(f.check,p,N,a.next_out-N):g(f.check,p,N,a.next_out-N));a.data_type=f.bits+(f.last?64:0)+(12===f.mode?128:0)+(20===f.mode||15===f.mode?
-256:0);(0===Q&&0===N||4===b)&&0===O&&(O=-5);return O};e.inflateEnd=function(a){if(!a||!a.state)return-2;var b=a.state;b.window&&(b.window=null);a.state=null;return 0};e.inflateGetHeader=function(a,b){if(!a||!a.state)return-2;a=a.state;if(0===(a.wrap&2))return-2;a.head=b;b.done=!1;return 0};e.inflateSetDictionary=function(a,b){var c=b.length;if(!a||!a.state)return-2;var d=a.state;if(0!==d.wrap&&11!==d.mode)return-2;if(11===d.mode){var f=g(1,b,c,0);if(f!==d.check)return-3}if(n(a,b,c,c))return d.mode=
-31,-4;d.havedict=1;return 0};e.inflateInfo="pako inflate (from Nodeca project)"},function(p,e,m){p.exports=function(e,f){var c=e.state;var a=e.next_in;var b=e.input;var d=a+(e.avail_in-5);var k=e.next_out;var l=e.output;f=k-(f-e.avail_out);var g=k+(e.avail_out-257);var m=c.dmax;var p=c.wsize;var w=c.whave;var h=c.wnext;var B=c.window;var I=c.hold;var u=c.bits;var x=c.lencode;var J=c.distcode;var v=(1<<c.lenbits)-1;var A=(1<<c.distbits)-1;a:do{15>u&&(I+=b[a++]<<u,u+=8,I+=b[a++]<<u,u+=8);var t=x[I&
-v];b:for(;;){var z=t>>>24;I>>>=z;u-=z;z=t>>>16&255;if(0===z)l[k++]=t&65535;else if(z&16){var H=t&65535;if(z&=15)u<z&&(I+=b[a++]<<u,u+=8),H+=I&(1<<z)-1,I>>>=z,u-=z;15>u&&(I+=b[a++]<<u,u+=8,I+=b[a++]<<u,u+=8);t=J[I&A];c:for(;;){z=t>>>24;I>>>=z;u-=z;z=t>>>16&255;if(z&16){t&=65535;z&=15;u<z&&(I+=b[a++]<<u,u+=8,u<z&&(I+=b[a++]<<u,u+=8));t+=I&(1<<z)-1;if(t>m){e.msg="invalid distance too far back";c.mode=30;break a}I>>>=z;u-=z;z=k-f;if(t>z){z=t-z;if(z>w&&c.sane){e.msg="invalid distance too far back";c.mode=
-30;break a}var q=0;var G=B;if(0===h){if(q+=p-z,z<H){H-=z;do l[k++]=B[q++];while(--z);q=k-t;G=l}}else if(h<z){if(q+=p+h-z,z-=h,z<H){H-=z;do l[k++]=B[q++];while(--z);q=0;if(h<H){z=h;H-=z;do l[k++]=B[q++];while(--z);q=k-t;G=l}}}else if(q+=h-z,z<H){H-=z;do l[k++]=B[q++];while(--z);q=k-t;G=l}for(;2<H;)l[k++]=G[q++],l[k++]=G[q++],l[k++]=G[q++],H-=3;H&&(l[k++]=G[q++],1<H&&(l[k++]=G[q++]))}else{q=k-t;do l[k++]=l[q++],l[k++]=l[q++],l[k++]=l[q++],H-=3;while(2<H);H&&(l[k++]=l[q++],1<H&&(l[k++]=l[q++]))}}else if(0===
-(z&64)){t=J[(t&65535)+(I&(1<<z)-1)];continue c}else{e.msg="invalid distance code";c.mode=30;break a}break}}else if(0===(z&64)){t=x[(t&65535)+(I&(1<<z)-1)];continue b}else{z&32?c.mode=12:(e.msg="invalid literal/length code",c.mode=30);break a}break}}while(a<d&&k<g);H=u>>3;a-=H;u-=H<<3;e.next_in=a;e.next_out=k;e.avail_in=a<d?5+(d-a):5-(a-d);e.avail_out=k<g?257+(g-k):257-(k-g);c.hold=I&(1<<u)-1;c.bits=u}},function(p,e,m){var k=m(6),f=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,
-131,163,195,227,258,0,0],c=[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],a=[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],b=[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];p.exports=function(d,e,l,g,m,p,w,h){var n=h.bits,r,u,x,C,v,A,t=0,z=new k.Buf16(16);var H=new k.Buf16(16);var q,G=0;for(r=0;15>=r;r++)z[r]=0;for(u=0;u<g;u++)z[e[l+
-u]]++;var L=n;for(x=15;1<=x&&0===z[x];x--);L>x&&(L=x);if(0===x)return m[p++]=20971520,m[p++]=20971520,h.bits=1,0;for(n=1;n<x&&0===z[n];n++);L<n&&(L=n);for(r=C=1;15>=r;r++)if(C<<=1,C-=z[r],0>C)return-1;if(0<C&&(0===d||1!==x))return-1;H[1]=0;for(r=1;15>r;r++)H[r+1]=H[r]+z[r];for(u=0;u<g;u++)0!==e[l+u]&&(w[H[e[l+u]]++]=u);if(0===d){var K=q=w;var D=19}else 1===d?(K=f,t-=257,q=c,G-=257,D=256):(K=a,q=b,D=-1);u=v=0;r=n;var E=p;g=L;H=0;var Q=-1;var N=1<<L;var O=N-1;if(1===d&&852<N||2===d&&592<N)return 1;
-for(;;){var F=r-H;if(w[u]<D){var y=0;var M=w[u]}else w[u]>D?(y=q[G+w[u]],M=K[t+w[u]]):(y=96,M=0);C=1<<r-H;n=A=1<<g;do A-=C,m[E+(v>>H)+A]=F<<24|y<<16|M|0;while(0!==A);for(C=1<<r-1;v&C;)C>>=1;0!==C?(v&=C-1,v+=C):v=0;u++;if(0===--z[r]){if(r===x)break;r=e[l+w[u]]}if(r>L&&(v&O)!==Q){0===H&&(H=L);E+=n;g=r-H;for(C=1<<g;g+H<x;){C-=z[g+H];if(0>=C)break;g++;C<<=1}N+=1<<g;if(1===d&&852<N||2===d&&592<N)return 1;Q=v&O;m[Q]=L<<24|g<<16|E-p|0}}0!==v&&(m[E+v]=r-H<<24|4194304);h.bits=L;return 0}},function(p,e,m){p.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(p,e,m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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 c(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){var c=(new DataView(b)).getUint32(0,!0);Object(d.d)(a,b,C.b.LITTLE,4,c)}Object.defineProperty(e,"__esModule",{value:!0});m.d(e,"DVIDSkeletonSource",function(){return I});e.decodeFragmentChunk=a;m.d(e,"DVIDMeshSource",function(){return u});m.d(e,"DVIDVolumeChunkSource",function(){return x});p=m(2);var b=
-m(113),d=m(17);e=m(43);var n=m(114),l=m(25),g=m(18),r=m(16),C=m(11),w=m(15);m=m(0);var h=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),B=this&&this.__decorate||function(a,b,c,d){var e=arguments.length,f=3>e?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,g;if("object"===typeof Reflect&&"function"===
-typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var h=a.length-1;0<=h;h--)if(g=a[h])f=(3>e?g(f):3<e?g(b,c,f):g(b,c))||f;return 3<e&&f&&Object.defineProperty(b,c,f),f},I=function(a){function b(){k(this,b);return f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}c(b,a);h(b,[{key:"download",value:function(a,b){var c=this.parameters;return Object(w.e)(Object(w.c)(c.baseUrls,"/api/node/"+c.nodeKey+"/"+c.dataInstanceKey+"/key/"+(""+a.objectId)+"_swc"),"arraybuffer",b).then(function(b){var c=
-new TextDecoder("utf-8");Object(n.a)(a,c.decode(b))})}}]);return b}(Object(p.WithParameters)(e.a,b.b));I=B([Object(m.g)()],I);var u=function(b){function d(){k(this,d);return f(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}c(d,b);h(d,[{key:"download",value:function(a){a.fragmentIds=[""+a.objectId];return Promise.resolve(void 0)}},{key:"downloadFragment",value:function(b,c){var d=this.parameters;return Object(w.e)(Object(w.c)(d.baseUrls,"/api/node/"+d.nodeKey+"/"+d.dataInstanceKey+
-"/key/"+b.fragmentId+".ngmesh"),"arraybuffer",c).then(function(c){return a(b,c)})}}]);return d}(Object(p.WithParameters)(d.a,b.a));u=B([Object(m.g)()],u);var x=function(a){function d(){k(this,d);return f(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}c(d,a);h(d,[{key:"download",value:function(a,c){var d=this.parameters;var e=this.computeChunkBounds(a);e=this.getPath(e,a.chunkDataSize);var f=this.getDecoder(d);return Object(w.e)(Object(w.c)(d.baseUrls,e),"arraybuffer",c).then(function(c){return f(a,
-d.encoding===b.c.JPEG?c.slice(16):c)})}},{key:"getPath",value:function(a,c){var d=this.parameters;return d.encoding===b.c.JPEG?"/api/node/"+d.nodeKey+"/"+d.dataInstanceKey+"/subvolblocks/"+(c[0]+"_"+c[1]+"_"+c[2]+"/")+(a[0]+"_"+a[1]+"_"+a[2]):d.encoding===b.c.RAW?"/api/node/"+d.nodeKey+"/"+d.dataInstanceKey+"/raw/0_1_2/"+(c[0]+"_"+c[1]+"_"+c[2]+"/")+(a[0]+"_"+a[1]+"_"+a[2]+"/jpeg"):d.encoding===b.c.COMPRESSED_SEGMENTATIONARRAY?"/api/node/"+d.nodeKey+"/"+d.dataInstanceKey+"/raw/0_1_2/"+(c[0]+"_"+c[1]+
-"_"+c[2]+"/")+(a[0]+"_"+a[1]+"_"+a[2]+"?compression=googlegzip&scale="+d.dataScale):"/api/node/"+d.nodeKey+"/"+d.dataInstanceKey+"/raw/0_1_2/"+(c[0]+"_"+c[1]+"_"+c[2]+"/")+(a[0]+"_"+a[1]+"_"+a[2]+"?compression=googlegzip")}},{key:"getDecoder",value:function(a){return a.encoding===b.c.JPEG||a.encoding===b.c.RAW?g.a:l.a}}]);return d}(Object(p.WithParameters)(r.a,b.d));x=B([Object(m.g)()],x)},function(p,e,m){function k(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 f(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){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}m.d(e,"c",function(){return a});m.d(e,
-"d",function(){return b});m.d(e,"b",function(){return d});m.d(e,"a",function(){return n});var a;(function(a){a[a.JPEG=0]="JPEG";a[a.RAW=1]="RAW";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION";a[a.COMPRESSED_SEGMENTATIONARRAY=3]="COMPRESSED_SEGMENTATIONARRAY"})(a||(a={}));p=function g(){c(this,g)};var b=function(a){function b(){c(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}f(b,a);return b}(p);b.RPC_ID="dvid/VolumeChunkSource";var d=function(a){function b(){c(this,
-b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}f(b,a);return b}(p);d.RPC_ID="dvid/SkeletonSource";var n=function(a){function b(){c(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}f(b,a);return b}(p);n.RPC_ID="dvid/MeshSource"},function(p,e,m){function k(c){var a=[],b=/^[ \t]*(\d+)[ \t]+(\d+)[ \t]+(-?\d*(?:\.\d+)?)[ \t]+(-?\d*(?:\.\d+)?)[ \t]+(-?\d*(?:\.\d+)?)[ \t]+(-?\d*(?:\.\d+)?)[ \t]+(-1|\d+)[ \t]*$/;c.split("\n").forEach(function(c){if(c=
-c.match(b)){var d=a[parseInt(c[1],10)-1]=new f;d.type=parseInt(c[2],10);d.x=parseFloat(c[3]);d.y=parseFloat(c[4]);d.z=parseFloat(c[5]);d.radius=parseFloat(c[6]);d.parent=parseInt(c[7],10)-1}});return a}e.a=function(c,a){a=k(a);if(2>a.length)throw Error("ERROR parsing swc file");var b=new Float32Array(3*a.length),d=new Uint32Array(2*(a.length-1));a.forEach(function(a,c){b[3*c]=a.z;b[3*c+1]=a.y;b[3*c+2]=a.x;-1!==a.parent&&(d[2*(c-1)]=c,d[2*c-1]=a.parent)});c.indices=d;c.vertexPositions=b};var f=function a(){if(!(this instanceof
-a))throw new TypeError("Cannot call a class as a function");}},function(p,e,m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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 c(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&
-b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a){var b=[];Object(I.a)(a,function(a){Object(I.i)(a);b.push(Object(I.l)(a.sectionId))});return b}function b(a,b,c){return Object(B.d)(Object(B.c)(b.baseUrls,"/render-ws/v1/owner/"+b.owner+"/project/"+b.project+"/"+("stack/"+b.stack+"/local-to-world-coordinates"),"PUT"),a,"json",c)}function d(a,c,d,e){var f=[];Object(I.a)(c,function(a){var b=
-Object(I.l)(a.pId),c=Object(I.l)(a.qId),d=Object(I.i)(a.matches);a=d.p;d=d.q;for(var e=0;e<a[0].length;e++)f.push({tileId:b,local:[a[0][e],a[1][e]]}),f.push({tileId:c,local:[d[0][e],d[1][e]]})});return b(f,d,e).then(function(b){for(var c=new w.a,d=0;d<b.length;d++){var e=Object(I.i)(b[d]);e=Object(I.g)(e.world);c.appendArray(e)}a.vertexPositions=c.view})}function n(a,b,c,e){if(1===b.length)b="/render-ws/v1/owner/"+c.owner+"/matchCollection/"+(c.matchCollection+"/group/"+b[0]+"/matchesWith/"+b[0]);
-else if(2===b.length)b="/render-ws/v1/owner/"+c.owner+"/matchCollection/"+(c.matchCollection+"/group/"+b[0]+"/matchesWith/"+b[1]);else throw Error("Invalid section Id vector of length: "+JSON.stringify(b.length));return Object(B.e)(Object(B.c)(c.baseUrls,b),"json",e).then(function(b){return d(a,b,c,e)})}function l(b,c,d,e){return Object(B.e)(Object(B.c)(d.baseUrls,c),"json",e).then(function(c){return n(b,a(c),d,e)})}Object.defineProperty(e,"__esModule",{value:!0});m.d(e,"TileChunkSource",function(){return v});
-m.d(e,"PointMatchSource",function(){return A});p=m(2);e=m(116);var g=m(18),r=m(117),C=m(16),w=m(119),h=m(1),B=m(15),I=m(3);m=m(0);var u=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),x=this&&this.__decorate||function(a,b,c,d){var e=arguments.length,f=3>e?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):
-d,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var h=a.length-1;0<=h;h--)if(g=a[h])f=(3>e?g(f):3<e?g(b,c,f):g(b,c))||f;return 3<e&&f&&Object.defineProperty(b,c,f),f},J=new Map;J.set("jpg",g.a);var v=function(a){function b(){k(this,b);var a=f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.chunkDecoder=J.get(a.parameters.encoding);var c=a.parameters;var d=[];void 0!==c.channel&&d.push("channels="+c.channel);void 0!==
-c.minIntensity&&d.push("minIntensity="+JSON.stringify(c.minIntensity));void 0!==c.maxIntensity&&d.push("maxIntensity="+JSON.stringify(c.maxIntensity));void 0!==c.maxTileSpecsToRender&&d.push("maxTileSpecsToRender="+JSON.stringify(c.maxTileSpecsToRender));void 0!==c.filter&&d.push("filter="+JSON.stringify(c.filter));c=d.join("&");a.queryString=c;return a}c(b,a);u(b,[{key:"download",value:function(a,b){var c=this,d=this.parameters,e=a.chunkGridPosition,f=1/Math.pow(2,d.level);a.chunkDataSize=this.spec.chunkDataSize;
-var g=a.chunkDataSize[0]*Math.pow(2,d.level),l=a.chunkDataSize[1]*Math.pow(2,d.level),k=h.m.create();k[0]=e[0]*g;k[1]=e[1]*l;k[2]=e[2];return Object(B.e)(Object(B.c)(d.baseUrls,"/render-ws/v1/owner/"+d.owner+"/project/"+d.project+"/stack/"+d.stack+"/z/"+k[2]+"/box/"+k[0]+","+k[1]+","+g+","+l+","+f+"/jpeg-image?"+this.queryString),"arraybuffer",b).then(function(b){return c.chunkDecoder(a,b)})}}]);return b}(Object(p.WithParameters)(C.a,e.b));v=x([Object(m.g)()],v);var A=function(a){function b(){k(this,
-b);return f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}c(b,a);u(b,[{key:"download",value:function(a,b){var c=this.parameters,d=a.chunkGridPosition;return l(a,"/render-ws/v1/owner/"+c.owner+"/project/"+c.project+"/"+("stack/"+c.stack+"/sectionData?minZ="+d[2]+"&")+("maxZ="+(d[2]+c.zoffset)),c,b)}}]);return b}(Object(p.WithParameters)(r.a,e.a));A=x([Object(m.g)()],A)},function(p,e,m){function k(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 f(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){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}m.d(e,"b",function(){return a});m.d(e,
-"a",function(){return b});p=function(a){function b(){c(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}f(b,a);return b}(function n(){c(this,n)});var a=function(a){function b(){c(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}f(b,a);return b}(p);a.RPC_ID="render/TileChunkSource";var b=function(a){function b(){c(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}f(b,a);return b}(p);b.RPC_ID=
-"render/PointMatchSource"},function(p,e,m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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 c(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,
-enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}m.d(e,"a",function(){return n});p=m(19);var a=m(118),b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),d=function g(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,
-b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return g(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};m=function(a){function e(){k(this,e);var a=f(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));a.source=null;a.vertexPositions=null;a.vertexNormals=null;return a}c(e,a);b(e,[{key:"initializeVolumeChunk",value:function(a,b){d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"initializeVolumeChunk",this).call(this,a,b);a=0;this.vertexPositions&&
-(a+=this.vertexPositions.buffer.byteLength);this.vertexNormals&&(a+=this.vertexNormals.buffer.byteLength);this.gpuMemoryBytes=this.systemMemoryBytes=a;this.vertexPositions=null}},{key:"serialize",value:function(a,b){d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"serialize",this).call(this,a,b);var c=this.vertexPositions,f=this.vertexNormals;a.vertexPositions=c;b.push(c.buffer);f&&(a.vertexNormals=f,b.push(f.buffer));this.vertexNormals=this.vertexPositions=null}},{key:"downloadSucceeded",
-value:function(){this.systemMemoryBytes=this.gpuMemoryBytes=this.vertexPositions.byteLength;d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"downloadSucceeded",this).call(this)}},{key:"freeSystemMemory",value:function(){this.vertexNormals=this.vertexPositions=null}}]);return e}(p.SliceViewChunk);var n=function(b){function d(b,c){k(this,d);b=f(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,c));b.spec=a.a.fromObject(c.spec);return b}c(d,b);return d}(p.SliceViewChunkSource);n.prototype.chunkConstructor=
-m},function(p,e,m){function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}m.d(e,"a",function(){return d});var f=m(9),c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in
-d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),a=function l(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return l(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},b;(function(a){a[a.LINE=0]="LINE";a[a.POINT=1]="POINT"})(b||(b={}));var d=function(b){function d(a){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");
-a=(d.__proto__||Object.getPrototypeOf(d)).call(this,a);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}k(d,b);c(d,[{key:"toObject",value:function(){return a(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"toObject",this).call(this)}}],[{key:"make",value:function(a){return new d(Object.assign({},a,{transform:Object(f.k)(a.transform,a.vectorGraphicsSourceOptions)}))}},{key:"fromObject",
-value:function(a){return new d(a)}}]);return d}(f.i)},function(p,e,m){m.d(e,"a",function(){return f});var k=function(){function c(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(a,b,d){b&&c(a.prototype,b);d&&c(a,d);return a}}(),f=function(){function c(a){a=void 0===a?16:a;if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.length=0;this.data=
-new Float32Array(a)}k(c,[{key:"resize",value:function(a){var b=this.data;if(a>b.length){var c=new Float32Array(Math.max(a,2*b.length));c.set(b.subarray(0,this.length));this.data=c}this.length=a}},{key:"shrinkToFit",value:function(){this.data=new Float32Array(this.view)}},{key:"clear",value:function(){this.length=0}},{key:"appendArray",value:function(a){var b=this.length;this.resize(b+a.length);this.data.set(a,b)}},{key:"eraseRange",value:function(a,b){this.data.copyWithin(a,b,this.length);this.length-=
-b-a}},{key:"view",get:function(){var a=this.data;return new Float32Array(a.buffer,a.byteOffset,this.length)}}]);return c}()},function(p,e,m){Object.defineProperty(e,"__esModule",{value:!0});m(45)},function(p,e,m){function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function f(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 c(a,b){if("function"!==
-typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){return Object(d.c)(a,b,"fragments")}function b(a,b){var c=(new DataView(b)).getUint32(0,!0);Object(d.d)(a,b,C.b.LITTLE,4,c)}Object.defineProperty(e,"__esModule",{value:!0});m.d(e,"PrecomputedVolumeChunkSource",
-function(){return u});e.decodeManifestChunk=a;e.decodeFragmentChunk=b;m.d(e,"PrecomputedMeshSource",function(){return x});p=m(2);e=m(122);var d=m(17),n=m(25),l=m(18),g=m(23),r=m(16),C=m(11),w=m(15);m=m(0);var h=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),B=this&&this.__decorate||function(a,b,c,d){var e=
-arguments.length,f=3>e?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var h=a.length-1;0<=h;h--)if(g=a[h])f=(3>e?g(f):3<e?g(b,c,f):g(b,c))||f;return 3<e&&f&&Object.defineProperty(b,c,f),f},I=new Map;I.set(e.b.RAW,g.a);I.set(e.b.JPEG,l.a);I.set(e.b.COMPRESSED_SEGMENTATION,n.a);var u=function(a){function b(){k(this,b);var a=f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));
-a.chunkDecoder=I.get(a.parameters.encoding);return a}c(b,a);h(b,[{key:"download",value:function(a,b){var c=this,d=this.parameters,e=this.computeChunkBounds(a),f=a.chunkDataSize;return Object(w.e)(Object(w.c)(d.baseUrls,d.path+"/"+e[0]+"-"+(e[0]+f[0])+"_"+(e[1]+"-"+(e[1]+f[1])+"_")+(e[2]+"-"+(e[2]+f[2]))),"arraybuffer",b).then(function(b){return c.chunkDecoder(a,b)})}}]);return b}(Object(p.WithParameters)(r.a,e.c));u=B([Object(m.g)()],u);var x=function(d){function e(){k(this,e);return f(this,(e.__proto__||
-Object.getPrototypeOf(e)).apply(this,arguments))}c(e,d);h(e,[{key:"download",value:function(b,c){var d=this.parameters;return Object(w.e)(Object(w.c)(d.baseUrls,d.path+"/"+b.objectId+":"+d.lod),"json",c).then(function(c){return a(b,c)})}},{key:"downloadFragment",value:function(a,c){var d=this.parameters;return Object(w.e)(Object(w.c)(d.baseUrls,d.path+"/"+a.fragmentId),"arraybuffer",c).then(function(c){return b(a,c)})}}]);return e}(Object(p.WithParameters)(d.a,e.a));x=B([Object(m.g)()],x)},function(p,
-e,m){function k(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}m.d(e,"b",function(){return f});m.d(e,"c",function(){return c});m.d(e,"a",function(){return a});var f;(function(a){a[a.RAW=0]="RAW";a[a.JPEG=1]="JPEG";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION"})(f||(f={}));var c=function d(){k(this,d)};c.RPC_ID="precomputed/VolumeChunkSource";var a=function n(){k(this,n)};a.RPC_ID="precomputed/MeshSource"},function(p,e,m){function k(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 f(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function c(a){Object(B.isCompressed)(a)&&(a=Object(B.decompress)(a));var b=new u;b.uncompressedData=a;a=Object(B.readHeader)(a);
-if(null===a)throw Error("Failed to parse NIFTI header.");b.header=a;return b}function a(a,b,d,e){return n.a.getData(a,c,b,d,e)}function b(b,c,e){return a(b,c,function(){return{priorityTier:d.d.VISIBLE,priority:1E3}},e).then(function(a){return a.header})}Object.defineProperty(e,"__esModule",{value:!0});m.d(e,"NiftiFileData",function(){return u});m.d(e,"NiftiVolumeChunkSource",function(){return J});p=m(2);var d=m(7),n=m(29),l=m(125),g=m(23);e=m(16);var r=m(44),C=m(11),w=m(1),h=m(0),B=m(126);m.n(B);
-var I=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();m=this&&this.__decorate||function(a,b,c,d){var e=arguments.length,f=3>e?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var h=a.length-1;0<=h;h--)if(g=
-a[h])f=(3>e?g(f):3<e?g(b,c,f):g(b,c))||f;return 3<e&&f&&Object.defineProperty(b,c,f),f};var u=function A(){f(this,A)},x=new Map([[l.b.INT8,{dataType:r.a.UINT8,volumeType:r.c.IMAGE}],[l.b.UINT8,{dataType:r.a.UINT8,volumeType:r.c.IMAGE}],[l.b.INT16,{dataType:r.a.UINT16,volumeType:r.c.IMAGE}],[l.b.UINT16,{dataType:r.a.UINT16,volumeType:r.c.IMAGE}],[l.b.INT32,{dataType:r.a.UINT32,volumeType:r.c.SEGMENTATION}],[l.b.UINT32,{dataType:r.a.UINT32,volumeType:r.c.SEGMENTATION}],[l.b.INT64,{dataType:r.a.UINT64,
-volumeType:r.c.SEGMENTATION}],[l.b.UINT64,{dataType:r.a.UINT64,volumeType:r.c.SEGMENTATION}],[l.b.FLOAT32,{dataType:r.a.FLOAT32,volumeType:r.c.IMAGE}]]);Object(h.e)(l.a,function(a,c){return b(this.getRef(a.chunkManager),a.url,c).then(function(a){var b=x.get(a.datatypeCode);if(void 0===b)throw Error("Unsupported data type: "+((l.b[a.datatypeCode]||a.datatypeCode)+"."));if(1!==a.dims[4])throw Error("Time series data not supported.");var c=1;switch(a.xyzt_units&B.NIFTI1.SPATIAL_UNITS_MASK){case B.NIFTI1.UNITS_METER:c=
-1E9;break;case B.NIFTI1.UNITS_MM:c=1E6;break;case B.NIFTI1.UNITS_MICRON:c=1E3}var d=a.quatern_b,e=a.quatern_c,f=a.quatern_d,g=Math.sqrt(1-d*d-e*e-f*f),h=-1===a.pixDims[0]?-1:1,k=a.description;var m=a.affine;m=w.h.fromValues(m[0][0],m[1][0],m[2][0],m[3][0],m[0][1],m[1][1],m[2][1],m[3][1],m[0][2],m[1][2],m[2][2],m[3][2],m[0][3],m[1][3],m[2][3],m[3][3]);return{value:{description:k,affine:m,dataType:b.dataType,numChannels:a.dims[5],volumeType:b.volumeType,voxelSize:w.m.fromValues(c*a.pixDims[1],c*a.pixDims[2],
-c*a.pixDims[3]),volumeSize:w.m.fromValues(a.dims[1],a.dims[2],a.dims[3]),qoffset:w.m.fromValues(c*a.qoffset_x,c*a.qoffset_y,c*a.qoffset_z),qform_code:a.qform_code,sform_code:a.sform_code,qfac:h,quatern:w.j.fromValues(d,e,f,g)}}})});var J=function(b){function c(){f(this,c);var a=(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}k(c,b);
-I(c,[{key:"download",value:function(b,c){b.chunkDataSize=this.spec.chunkDataSize;return a(this.chunkManager.addRef(),this.parameters.url,function(){return{priorityTier:b.priorityTier,priority:b.priority}},c).then(function(a){var c=Object(B.readImage)(a.header,a.uncompressedData);Object(g.a)(b,c,a.header.littleEndian?C.b.LITTLE:C.b.BIG)})}}]);return c}(Object(p.WithParameters)(e.a,l.c));J=m([Object(h.g)()],J)},function(p,e,m){e.a=function(c){if(c instanceof Object){var a=c[k];void 0===a&&(a=c[k]=f++);
-return"o"+a}return""+JSON.stringify(c)};$jscomp.initSymbol();var k=Symbol("objectId"),f=0},function(p,e,m){m.d(e,"b",function(){return k});m.d(e,"c",function(){return f});e.a="nifti/getNiftiVolumeInfo";var k;(function(c){c[c.NONE=0]="NONE";c[c.BINARY=1]="BINARY";c[c.UINT8=2]="UINT8";c[c.INT16=4]="INT16";c[c.INT32=8]="INT32";c[c.FLOAT32=16]="FLOAT32";c[c.COMPLEX64=32]="COMPLEX64";c[c.FLOAT64=64]="FLOAT64";c[c.RGB24=128]="RGB24";c[c.INT8=256]="INT8";c[c.UINT16=512]="UINT16";c[c.UINT32=768]="UINT32";
-c[c.INT64=1024]="INT64";c[c.UINT64=1280]="UINT64";c[c.FLOAT128=1536]="FLOAT128";c[c.COMPLEX128=1792]="COMPLEX128";c[c.COMPLEX256=2048]="COMPLEX256"})(k||(k={}));var f=function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");};f.RPC_ID="nifti/VolumeChunkSource"},function(p,e,m){var k=k||{};k.NIFTI1=k.NIFTI1||m(51);k.NIFTI2=k.NIFTI2||m(127);k.Utils=k.Utils||m(30);var f=f||m(27);k.isNIFTI1=function(c){if(c.byteLength<k.NIFTI1.STANDARD_HEADER_SIZE)return!1;var a=new DataView(c);
-c=a.getUint8(k.NIFTI1.MAGIC_NUMBER_LOCATION);var b=a.getUint8(k.NIFTI1.MAGIC_NUMBER_LOCATION+1);a=a.getUint8(k.NIFTI1.MAGIC_NUMBER_LOCATION+2);return!(c!==k.NIFTI1.MAGIC_NUMBER[0]||b!==k.NIFTI1.MAGIC_NUMBER[1]||a!==k.NIFTI1.MAGIC_NUMBER[2])};k.isNIFTI2=function(c){if(c.byteLength<k.NIFTI1.STANDARD_HEADER_SIZE)return!1;var a=new DataView(c);c=a.getUint8(k.NIFTI2.MAGIC_NUMBER_LOCATION);var b=a.getUint8(k.NIFTI2.MAGIC_NUMBER_LOCATION+1);a=a.getUint8(k.NIFTI2.MAGIC_NUMBER_LOCATION+2);return!(c!==k.NIFTI2.MAGIC_NUMBER[0]||
-b!==k.NIFTI2.MAGIC_NUMBER[1]||a!==k.NIFTI2.MAGIC_NUMBER[2])};k.isNIFTI=function(c){return k.isNIFTI1(c)||k.isNIFTI2(c)};k.isCompressed=function(c){if(c){var a=new DataView(c);c=a.getUint8(0);a=a.getUint8(1);if(c===k.Utils.GUNZIP_MAGIC_COOKIE1||a===k.Utils.GUNZIP_MAGIC_COOKIE2)return!0}return!1};k.decompress=function(c){return f.inflate(c).buffer};k.readHeader=function(c){var a=null;k.isCompressed(c)&&(c=k.decompress(c));k.isNIFTI1(c)?a=new k.NIFTI1:k.isNIFTI2(c)&&(a=new k.NIFTI2);a?a.readHeader(c):
-console.error("That file does not appear to be NIFTI!");return a};k.hasExtension=function(c){return 0!=c.extensionFlag[0]};k.readImage=function(c,a){var b=c.vox_offset,d=1,e=1;c.dims[4]&&(d=c.dims[4]);c.dims[5]&&(e=c.dims[5]);return a.slice(b,b+c.numBitsPerVoxel/8*c.dims[2]*c.dims[3]*d*e*c.dims[1])};k.readExtension=function(c,a){var b=c.getExtensionLocation();return a.slice(b,b+c.extensionSize)};k.readExtensionData=function(c,a){var b=c.getExtensionLocation();return a.slice(b+8,b+c.extensionSize-
-8)};"undefined"!==typeof p&&p.exports&&(p.exports=k)},function(p,e,m){var k=k||{};k.Utils=k.Utils||m(30);k.NIFTI1=k.NIFTI1||m(51);k.NIFTI2=k.NIFTI2||function(){this.littleEndian=!1;this.dim_info=0;this.dims=[];this.slice_code=this.slice_end=this.slice_start=this.numBitsPerVoxel=this.datatypeCode=this.intent_code=this.intent_p3=this.intent_p2=this.intent_p1=0;this.pixDims=[];this.vox_offset=0;this.scl_slope=1;this.toffset=this.slice_duration=this.cal_min=this.cal_max=this.xyzt_units=this.scl_inter=
-0;this.intent_name=this.aux_file=this.description="";this.qoffset_z=this.qoffset_y=this.qoffset_x=this.quatern_d=this.quatern_c=this.quatern_b=this.sform_code=this.qform_code=0;this.affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];this.magic=0;this.extensionFlag=[0,0,0,0]};k.NIFTI2.MAGIC_COOKIE=540;k.NIFTI2.MAGIC_NUMBER_LOCATION=4;k.NIFTI2.MAGIC_NUMBER=[110,43,50,0,13,10,26,10];k.NIFTI2.prototype.readHeader=function(e){e=new DataView(e);var c=k.Utils.getIntAt(e,0,this.littleEndian),a,b;c!==k.NIFTI2.MAGIC_COOKIE&&
-(this.littleEndian=!0,c=k.Utils.getIntAt(e,0,this.littleEndian));if(c!==k.NIFTI2.MAGIC_COOKIE)throw Error("This does not appear to be a NIFTI file!");this.datatypeCode=k.Utils.getShortAt(e,12,this.littleEndian);this.numBitsPerVoxel=k.Utils.getShortAt(e,14,this.littleEndian);for(a=0;8>a;a+=1)c=16+8*a,this.dims[a]=k.Utils.getLongAt(e,c,this.littleEndian);this.intent_p1=k.Utils.getDoubleAt(e,80,this.littleEndian);this.intent_p2=k.Utils.getDoubleAt(e,88,this.littleEndian);this.intent_p3=k.Utils.getDoubleAt(e,
-96,this.littleEndian);for(a=0;8>a;a+=1)c=104+8*a,this.pixDims[a]=k.Utils.getDoubleAt(e,c,this.littleEndian);this.vox_offset=k.Utils.getLongAt(e,168,this.littleEndian);this.scl_slope=k.Utils.getDoubleAt(e,176,this.littleEndian);this.scl_inter=k.Utils.getDoubleAt(e,184,this.littleEndian);this.cal_max=k.Utils.getDoubleAt(e,192,this.littleEndian);this.cal_min=k.Utils.getDoubleAt(e,200,this.littleEndian);this.slice_duration=k.Utils.getDoubleAt(e,208,this.littleEndian);this.toffset=k.Utils.getDoubleAt(e,
-216,this.littleEndian);this.slice_start=k.Utils.getLongAt(e,224,this.littleEndian);this.slice_end=k.Utils.getLongAt(e,232,this.littleEndian);this.description=k.Utils.getStringAt(e,240,320);this.aux_file=k.Utils.getStringAt(e,320,344);this.qform_code=k.Utils.getIntAt(e,344,this.littleEndian);this.sform_code=k.Utils.getIntAt(e,348,this.littleEndian);this.quatern_b=k.Utils.getDoubleAt(e,352,this.littleEndian);this.quatern_c=k.Utils.getDoubleAt(e,360,this.littleEndian);this.quatern_d=k.Utils.getDoubleAt(e,
-368,this.littleEndian);this.qoffset_x=k.Utils.getDoubleAt(e,376,this.littleEndian);this.qoffset_y=k.Utils.getDoubleAt(e,384,this.littleEndian);this.qoffset_z=k.Utils.getDoubleAt(e,392,this.littleEndian);for(a=0;3>a;a+=1)for(b=0;4>b;b+=1)c=400+8*(4*a+b),this.affine[a][b]=k.Utils.getDoubleAt(e,c,this.littleEndian);this.affine[3][0]=0;this.affine[3][1]=0;this.affine[3][2]=0;this.affine[3][3]=1;this.slice_code=k.Utils.getIntAt(e,496,this.littleEndian);this.xyzt_units=k.Utils.getIntAt(e,500,this.littleEndian);
-this.intent_code=k.Utils.getIntAt(e,504,this.littleEndian);this.intent_name=k.Utils.getStringAt(e,508,524);this.dim_info=k.Utils.getByteAt(e,524);e.byteLength>k.NIFTI2.MAGIC_COOKIE&&(this.extensionFlag[0]=k.Utils.getByteAt(e,540),this.extensionFlag[1]=k.Utils.getByteAt(e,541),this.extensionFlag[2]=k.Utils.getByteAt(e,542),this.extensionFlag[3]=k.Utils.getByteAt(e,543),this.extensionFlag[0]&&(this.extensionSize=this.getExtensionSize(e),this.extensionCode=this.getExtensionCode(e)))};k.NIFTI2.prototype.toFormattedString=
-function(){var e=k.Utils.formatNumber;var c=""+("Datatype = "+ +this.datatypeCode+" ("+this.getDatatypeCodeString(this.datatypeCode)+")\n");c+="Bits Per Voxel =  = "+this.numBitsPerVoxel+"\n";c+="Image Dimensions (1-8): "+this.dims[0]+", "+this.dims[1]+", "+this.dims[2]+", "+this.dims[3]+", "+this.dims[4]+", "+this.dims[5]+", "+this.dims[6]+", "+this.dims[7]+"\n";c+="Intent Parameters (1-3): "+this.intent_p1+", "+this.intent_p2+", "+this.intent_p3+"\n";c+="Voxel Dimensions (1-8): "+e(this.pixDims[0])+
-", "+e(this.pixDims[1])+", "+e(this.pixDims[2])+", "+e(this.pixDims[3])+", "+e(this.pixDims[4])+", "+e(this.pixDims[5])+", "+e(this.pixDims[6])+", "+e(this.pixDims[7])+"\n";c+="Image Offset = "+this.vox_offset+"\n";c+="Data Scale:  Slope = "+e(this.scl_slope)+"  Intercept = "+e(this.scl_inter)+"\n";c+="Display Range:  Max = "+e(this.cal_max)+"  Min = "+e(this.cal_min)+"\n";c+="Slice Duration = "+this.slice_duration+"\n";c+="Time Axis Shift = "+this.toffset+"\n";c+="Slice Start = "+this.slice_start+
-"\n";c+="Slice End = "+this.slice_end+"\n";c+='Description: "'+this.description+'"\n';c+='Auxiliary File: "'+this.aux_file+'"\n';c+="Q-Form Code = "+this.qform_code+" ("+this.getTransformCodeString(this.qform_code)+")\n";c+="S-Form Code = "+this.sform_code+" ("+this.getTransformCodeString(this.sform_code)+")\n";c+="Quaternion Parameters:  b = "+e(this.quatern_b)+"  c = "+e(this.quatern_c)+"  d = "+e(this.quatern_d)+"\n";c+="Quaternion Offsets:  x = "+this.qoffset_x+"  y = "+this.qoffset_y+"  z = "+
-this.qoffset_z+"\n";c+="S-Form Parameters X: "+e(this.affine[0][0])+", "+e(this.affine[0][1])+", "+e(this.affine[0][2])+", "+e(this.affine[0][3])+"\n";c+="S-Form Parameters Y: "+e(this.affine[1][0])+", "+e(this.affine[1][1])+", "+e(this.affine[1][2])+", "+e(this.affine[1][3])+"\n";c+="S-Form Parameters Z: "+e(this.affine[2][0])+", "+e(this.affine[2][1])+", "+e(this.affine[2][2])+", "+e(this.affine[2][3])+"\n";c+="Slice Code = "+this.slice_code+"\n";c+="Units Code = "+this.xyzt_units+" ("+this.getUnitsCodeString(k.NIFTI1.SPATIAL_UNITS_MASK&
-this.xyzt_units)+", "+this.getUnitsCodeString(k.NIFTI1.TEMPORAL_UNITS_MASK&this.xyzt_units)+")\n";c+="Intent Code = "+this.intent_code+"\n";c+='Intent Name: "'+this.intent_name+'"\n';return c+="Dim Info = "+this.dim_info+"\n"};k.NIFTI2.prototype.getExtensionLocation=function(){return k.NIFTI2.MAGIC_COOKIE+4};k.NIFTI2.prototype.getExtensionSize=k.NIFTI1.prototype.getExtensionSize;k.NIFTI2.prototype.getExtensionCode=k.NIFTI1.prototype.getExtensionCode;k.NIFTI2.prototype.getDatatypeCodeString=k.NIFTI1.prototype.getDatatypeCodeString;
-k.NIFTI2.prototype.getTransformCodeString=k.NIFTI1.prototype.getTransformCodeString;k.NIFTI2.prototype.getUnitsCodeString=k.NIFTI1.prototype.getUnitsCodeString;k.NIFTI2.prototype.getQformMat=k.NIFTI1.prototype.getQformMat;k.NIFTI2.prototype.convertNiftiQFormToNiftiSForm=k.NIFTI1.prototype.convertNiftiQFormToNiftiSForm;k.NIFTI2.prototype.convertNiftiSFormToNEMA=k.NIFTI1.prototype.convertNiftiSFormToNEMA;k.NIFTI2.prototype.nifti_mat33_mul=k.NIFTI1.prototype.nifti_mat33_mul;k.NIFTI2.prototype.nifti_mat33_determ=
-k.NIFTI1.prototype.nifti_mat33_determ;"undefined"!==typeof p&&p.exports&&(p.exports=k.NIFTI2)},function(p,e,m){function k(a){return Object(c.a)(Object(b.a)(a))}Object.defineProperty(e,"__esModule",{value:!0});var f=m(29),c=m(129);p=m(52);var a=m(14),b=m(53);Object(p.a)("vtk",{description:"VTK",getMesh:function(b,c,e,g){return f.a.getData(b.addRef(),k,c,e,g).then(function(b){var c={info:{numTriangles:b.numTriangles,numVertices:b.numVertices,vertexAttributes:[]},indices:b.indices,vertexPositions:b.vertexPositions,
-vertexAttributes:[]};b=$jscomp.makeIterator(b.vertexAttributes);for(var d=b.next();!d.done;d=b.next())d=d.value,c.info.vertexAttributes.push({name:d.name,dataType:a.b.FLOAT32,numComponents:d.numComponents}),c.vertexAttributes.push(d.data);return c})}})},function(p,e,m){e.a=function(a){var b=(new TextDecoder).decode(new Uint8Array(a.buffer,a.byteOffset,Math.min(a.byteLength,1E3))).match(k);if(null===b)throw Error("Failed to parse VTK file header.");var c=b[0].length,d=b[4],e=b[3];b={version:b[1],comment:b[2],
-datasetType:d,dataFormat:e};a=new Uint8Array(a.buffer,a.byteOffset+c,a.byteLength-c);if("ASCII"===e){e=r.get(d);if(void 0===e)throw Error("VTK dataset type "+JSON.stringify(d)+" is not supported.");return e(b,a)}throw Error("VTK data format "+JSON.stringify(e)+" is not supported.");};var k=/^[ \t]*#[ \t]+vtk[ \t]+DataFile[ \t]+Version[ \t]+([^\s]+)[ \t]*\n(.*)\n[ \t]*(ASCII|BINARY)[ \t]*\n[ \t]*DATASET[ \t]+([^ ]+)[ \t]*\n/,f=/^[ \t]*POINT_DATA[ \t]+([0-9]+)[ \t]*$/,c=/^[ \t]*POINTS[ \t]+([0-9]+)[ \t]+([^\s]+)[ \t]*$/,
-a=/^[ \t]*SCALARS[ \t]+([^\s]+)[ \t]+([^\s]+)(?:[ \t]+([0-9]+))?[ \t]*$/,b=/^[ \t]*LOOKUP_TABLE[ \t]+([^\s]+)[ \t]*$/,d=/^[ \t]*POLYGONS[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]*$/,n=/^[ \t]*3[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]*$/,l=/^[ \t]*$/,g=function w(a,b,c,d,e,f){if(!(this instanceof w))throw new TypeError("Cannot call a class as a function");this.header=a;this.numVertices=b;this.vertexPositions=c;this.numTriangles=d;this.indices=e;this.vertexAttributes=f},r=new Map([["POLYDATA",function(e,
-h){function k(a,b,c,d){d=RegExp("^[ \t]*"+"([^s]+)[ \t]+".repeat(c-1)+"([^s]+)[ \t]*$");if(v-A<b)throw Error("VTK data ended unexpectedly while parsing "+a+".");for(var e=new Float32Array(b*c),f=0,g=0;g<b;++g){var h=w[A++],k=h.match(d);if(null===k)throw Error("Failed to parse "+a+" line "+g+": "+JSON.stringify(h)+".");for(h=0;h<c;++h)e[f++]=parseFloat(k[h+1])}return e}function m(a,b){if(void 0!==q)throw Error("POINTS specified more than once.");t=a;z=k("POINTS",a,3,b)}function p(a,b){if(void 0!==
-q)throw Error("VERTICES specified more than once.");if(v-A<a)throw Error("VTK data ended unexpectedly");if(b!==4*a)throw Error("Only triangular faces are supported.");H=a;q=new Uint32Array(3*a);for(var c=b=0;c<a;++c){var d=w[A++].match(n);if(null===d)throw Error("Failed to parse indices for face "+c);q[b++]=parseInt(d[1],10);q[b++]=parseInt(d[2],10);q[b++]=parseInt(d[3],10)}}function r(c){if(t!==c)throw Error("Number of vertices specified in POINT_DATA section ("+c+") "+("must match number of points ("+
-t+")."));for(;A<v;)if(c=w[A],c.match(l))++A;else{var d=c.match(a);if(null!==d){var e=void 0===d[3]?1:parseInt(d[3],10);++A;c=d[1];d=d[2];if(A===v)throw Error("Expected LOOKUP_TABLE directive.");var f=w[A++],g=f.match(b);if(null===g)throw Error("Expected LOOKUP_TABLE directive in "+JSON.stringify(f)+".");f=g[1];g=k("SCALARS("+c+")",t,e,d);G.push({name:c,data:g,numComponents:e,dataType:d,tableName:f})}}}for(var w=(new TextDecoder).decode(h).split("\n"),v=w.length,A=0,t=-1,z=void 0,H=-1,q=void 0,G=[];A<
-v;)if(h=w[A],h.match(l))++A;else{var L=void 0;L=h.match(c);if(null!==L)++A,m(parseInt(L[1],10),L[2]);else if(L=h.match(d),null!==L)++A,p(parseInt(L[1],10),parseInt(L[2],10));else{L=h.match(f);if(null!==L){++A;r(parseInt(L[1],10));break}throw Error("Failed to parse VTK line "+JSON.stringify(h)+".");}}if(void 0===z)throw Error("Vertex positions not specified.");if(void 0===q)throw Error("Indices not specified.");return new g(e,t,z,H,q,G)}]])},function(p,e,m){function k(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 f(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}m.d(e,"d",function(){return c});e.c="single_mesh/SingleMeshLayer";e.a="single_mesh/getSingleMeshInfo";e.b="";var c=function(a){function b(){f(this,
-b);var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}k(b,a);return b}(function b(){f(this,b)});c.RPC_ID="single_mesh/SingleMeshSource"},function(p,e,m){function k(b){b=(new TextDecoder).decode(Object(a.a)(b)).trim().split(/\n+/);if(!b)throw Error("CSV file is empty.");var d=b[0].split(","),e=d.map(function(a){return{name:a.trim(),
-dataType:c.b.FLOAT32,numComponents:1}}),f=b.length-1,g=d.length;d=d.map(function(){return new Float32Array(f)});for(var k=0;k<f;++k)for(var m=b[k+1].split(","),p=0;p<g;++p)d[p][k]=parseFloat(m[p]);return{numVertices:f,attributeInfo:e,attributes:d}}Object.defineProperty(e,"__esModule",{value:!0});var f=m(29);p=m(52);var c=m(14),a=m(53);Object(p.b)("csv",{description:"Comma separated value text file",getMeshVertexAttributes:function(a,c,e,l){return f.a.getData(a.addRef(),k,c,e,l)}})}])});
diff --git a/third_party/export_nehuba/main.bundle.js b/third_party/export_nehuba/main.bundle.js
deleted file mode 100644
index d2405e400e269303b2fe1ff742d074069b0b3764..0000000000000000000000000000000000000000
--- a/third_party/export_nehuba/main.bundle.js
+++ /dev/null
@@ -1,2332 +0,0 @@
-/*
-
- Copyright 2016 Google Inc.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- Copyright 2017 Google Inc.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- Copyright 2018 Google Inc.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(h,f,a){h!=Array.prototype&&h!=Object.prototype&&(h[f]=a.value)};$jscomp.getGlobal=function(h){return"undefined"!=typeof window&&window===h?h:"undefined"!=typeof global&&null!=global?global:h};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
-$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(h){return $jscomp.SYMBOL_PREFIX+(h||"")+$jscomp.symbolCounter_++};
-$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var h=$jscomp.global.Symbol.iterator;h||(h=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[h]&&$jscomp.defineProperty(Array.prototype,h,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(h){var f=0;return $jscomp.iteratorPrototype(function(){return f<h.length?{done:!1,value:h[f++]}:{done:!0}})};
-$jscomp.iteratorPrototype=function(h){$jscomp.initSymbolIterator();h={next:h};h[$jscomp.global.Symbol.iterator]=function(){return this};return h};$jscomp.makeIterator=function(h){$jscomp.initSymbolIterator();$jscomp.initSymbol();$jscomp.initSymbolIterator();var f=h[Symbol.iterator];return f?f.call(h):$jscomp.arrayIterator(h)};$jscomp.arrayFromIterator=function(h){for(var f,a=[];!(f=h.next()).done;)a.push(f.value);return a};$jscomp.arrayFromIterable=function(h){return h instanceof Array?h:$jscomp.arrayFromIterator($jscomp.makeIterator(h))};
-$jscomp.polyfill=function(h,f,a,q){if(f){a=$jscomp.global;h=h.split(".");for(q=0;q<h.length-1;q++){var p=h[q];p in a||(a[p]={});a=a[p]}h=h[h.length-1];q=a[h];f=f(q);f!=q&&null!=f&&$jscomp.defineProperty(a,h,{configurable:!0,writable:!0,value:f})}};$jscomp.polyfill("Number.isNaN",function(h){return h?h:function(f){return"number"===typeof f&&isNaN(f)}},"es6","es3");
-$jscomp.polyfill("Number.isFinite",function(h){return h?h:function(f){return"number"!==typeof f?!1:!isNaN(f)&&Infinity!==f&&-Infinity!==f}},"es6","es3");$jscomp.iteratorFromArray=function(h,f){$jscomp.initSymbolIterator();h instanceof String&&(h+="");var a=0,q={next:function(){if(a<h.length){var p=a++;return{value:f(p,h[p]),done:!1}}q.next=function(){return{done:!0,value:void 0}};return q.next()}};q[Symbol.iterator]=function(){return q};return q};
-$jscomp.polyfill("Array.prototype.keys",function(h){return h?h:function(){return $jscomp.iteratorFromArray(this,function(f){return f})}},"es6","es3");$jscomp.polyfill("Number.isInteger",function(h){return h?h:function(f){return Number.isFinite(f)?f===Math.floor(f):!1}},"es6","es3");
-$jscomp.polyfill("Array.from",function(h){return h?h:function(f,a,h){$jscomp.initSymbolIterator();a=null!=a?a:function(a){return a};var p=[],n=f[Symbol.iterator];if("function"==typeof n)for(f=n.call(f);!(n=f.next()).done;)p.push(a.call(h,n.value));else{n=f.length;for(var d=0;d<n;d++)p.push(a.call(h,f[d]))}return p}},"es6","es3");$jscomp.owns=function(h,f){return Object.prototype.hasOwnProperty.call(h,f)};
-$jscomp.polyfill("WeakMap",function(h){function f(a){$jscomp.owns(a,q)||$jscomp.defineProperty(a,q,{value:{}})}function a(a){var b=Object[a];b&&(Object[a]=function(a){f(a);return b(a)})}if(function(){if(!h||!Object.seal)return!1;try{var a=Object.seal({}),b=Object.seal({}),c=new h([[a,2],[b,3]]);if(2!=c.get(a)||3!=c.get(b))return!1;c.delete(a);c.set(b,4);return!c.has(a)&&4==c.get(b)}catch(e){return!1}}())return h;var q="$jscomp_hidden_"+Math.random().toString().substring(2);a("freeze");a("preventExtensions");
-a("seal");var p=0,n=function(a){this.id_=(p+=Math.random()+1).toString();if(a){$jscomp.initSymbol();$jscomp.initSymbolIterator();a=$jscomp.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}};n.prototype.set=function(a,b){f(a);if(!$jscomp.owns(a,q))throw Error("WeakMap key fail: "+a);a[q][this.id_]=b;return this};n.prototype.get=function(a){return $jscomp.owns(a,q)?a[q][this.id_]:void 0};n.prototype.has=function(a){return $jscomp.owns(a,q)&&$jscomp.owns(a[q],this.id_)};n.prototype.delete=
-function(a){return $jscomp.owns(a,q)&&$jscomp.owns(a[q],this.id_)?delete a[q][this.id_]:!1};return n},"es6","es3");$jscomp.MapEntry=function(){};
-$jscomp.polyfill("Map",function(h){if(!$jscomp.ASSUME_NO_NATIVE_MAP&&function(){if(!h||!h.prototype.entries||"function"!=typeof Object.seal)return!1;try{var a=Object.seal({x:4}),d=new h($jscomp.makeIterator([[a,"s"]]));if("s"!=d.get(a)||1!=d.size||d.get({x:4})||d.set({x:4},"t")!=d||2!=d.size)return!1;var e=d.entries(),g=e.next();if(g.done||g.value[0]!=a||"s"!=g.value[1])return!1;g=e.next();return g.done||4!=g.value[0].x||"t"!=g.value[1]||!e.next().done?!1:!0}catch(l){return!1}}())return h;$jscomp.initSymbol();
-$jscomp.initSymbolIterator();var f=new WeakMap,a=function(a){this.data_={};this.head_=n();this.size=0;if(a){a=$jscomp.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}};a.prototype.set=function(a,d){var b=q(this,a);b.list||(b.list=this.data_[b.id]=[]);b.entry?b.entry.value=d:(b.entry={next:this.head_,previous:this.head_.previous,head:this.head_,key:a,value:d},b.list.push(b.entry),this.head_.previous.next=b.entry,this.head_.previous=b.entry,this.size++);return this};a.prototype.delete=
-function(a){a=q(this,a);return a.entry&&a.list?(a.list.splice(a.index,1),a.list.length||delete this.data_[a.id],a.entry.previous.next=a.entry.next,a.entry.next.previous=a.entry.previous,a.entry.head=null,this.size--,!0):!1};a.prototype.clear=function(){this.data_={};this.head_=this.head_.previous=n();this.size=0};a.prototype.has=function(a){return!!q(this,a).entry};a.prototype.get=function(a){return(a=q(this,a).entry)&&a.value};a.prototype.entries=function(){return p(this,function(a){return[a.key,
-a.value]})};a.prototype.keys=function(){return p(this,function(a){return a.key})};a.prototype.values=function(){return p(this,function(a){return a.value})};a.prototype.forEach=function(a,d){for(var b=this.entries(),c;!(c=b.next()).done;)c=c.value,a.call(d,c[1],c[0],this)};a.prototype[Symbol.iterator]=a.prototype.entries;var q=function(a,c){var b=c&&typeof c;"object"==b||"function"==b?f.has(c)?b=f.get(c):(b=""+ ++d,f.set(c,b)):b="p_"+c;var g=a.data_[b];if(g&&$jscomp.owns(a.data_,b))for(a=0;a<g.length;a++){var l=
-g[a];if(c!==c&&l.key!==l.key||c===l.key)return{id:b,list:g,index:a,entry:l}}return{id:b,list:g,index:-1,entry:void 0}},p=function(a,d){var b=a.head_;return $jscomp.iteratorPrototype(function(){if(b){for(;b.head!=a.head_;)b=b.previous;for(;b.next!=b.head;)return b=b.next,{done:!1,value:d(b)};b=null}return{done:!0,value:void 0}})},n=function(){var a={};return a.previous=a.next=a.head=a},d=0;return a},"es6","es3");
-$jscomp.checkStringArgs=function(h,f,a){if(null==h)throw new TypeError("The 'this' value for String.prototype."+a+" must not be null or undefined");if(f instanceof RegExp)throw new TypeError("First argument to String.prototype."+a+" must not be a regular expression");return h+""};
-$jscomp.polyfill("String.prototype.startsWith",function(h){return h?h:function(f,a){var h=$jscomp.checkStringArgs(this,f,"startsWith");f+="";var p=h.length,n=f.length;a=Math.max(0,Math.min(a|0,h.length));for(var d=0;d<n&&a<p;)if(h[a++]!=f[d++])return!1;return d>=n}},"es6","es3");
-$jscomp.polyfill("Set",function(h){if(!$jscomp.ASSUME_NO_NATIVE_SET&&function(){if(!h||!h.prototype.entries||"function"!=typeof Object.seal)return!1;try{var a=Object.seal({x:4}),f=new h($jscomp.makeIterator([a]));if(!f.has(a)||1!=f.size||f.add(a)!=f||1!=f.size||f.add({x:4})!=f||2!=f.size)return!1;var p=f.entries(),n=p.next();if(n.done||n.value[0]!=a||n.value[1]!=a)return!1;n=p.next();return n.done||n.value[0]==a||4!=n.value[0].x||n.value[1]!=n.value[0]?!1:p.next().done}catch(d){return!1}}())return h;
-$jscomp.initSymbol();$jscomp.initSymbolIterator();var f=function(a){this.map_=new Map;if(a){a=$jscomp.makeIterator(a);for(var f;!(f=a.next()).done;)this.add(f.value)}this.size=this.map_.size};f.prototype.add=function(a){this.map_.set(a,a);this.size=this.map_.size;return this};f.prototype.delete=function(a){a=this.map_.delete(a);this.size=this.map_.size;return a};f.prototype.clear=function(){this.map_.clear();this.size=0};f.prototype.has=function(a){return this.map_.has(a)};f.prototype.entries=function(){return this.map_.entries()};
-f.prototype.values=function(){return this.map_.values()};f.prototype.keys=f.prototype.values;f.prototype[Symbol.iterator]=f.prototype.values;f.prototype.forEach=function(a,f){var h=this;this.map_.forEach(function(n){return a.call(f,n,n,h)})};return f},"es6","es3");$jscomp.polyfill("Array.prototype.values",function(h){return h?h:function(){return $jscomp.iteratorFromArray(this,function(f,a){return a})}},"es6","es3");
-$jscomp.polyfill("Math.log2",function(h){return h?h:function(f){return Math.log(f)/Math.LN2}},"es6","es3");$jscomp.polyfill("String.prototype.repeat",function(h){return h?h:function(f){var a=$jscomp.checkStringArgs(this,null,"repeat");if(0>f||1342177279<f)throw new RangeError("Invalid count value");f|=0;for(var h="";f;)if(f&1&&(h+=a),f>>>=1)a+=a;return h}},"es6","es3");
-$jscomp.polyfill("WeakSet",function(h){if(function(){if(!h||!Object.seal)return!1;try{var a=Object.seal({}),f=Object.seal({}),p=new h([a]);if(!p.has(a)||p.has(f))return!1;p.delete(a);p.add(f);return!p.has(a)&&p.has(f)}catch(n){return!1}}())return h;var f=function(a){this.map_=new WeakMap;if(a){$jscomp.initSymbol();$jscomp.initSymbolIterator();a=$jscomp.makeIterator(a);for(var f;!(f=a.next()).done;)this.add(f.value)}};f.prototype.add=function(a){this.map_.set(a,!0);return this};f.prototype.has=function(a){return this.map_.has(a)};
-f.prototype.delete=function(a){return this.map_.delete(a)};return f},"es6","es3");$jscomp.findInternal=function(h,f,a){h instanceof String&&(h=String(h));for(var q=h.length,p=0;p<q;p++){var n=h[p];if(f.call(a,n,p,h))return{i:p,v:n}}return{i:-1,v:void 0}};$jscomp.polyfill("Array.prototype.find",function(h){return h?h:function(f,a){return $jscomp.findInternal(this,f,a).v}},"es6","es3");
-$jscomp.polyfill("Object.assign",function(h){return h?h:function(f,a){for(var h=1;h<arguments.length;h++){var p=arguments[h];if(p)for(var n in p)$jscomp.owns(p,n)&&(f[n]=p[n])}return f}},"es6","es3");$jscomp.FORCE_POLYFILL_PROMISE=!1;
-$jscomp.polyfill("Promise",function(h){function f(){this.batch_=null}function a(a){return a instanceof p?a:new p(function(b,d){b(a)})}if(h&&!$jscomp.FORCE_POLYFILL_PROMISE)return h;f.prototype.asyncExecute=function(a){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(a);return this};f.prototype.asyncExecuteBatch_=function(){var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})};var q=$jscomp.global.setTimeout;f.prototype.asyncExecuteFunction=function(a){q(a,
-0)};f.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=this.batch_;this.batch_=[];for(var b=0;b<a.length;++b){var c=a[b];delete a[b];try{c()}catch(e){this.asyncThrow_(e)}}}this.batch_=null};f.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var p=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(c){b.reject(c)}};p.prototype.createResolveAndReject_=
-function(){function a(a){return function(d){c||(c=!0,a.call(b,d))}}var b=this,c=!1;return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};p.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof p)this.settleSameAsPromise_(a);else{a:switch(typeof a){case "object":var b=null!=a;break a;case "function":b=!0;break a;default:b=!1}b?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};p.prototype.resolveToNonPromiseObj_=function(a){var b=
-void 0;try{b=a.then}catch(c){this.reject_(c);return}"function"==typeof b?this.settleSameAsThenable_(b,a):this.fulfill_(a)};p.prototype.reject_=function(a){this.settle_(2,a)};p.prototype.fulfill_=function(a){this.settle_(1,a)};p.prototype.settle_=function(a,b){if(0!=this.state_)throw Error("Cannot settle("+a+", "+b|"): Promise already settled in state"+this.state_);this.state_=a;this.result_=b;this.executeOnSettledCallbacks_()};p.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=
-this.onSettledCallbacks_,b=0;b<a.length;++b)a[b].call(),a[b]=null;this.onSettledCallbacks_=null}};var n=new f;p.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};p.prototype.settleSameAsThenable_=function(a,b){var c=this.createResolveAndReject_();try{a.call(b,c.resolve,c.reject)}catch(e){c.reject(e)}};p.prototype.then=function(a,b){function c(a,b){return"function"==typeof a?function(b){try{d(a(b))}catch(r){g(r)}}:b}var d,g,l=new p(function(a,
-b){d=a;g=b});this.callWhenSettled_(c(a,d),c(b,g));return l};p.prototype.catch=function(a){return this.then(void 0,a)};p.prototype.callWhenSettled_=function(a,b){function c(){switch(d.state_){case 1:a(d.result_);break;case 2:b(d.result_);break;default:throw Error("Unexpected state: "+d.state_);}}var d=this;null==this.onSettledCallbacks_?n.asyncExecute(c):this.onSettledCallbacks_.push(function(){n.asyncExecute(c)})};p.resolve=a;p.reject=function(a){return new p(function(b,c){c(a)})};p.race=function(d){return new p(function(b,
-c){for(var e=$jscomp.makeIterator(d),g=e.next();!g.done;g=e.next())a(g.value).callWhenSettled_(b,c)})};p.all=function(d){var b=$jscomp.makeIterator(d),c=b.next();return c.done?a([]):new p(function(d,g){function e(a){return function(b){k[a]=b;t--;0==t&&d(k)}}var k=[],t=0;do k.push(void 0),t++,a(c.value).callWhenSettled_(e(k.length-1),g),c=b.next();while(!c.done)})};return p},"es6","es3");
-$jscomp.polyfill("Math.sign",function(h){return h?h:function(f){f=Number(f);return 0===f||isNaN(f)?f:0<f?1:-1}},"es6","es3");$jscomp.polyfill("Array.prototype.entries",function(h){return h?h:function(){return $jscomp.iteratorFromArray(this,function(f,a){return[f,a]})}},"es6","es3");$jscomp.polyfill("Array.prototype.findIndex",function(h){return h?h:function(f,a){return $jscomp.findInternal(this,f,a).i}},"es6","es3");
-$jscomp.polyfill("Array.prototype.fill",function(h){return h?h:function(f,a,h){var p=this.length||0;0>a&&(a=Math.max(0,p+a));if(null==h||h>p)h=p;h=Number(h);0>h&&(h=Math.max(0,p+h));for(a=Number(a||0);a<h;a++)this[a]=f;return this}},"es6","es3");
-window.export_nehuba=function(h){function f(q){if(a[q])return a[q].exports;var p=a[q]={i:q,l:!1,exports:{}};h[q].call(p.exports,p,p.exports,f);p.l=!0;return p.exports}var a={};f.m=h;f.c=a;f.d=function(a,h,n){f.o(a,h)||Object.defineProperty(a,h,{configurable:!1,enumerable:!0,get:n})};f.n=function(a){var h=a&&a.__esModule?function(){return a["default"]}:function(){return a};f.d(h,"a",h);return h};f.o=function(a,f){return Object.prototype.hasOwnProperty.call(a,f)};f.p="";return f(f.s=226)}([function(h,
-f,a){var q=a(16),p=a(365),n=a(87);h=function(){function a(a){this._isScalar=!1;a&&(this._subscribe=a)}a.prototype.lift=function(b){var c=new a;c.source=this;c.operator=b;return c};a.prototype.subscribe=function(a,c,d){var b=this.operator;a=p.toSubscriber(a,c,d);b?b.call(a,this.source):a.add(this.source?this._subscribe(a):this._trySubscribe(a));if(a.syncErrorThrowable&&(a.syncErrorThrowable=!1,a.syncErrorThrown))throw a.syncErrorValue;return a};a.prototype._trySubscribe=function(a){try{return this._subscribe(a)}catch(c){a.syncErrorThrown=
-!0,a.syncErrorValue=c,a.error(c)}};a.prototype.forEach=function(a,c){var b=this;c||(q.root.Rx&&q.root.Rx.config&&q.root.Rx.config.Promise?c=q.root.Rx.config.Promise:q.root.Promise&&(c=q.root.Promise));if(!c)throw Error("no Promise impl found");return new c(function(c,d){var e=b.subscribe(function(b){if(e)try{a(b)}catch(m){d(m),e.unsubscribe()}else a(b)},d,c)})};a.prototype._subscribe=function(a){return this.source.subscribe(a)};a.prototype[n.observable]=function(){return this};a.create=function(b){return new a(b)};
-return a}();f.Observable=h},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function n(a,b,c,d){a.addEventListener(b,c,d);
-return function(){return a.removeEventListener(b,c,d)}}a.d(f,"c",function(){return n});a.d(f,"a",function(){return b});a.d(f,"b",function(){return c});var d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),b=function(){function a(){p(this,a);this.refCount=1}d(a,[{key:"addRef",value:function(){++this.refCount;
-return this}},{key:"dispose",value:function(){0===--this.refCount&&this.refCountReachedZero()}},{key:"refCountReachedZero",value:function(){this.disposed();var a=this.disposers;if(null!=a){for(var b=a.length;0<b;--b){var c=a[b-1];"object"===typeof c?c.dispose():c.call(this)}this.disposers=void 0}this.wasDisposed=!0}},{key:"disposed",value:function(){}},{key:"registerDisposer",value:function(a){var b=this.disposers;null==b?this.disposers=[a]:b.push(a);return a}},{key:"unregisterDisposer",value:function(a){var b=
-this.disposers;if(null!=b){var c=b.indexOf(a);-1!==c&&b.splice(c,1)}return a}},{key:"registerEventListener",value:function(a,b,c,d){this.registerDisposer(n(a,b,c,d))}},{key:"registerCancellable",value:function(a){this.registerDisposer(function(){a.cancel()});return a}}]);return a}(),c=function(a){function b(a){p(this,b);var c=(b.__proto__||Object.getPrototypeOf(b)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");c=!c||"object"!==typeof c&&
-"function"!==typeof c?this:c;c.value=a;return c}q(b,a);return b}(b)},function(h,f,a){function q(a,b){var c=Math.abs(a[b]),d=Math.abs(a[b+1]),g=Math.abs(a[b+2]),l=Math.max(c,d,g);1E-4>c/l&&(a[b]=0);1E-4>d/l&&(a[b+1]=0);1E-4>g/l&&(a[b+2]=0)}a.d(f,"b",function(){return n});f.l=function(a){return a[0]*a[1]*a[2]};f.t=function(a){return a[0]+","+a[1]+","+a[2]};f.o=function(a){q(a,0);q(a,4);q(a,8)};f.p=function(a,b,c){var d=b[0],g=b[1];b=b[2];a[0]=c[0]*d+c[4]*g+c[8]*b;a[1]=c[1]*d+c[5]*g+c[9]*b;a[2]=c[2]*
-d+c[6]*g+c[10]*b;return a};f.c=function(a,b){var c=b[0],d=b[1],g=b[2],l=b[4],k=b[5],t=b[6],m=b[8],r=b[9];b=b[10];a[0]=Math.sqrt(c*c+d*d+g*g);a[1]=Math.sqrt(l*l+k*k+t*t);a[2]=Math.sqrt(m*m+r*r+b*b);return a};f.q=function(a,b,c,e,g){a[0]=e[0];a[1]=e[1];a[2]=e[2]*g;return p.b.fromRotationTranslationScale(a,c,b,a)};f.m=function(a,b,c,e){for(var d=p.e.squaredDistance(b,c),l=0,k=0;3>k;++k){var t=b[k];l-=(t-e[k])*(c[k]-t)}e=l/Math.max(d,1E-6);e=Math.max(0,Math.min(1,e));for(d=0;3>d;++d)l=b[d],a[d]=l+e*(c[d]-
-l);return a};f.j=function(a,b){var c=b[1],d=b[2],g=b[4],l=b[5],k=b[6],t=b[8],m=b[9],r=b[10];a[0]=b[0];a[1]=c;a[2]=d;a[3]=g;a[4]=l;a[5]=k;a[6]=t;a[7]=m;a[8]=r;return a};var p=a(132);h=a(14);a.d(f,"i",function(){return p.a});a.d(f,"k",function(){return p.b});a.d(f,"n",function(){return p.c});a.d(f,"r",function(){return p.d});a.d(f,"s",function(){return p.e});a.d(f,"u",function(){return p.f});a=p.b.create();f.d=a;f.a=["x","y","z"];var n=function b(a,e){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");
-this.lower=a;this.upper=e};a=[p.e.fromValues(1,0,0),p.e.fromValues(0,1,0),p.e.fromValues(0,0,1)];f.e=a;a=p.e.fromValues(0,0,0);f.h=a;a=p.e.fromValues(1,1,1);f.g=a;a=p.e.fromValues(Infinity,Infinity,Infinity);f.f=a;p.c.create();new h.a(1227133513,306783378);new h.a(3272356035,818089008);new h.a(251719695,4027515120);new h.a(4278190335,16711680);new h.a(65535,16711680);new h.a(2097151,0)},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&
-(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(85);h=a(11);var n=a(197),d=a(86);a=function(a){function c(d,e,k){a.call(this);this.syncErrorValue=null;this.isStopped=this.syncErrorThrowable=this.syncErrorThrown=!1;switch(arguments.length){case 0:this.destination=n.empty;break;case 1:if(!d){this.destination=n.empty;break}if("object"===typeof d){d instanceof c?(this.destination=d,this.destination.add(this)):(this.syncErrorThrowable=!0,this.destination=new b(this,
-d));break}default:this.syncErrorThrowable=!0,this.destination=new b(this,d,e,k)}}q(c,a);c.prototype[d.rxSubscriber]=function(){return this};c.create=function(a,b,d){a=new c(a,b,d);a.syncErrorThrowable=!1;return a};c.prototype.next=function(a){this.isStopped||this._next(a)};c.prototype.error=function(a){this.isStopped||(this.isStopped=!0,this._error(a))};c.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())};c.prototype.unsubscribe=function(){this.closed||(this.isStopped=
-!0,a.prototype.unsubscribe.call(this))};c.prototype._next=function(a){this.destination.next(a)};c.prototype._error=function(a){this.destination.error(a);this.unsubscribe()};c.prototype._complete=function(){this.destination.complete();this.unsubscribe()};c.prototype._unsubscribeAndRecycle=function(){var a=this._parent,b=this._parents;this._parents=this._parent=null;this.unsubscribe();this.isStopped=this.closed=!1;this._parent=a;this._parents=b;return this};return c}(h.Subscription);f.Subscriber=a;
-var b=function(a){function b(b,c,d,e){a.call(this);this._parentSubscriber=b;b=this;if(p.isFunction(c))var g=c;else c&&(g=c.next,d=c.error,e=c.complete,c!==n.empty&&(b=Object.create(c),p.isFunction(b.unsubscribe)&&this.add(b.unsubscribe.bind(b)),b.unsubscribe=this.unsubscribe.bind(this)));this._context=b;this._next=g;this._error=d;this._complete=e}q(b,a);b.prototype.next=function(a){if(!this.isStopped&&this._next){var b=this._parentSubscriber;b.syncErrorThrowable?this.__tryOrSetError(b,this._next,
-a)&&this.unsubscribe():this.__tryOrUnsub(this._next,a)}};b.prototype.error=function(a){if(!this.isStopped){var b=this._parentSubscriber;if(this._error)b.syncErrorThrowable?this.__tryOrSetError(b,this._error,a):this.__tryOrUnsub(this._error,a),this.unsubscribe();else if(b.syncErrorThrowable)b.syncErrorValue=a,b.syncErrorThrown=!0,this.unsubscribe();else throw this.unsubscribe(),a;}};b.prototype.complete=function(){var a=this;if(!this.isStopped){var b=this._parentSubscriber;if(this._complete){var c=
-function(){return a._complete.call(a._context)};b.syncErrorThrowable?this.__tryOrSetError(b,c):this.__tryOrUnsub(c)}this.unsubscribe()}};b.prototype.__tryOrUnsub=function(a,b){try{a.call(this._context,b)}catch(k){throw this.unsubscribe(),k;}};b.prototype.__tryOrSetError=function(a,b,c){try{b.call(this._context,c)}catch(t){return a.syncErrorValue=t,a.syncErrorThrown=!0}return!1};b.prototype._unsubscribe=function(){var a=this._parentSubscriber;this._parentSubscriber=this._context=null;a.unsubscribe()};
-return b}(a)},function(h,f,a){function q(a){var b=typeof a;if("number"===b||"string"===b)if(b=parseFloat(""+a),!Number.isNaN(b))return b;throw Error("Expected floating-point number, but received: "+JSON.stringify(a)+".");}function p(a){a=q(a);if(Number.isFinite(a))return a;throw Error("Expected finite floating-point number, but received: "+a+".");}function n(a){a=p(a);if(0<a)return a;throw Error("Expected positive finite floating-point number, but received: "+a+".");}function d(a){if("object"===typeof a){if(null===
-a)return"null";if(Array.isArray(a)){var b="[",c=a.length,e=0;if(e<c)for(b+=d(a[e]);++e<c;)b+=",",b+=d(a[e]);return b+"]"}b="{";c=Object.keys(a).sort();e=0;var g=c.length;if(e<g){var k=c[e];b+=JSON.stringify(k);for(b=b+":"+d(a[k]);++e<g;)b+=",",k=c[e],b+=JSON.stringify(k),b+=":",b+=d(a[k])}return b+"}"}return JSON.stringify(a)}function b(a,b,c){var d=/[&_,]/g;if('"'===c){var e="'";var g=v;var k=r}else e='"',g=w,k=u;for(var m="";0<a.length;){var l=a.match(k);if(null===l){var t=a;l=a=""}else{t=a.substr(0,
-l.index);a=a.substr(l.index+l[0].length);var f=l[1];if(void 0!==f){var h=f;l=e;f=c;var x=g;if(2<=h.length&&h.charAt(0)===l&&h.charAt(h.length-1)===l){h=h.substr(1,h.length-2);for(var n=f;0<h.length;){var y=h.match(x);if(null===y){n+=h;break}n+=y[1];y[2]===f?(n+="\\",n+=f):n+=l;h=h.substr(y.index+y[0].length)}l=n+f}else l=h}else l=l[2]}m+=t.replace(d,b);m+=l}return m}function c(a){return JSON.parse(b(a,",",'"'))}function e(a,b,c){var d=a.length;if(!Array.isArray(b)||b.length!==d)throw Error("Expected length "+
-d+" array, but received: "+JSON.stringify(b)+".");for(var e=0;e<d;++e)a[e]=c(b[e],e);return a}function g(a){if("object"!==typeof a||null==a||Array.isArray(a))throw Error("Expected JSON object, but received: "+JSON.stringify(a)+".");return a}function l(a){var b=parseInt(a,10);if(!Number.isInteger(b))throw Error("Expected integer, but received: "+JSON.stringify(a)+".");return b}function k(a){a=l(a);if(0>=a)throw Error("Expected positive integer, but received: "+a+".");return a}function t(a){if("string"!==
-typeof a)throw Error("Expected string, but received: "+JSON.stringify(a)+".");return a}f.p=q;f.n=p;f.o=n;f.f=function(a,b,c){c=void 0===c?q:c;g(b);a[0]=a[1]=a[2]=0;for(var d=$jscomp.makeIterator(Object.keys(b)),e=d.next();!e.done;e=d.next())switch(e=e.value,e){case "x":a[0]=c(b[e]);break;case "y":a[1]=c(b[e]);break;case "z":a[2]=c(b[e]);break;default:throw Error("Expected object to have keys ['x', 'y', 'z'], but received: "+JSON.stringify(b)+".");}return a};f.b=function(a,b){var c=a.length;if(!Array.isArray(b)||
-b.length!==c)throw Error("Incompatible sizes");for(var d=0;d<c;++d)if(!Number.isFinite(parseFloat(b[d])))throw Error("Non-finite value.");for(d=0;d<c;++d)a[d]=parseFloat(b[d]);return a};f.d=function(a,b){var c=a.length;if(!Array.isArray(b)||b.length!==c)throw Error("Incompatible sizes.");for(var d=0;d<c;++d){var e=parseInt(b[d],void 0);if(!Number.isInteger(e))throw Error("Non-integer value.");}for(d=0;d<c;++d)a[d]=parseInt(b[d],void 0);return a};f.g=d;f.h=c;f.a=function(a,b){if(!Array.isArray(a))throw Error("Expected array, but received: "+
-JSON.stringify(a)+".");return a.map(b)};f.c=e;f.t=g;f.r=l;f.z=k;f.s=function(a,b){var c=b.get(a);if(void 0===c)throw Error("Expected one of "+JSON.stringify(Array.from(b.keys()))+", "+("but received: "+JSON.stringify(a)+"."));return c};f.A=t;f.y=function(a){if(void 0!==a)return t(a)};f.x=function(a){if(void 0!==a)return l(a)};f.w=function(a){if(void 0!==a){if("boolean"===typeof a)return a;if("true"===a)return!0;if("false"===a)return!1;throw Error("Expected string or boolean but received: "+JSON.stringify(a));
-}};f.v=function(a,b,c){a=a.hasOwnProperty(b)?a[b]:void 0;try{return c(a)}catch(z){throw Error("Error parsing "+JSON.stringify(b)+" property: "+z.message);}};f.u=function(a,b){g(a);for(var c=new Map,d=$jscomp.makeIterator(Object.keys(a)),e=d.next();!e.done;e=d.next()){e=e.value;try{c.set(e,b(a[e]))}catch(E){throw Error("Error parsing value associated with key "+JSON.stringify(e)+": "+E.message);}}return c};f.q=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};f.e=function(a){if(""===a)return{};if(a.startsWith("{"))return c(a);var b={};a=a.split(/[&;]/);a=$jscomp.makeIterator(a);for(var d=a.next();!d.done;d=a.next()){d=d.value;var e=d.match(/^([^=&;]+)=([^&;]*)$/);if(null===e)throw Error("Invalid query string part: "+JSON.stringify(d)+".");b[e[1]]=decodeURIComponent(e[2])}return b};f.m=function(a,b){if("string"===typeof a&&null!==a.match(/^[a-zA-Z]/)&&(a=a.toUpperCase(),b.hasOwnProperty(a)))return b[a];throw Error("Invalid enum value: "+
-JSON.stringify(a)+".");};f.k=function(a){return e(m.s.create(),a,p)};f.j=function(a){return e(m.s.create(),a,n)};f.i=function(a){return e(m.s.create(),a,k)};f.l=function(a){if("boolean"!==typeof a)throw Error("Expected boolean, received: "+JSON.stringify(a));return a};var m=a(2);h=/('(?:[^'\\]|(?:\\.))*')/;f=/("(?:[^'\\]|(?:\\.))*")/;var r=new RegExp(h.source+"|"+f.source),u=new RegExp(f.source+"|"+h.source),v=/^((?:[^"'\\]|(?:\\[^']))*)("|\\')/,w=/^((?:[^"'\\]|(?:\\.))*)'/},function(h,f,a){var q=
-this&&this.__extends||function(a,f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(){a.apply(this,arguments)}q(f,a);f.prototype.notifyNext=function(a,b,c,e,g){this.destination.next(b)};f.prototype.notifyError=function(a,b){this.destination.error(a)};f.prototype.notifyComplete=function(a){this.destination.complete()};return f}(a(3).Subscriber);f.OuterSubscriber=h},function(h,
-f,a){var q=a(16),p=a(199),n=a(200),d=a(195),b=a(0),c=a(68),e=a(374),g=a(87);f.subscribeToResult=function(a,k,t,m){var l=new e.InnerSubscriber(a,t,m);if(l.closed)return null;if(k instanceof b.Observable)if(k._isScalar)l.next(k.value),l.complete();else return k.subscribe(l);else if(p.isArrayLike(k)){a=0;for(t=k.length;a<t&&!l.closed;a++)l.next(k[a]);l.closed||l.complete()}else{if(n.isPromise(k))return k.then(function(a){l.closed||(l.next(a),l.complete())},function(a){return l.error(a)}).then(null,function(a){q.root.setTimeout(function(){throw a;
-})}),l;if(k&&"function"===typeof k[c.iterator]){k=k[c.iterator]();do{a=k.next();if(a.done){l.complete();break}l.next(a.value);if(l.closed)break}while(1)}else if(k&&"function"===typeof k[g.observable])if(k=k[g.observable](),"function"!==typeof k.subscribe)l.error(new TypeError("Provided object does not correctly implement Symbol.observable"));else return k.subscribe(new e.InnerSubscriber(a,t,m));else k=d.isObject(k)?"an invalid object":"'"+k+"'",l.error(new TypeError("You provided "+k+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable."))}return null}},
-function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}a.d(f,"b",function(){return d});a.d(f,"a",function(){return b});var n=function(){function a(a,
-b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),d=function(){function a(){p(this,a);this.handlers=new Set;this.count=0;var b=this;this.dispatch=function(){var a=this,c=arguments;++b.count;b.handlers.forEach(function(b){b.apply(a,c)})}}n(a,[{key:"add",value:function(a){var b=this;this.handlers.add(a);return function(){return b.remove(a)}}},
-{key:"remove",value:function(a){return this.handlers.delete(a)}},{key:"dispose",value:function(){this.handlers=void 0}}]);return a}(),b=function(a){function b(){p(this,b);var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}q(b,a);return b}(d)},function(h,f,a){f.a=function(a){for(;;){var f=a.firstElementChild;if(!f)break;a.removeChild(f)}};
-f.b=function(a){var f=a.parentElement;return f?(f.removeChild(a),!0):!1}},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});
-b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}a.d(f,"f",function(){return l});a.d(f,"c",function(){return k});f.g=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];return new t(a,c)};a.d(f,"a",function(){return m});a.d(f,"d",function(){return r});a.d(f,"b",function(){return u});a.d(f,"e",function(){return v});f.h=function(a,c){function e(){g=a.value;k=new b.a;
-c(k,g)}var g,k,m=d()(function(){a.value!==g&&(k.dispose(),e())},0),l=a.changed.add(m);e();return function(){m.cancel();l();k.dispose()}};h=a(10);var d=a.n(h),b=a(1),c=a(7),e=function y(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return y(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||
-!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),l=function(){function a(b){n(this,a);this.value_=b;this.changed=new c.a}g(a,[{key:"value",get:function(){return this.value_},set:function(a){a!==this.value_&&(this.value_=a,this.changed.dispatch())}}]);return a}(),k=function(a){function b(a,c,d){d=void 0===d?a:d;n(this,b);a=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));a.validator=c;a.defaultValue=
-d;return a}p(b,a);g(b,[{key:"toJSON",value:function(){if(this.value_!==this.defaultValue)return this.value_}},{key:"reset",value:function(){this.value=this.defaultValue}},{key:"restoreState",value:function(a){if(void 0!==a){var b=this.validator;try{this.value=b(a);return}catch(D){}}this.value=this.defaultValue}}]);return b}(l),t=function(a){function b(a,d){n(this,b);var e=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.changed=new c.a;e.f=a;e.ws=d;a=$jscomp.makeIterator(d);for(d=a.next();!d.done;d=
-a.next())e.registerDisposer(d.value.changed.add(e.changed.dispatch));return e}p(b,a);g(b,[{key:"value",get:function(){return this.f.apply(this,[].concat($jscomp.arrayFromIterable(this.ws.map(function(a){return a.value}))))}}]);return b}(b.a),m=function(a){function b(a,d){for(var e=[],g=1;g<arguments.length;++g)e[g-1]=arguments[g];n(this,b);g=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));g.f=a;g.changed=new c.a;e=$jscomp.makeIterator(e);for(var k=e.next();!k.done;k=e.next())g.registerDisposer(k.value.add(g.changed.dispatch));
-return g}p(b,a);g(b,[{key:"value",get:function(){return this.f()}}]);return b}(b.a),r=function(a){function b(){n(this,b);var a=q(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.changed=new c.a;return a}p(b,a);g(b,[{key:"reset",value:function(){this.value=void 0}},{key:"disposed",value:function(){void 0!==this.value_&&this.value_.dispose();this.value_=void 0;e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"value",get:function(){return this.value_},
-set:function(a){var b=this,c=this.value_;this.value_=a;void 0!==c&&(c.dispose(),this.valueHandler=void 0);if(void 0!==a){var d=this.valueHandler=function(){b.value_===a&&(b.value_=void 0,b.changed.dispatch())};a.registerDisposer(d)}a!==c&&this.changed.dispatch()}}]);return b}(b.a),u=function(a){function b(a,c){n(this,b);var d=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.validator=a;d.jsonConverter=c;return d}p(b,a);g(b,[{key:"toJSON",value:function(){var a=this.value;return a&&this.jsonConverter(a)}},
-{key:"restoreState",value:function(a){this.value=this.validator(a)}}]);return b}(r),v=function(){function a(b){n(this,a);this.changed=new c.a;this.values=void 0===b?new Set:new Set(b)}$jscomp.initSymbol();$jscomp.initSymbolIterator();g(a,[{key:"add",value:function(a){var b=this.values;b.has(a)||(b.add(a),this.changed.dispatch());return this}},{key:"delete",value:function(a){return this.values.delete(a)?(this.changed.dispatch(),!0):!1}},{key:"has",value:function(a){return this.values.has(a)}},{key:Symbol.iterator,
-value:function(){$jscomp.initSymbol();$jscomp.initSymbolIterator();return this.values[Symbol.iterator]()}},{key:"clear",value:function(){var a=this.values;0<a.size&&(a.clear(),this.changed.dispatch())}},{key:"size",get:function(){return this.values.size}}]);return a}()},function(h,f,a){var q=a(96),p=a(235),n=a(237),d=Math.max,b=Math.min;h.exports=function(a,e,g){function c(b){var c=u,d=v;u=v=void 0;A=b;return f=a.apply(d,c)}function k(a){var b=a-x;a-=A;return void 0===x||b>=e||0>b||D&&a>=G}function t(){var a=
-p();if(k(a))return m(a);var c=setTimeout;var d=a-A;a=e-(a-x);d=D?b(a,G-d):a;h=c(t,d)}function m(a){h=void 0;if(E&&u)return c(a);u=v=void 0;return f}function r(){var a=p(),b=k(a);u=arguments;v=this;x=a;if(b){if(void 0===h)return A=a=x,h=setTimeout(t,e),z?c(a):f;if(D)return h=setTimeout(t,e),c(x)}void 0===h&&(h=setTimeout(t,e));return f}var u,v,f,h,x,A=0,z=!1,D=!1,E=!0;if("function"!=typeof a)throw new TypeError("Expected a function");e=n(e)||0;if(q(g)){z=!!g.leading;var G=(D="maxWait"in g)?d(n(g.maxWait)||
-0,e):G;E="trailing"in g?!!g.trailing:E}r.cancel=function(){void 0!==h&&clearTimeout(h);A=0;u=x=v=h=void 0};r.flush=function(){return void 0===h?f:m(p())};return r}},function(h,f,a){function q(a){return a.reduce(function(a,b){return a.concat(b instanceof e.UnsubscriptionError?b.errors:b)},[])}var p=a(36),n=a(195),d=a(85),b=a(17),c=a(13),e=a(196);h=function(){function a(a){this.closed=!1;this._subscriptions=this._parents=this._parent=null;a&&(this._unsubscribe=a)}a.prototype.unsubscribe=function(){var a=
-!1;if(!this.closed){var g=this._parent;var t=this._parents,m=this._unsubscribe,r=this._subscriptions;this.closed=!0;this._subscriptions=this._parents=this._parent=null;for(var u=-1,v=t?t.length:0;g;)g.remove(this),g=++u<v&&t[u]||null;if(d.isFunction(m)&&(g=b.tryCatch(m).call(this),g===c.errorObject)){a=!0;var f=f||(c.errorObject.e instanceof e.UnsubscriptionError?q(c.errorObject.e.errors):[c.errorObject.e])}if(p.isArray(r))for(u=-1,v=r.length;++u<v;)g=r[u],n.isObject(g)&&(g=b.tryCatch(g.unsubscribe).call(g),
-g===c.errorObject&&(a=!0,f=f||[],g=c.errorObject.e,g instanceof e.UnsubscriptionError?f=f.concat(q(g.errors)):f.push(g)));if(a)throw new e.UnsubscriptionError(f);}};a.prototype.add=function(b){if(!b||b===a.EMPTY)return a.EMPTY;if(b===this)return this;var c=b;switch(typeof b){case "function":c=new a(b);case "object":if(c.closed||"function"!==typeof c.unsubscribe)return c;if(this.closed)return c.unsubscribe(),c;"function"!==typeof c._addParent&&(b=c,c=new a,c._subscriptions=[b]);break;default:throw Error("unrecognized teardown "+
-b+" added to Subscription.");}(this._subscriptions||(this._subscriptions=[])).push(c);c._addParent(this);return c};a.prototype.remove=function(a){var b=this._subscriptions;b&&(a=b.indexOf(a),-1!==a&&b.splice(a,1))};a.prototype._addParent=function(a){var b=this._parent,c=this._parents;b&&b!==a?c?-1===c.indexOf(a)&&c.push(a):this._parents=[a]:this._parent=a};a.EMPTY=function(a){a.closed=!0;return a}(new a);return a}();f.Subscription=h},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=
-a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(0);h=a(3);var n=a(11),d=a(88),b=a(198),c=a(86),e=function(a){function b(b){a.call(this,b);this.destination=b}q(b,a);return b}(h.Subscriber);f.SubjectSubscriber=e;a=function(a){function k(){a.call(this);this.observers=[];this.hasError=this.isStopped=this.closed=!1;this.thrownError=null}q(k,a);k.prototype[c.rxSubscriber]=function(){return new e(this)};k.prototype.lift=function(a){var b=
-new g(this,this);b.operator=a;return b};k.prototype.next=function(a){if(this.closed)throw new d.ObjectUnsubscribedError;if(!this.isStopped){var b=this.observers,c=b.length;b=b.slice();for(var e=0;e<c;e++)b[e].next(a)}};k.prototype.error=function(a){if(this.closed)throw new d.ObjectUnsubscribedError;this.hasError=!0;this.thrownError=a;this.isStopped=!0;var b=this.observers,c=b.length;b=b.slice();for(var e=0;e<c;e++)b[e].error(a);this.observers.length=0};k.prototype.complete=function(){if(this.closed)throw new d.ObjectUnsubscribedError;
-this.isStopped=!0;var a=this.observers,b=a.length;a=a.slice();for(var c=0;c<b;c++)a[c].complete();this.observers.length=0};k.prototype.unsubscribe=function(){this.closed=this.isStopped=!0;this.observers=null};k.prototype._trySubscribe=function(b){if(this.closed)throw new d.ObjectUnsubscribedError;return a.prototype._trySubscribe.call(this,b)};k.prototype._subscribe=function(a){if(this.closed)throw new d.ObjectUnsubscribedError;if(this.hasError)return a.error(this.thrownError),n.Subscription.EMPTY;
-if(this.isStopped)return a.complete(),n.Subscription.EMPTY;this.observers.push(a);return new b.SubjectSubscription(this,a)};k.prototype.asObservable=function(){var a=new p.Observable;a.source=this;return a};k.create=function(a,b){return new g(a,b)};return k}(p.Observable);f.Subject=a;var g=function(a){function b(b,c){a.call(this);this.destination=b;this.source=c}q(b,a);b.prototype.next=function(a){var b=this.destination;b&&b.next&&b.next(a)};b.prototype.error=function(a){var b=this.destination;b&&
-b.error&&this.destination.error(a)};b.prototype.complete=function(){var a=this.destination;a&&a.complete&&this.destination.complete()};b.prototype._subscribe=function(a){return this.source?this.source.subscribe(a):n.Subscription.EMPTY};return b}(a);f.AnonymousSubject=g},function(h,f,a){f.errorObject={e:{}}},function(h,f,a){a.d(f,"a",function(){return e});var q=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=
-!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),p=new Uint32Array(2),n=[];for(h=2;36>=h;++h){f=Math.floor(32/Math.log2(h));a=Math.pow(h,f);var d=Math.floor(f/2),b=Math.pow(h,d);d=Math.pow(h,f-d);var c="^[0-"+String.fromCharCode(48+Math.min(9,h-1));10<h&&(c+="a-"+String.fromCharCode(97+h-11),c+="A-"+String.fromCharCode(65+h-11));c+="]{1,"+Math.ceil(64/Math.log2(h))+"}$";n[h]={lowDigits:f,lowBase:a,lowBase1:b,lowBase2:d,pattern:new RegExp(c)}}var e=
-function(){function a(b,c){b=void 0===b?0:b;c=void 0===c?0:c;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.low=b;this.high=c}q(a,[{key:"clone",value:function(){return new a(this.low,this.high)}},{key:"assign",value:function(a){this.low=a.low;this.high=a.high}},{key:"toString",value:function(a){a=void 0===a?10:a;var b=this.low,c=this.high;if(0===c)return b.toString(a);c*=4294967296;var d=n[a],e=d.lowBase;d=d.lowDigits;var g=c%e;c=Math.floor(c/e);b+=g;c+=Math.floor(b/
-e);b=(b%e).toString(a);return c.toString(a)+"0".repeat(d-b.length)+b}},{key:"tryParseString",value:function(a,b){b=void 0===b?10:b;var c=n[b],d=c.lowDigits,e=c.lowBase,g=c.lowBase1,k=c.lowBase2;if(!c.pattern.test(a))return!1;if(a.length<=d)return this.low=parseInt(a,b),this.high=0,!0;d=a.length-d;c=parseInt(a.substr(d),b);a=parseInt(a.substr(0,d),b);e=Math.floor(a*e/4294967296);g=c+a%4294967296*g%4294967296*k%4294967296;4294967296<=g&&(++e,g-=4294967296);if(g>>>0!==g||e>>>0!==e)return!1;this.low=
-g;this.high=e;return!0}},{key:"parseString",value:function(a,b){if(!this.tryParseString(a,void 0===b?10:b))throw Error("Failed to parse string as uint64 value: "+JSON.stringify(a)+".");return this}},{key:"valid",value:function(){var a=this.low,b=this.high;return a>>>0===a&&b>>>0===b}},{key:"toJSON",value:function(){return this.toString()}},{key:"lshift",value:function(b){b&=63;if(0==b)return this.clone();var c=this.low,d=this.high;return 32>b?new a(c<<b,d<<b|c>>>32-b):new a(0,c<<b-32)}},{key:"rshift",
-value:function(b){b&=63;if(0==b)return this.clone();var c=this.low,d=this.high;return 32>b?new a(c>>>b|d<<32-b,d>>b):new a(d>>b-32,0<=d?0:-1)}},{key:"or",value:function(b){return new a(this.low|b.low,this.high|b.high)}},{key:"xor",value:function(b){return new a(this.low^b.low,this.high^b.high)}},{key:"and",value:function(b){return new a(this.low&b.low,this.high&b.high)}}],[{key:"less",value:function(a,b){return a.high<b.high||a.high===b.high&&a.low<b.low}},{key:"compare",value:function(a,b){return a.high-
-b.high||a.low-b.low}},{key:"equal",value:function(a,b){return a.low===b.low&&a.high===b.high}},{key:"min",value:function(b,c){return a.less(b,c)?b:c}},{key:"random",value:function(){crypto.getRandomValues(p);return new a(p[0],p[1])}},{key:"parseString",value:function(b,c){c=void 0===c?10:c;return(new a).parseString(b,c)}}]);return a}();e.ZERO=new e(0,0)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a,b){l.set(a,b)}f.e=d;f.d=function(a,c){d(a,function(a){var d=this,e=a.id,g=new b.b;a=c.call(this,a,g);this.set(e,{promise:a,
-cancellationToken:g});a.then(function(a){var b=a.value;a=a.transfers;d.delete(e);d.invoke("rpc.promise.response",{id:e,value:b},a)},function(a){d.delete(e);d.invoke("rpc.promise.response",{id:e,error:a.message,errorName:a.name})})})};a.d(f,"a",function(){return m});a.d(f,"b",function(){return r});a.d(f,"c",function(){return u});f.g=function(a){return function(b){b.prototype.RPC_TYPE_ID=a}};f.f=function(a){return function(b){if(void 0!==a)b.prototype.RPC_TYPE_ID=a;else if(a=b.prototype.RPC_TYPE_ID,
-void 0===a)throw Error("RPC_TYPE_ID should have already been defined");v.set(a,b)}};var b=a(32);h=a(1);var c=function y(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return y(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,
-d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=!("undefined"!==typeof Window&&self instanceof Window),l=new Map,k=function(a){function b(a,c){q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,c));d.name=a;d.message=c;return d}n(b,a);return b}(Error);d("rpc.promise.cancel",function(a){this.get(a.id).cancellationToken.cancel()});d("rpc.promise.response",function(a){var c=a.id,d=this.get(c),e=d.resolve;d=d.reject;this.delete(c);a.hasOwnProperty("value")?
-e(a.value):a.errorName===b.a.name?d(b.a):d(new k(a.errorName,a.error))});var t=g?-1:0,m=function(){function a(b){var c=this;q(this,a);this.target=b;this.objects=new Map;this.nextId=t;b.onmessage=function(a){a=a.data;l.get(a.functionName).call(c,a)}}e(a,[{key:"set",value:function(a,b){this.objects.set(a,b)}},{key:"delete",value:function(a){this.objects.delete(a)}},{key:"get",value:function(a){return this.objects.get(a)}},{key:"getRef",value:function(a){var b=this.get(a.id);b.referencedGeneration=a.gen;
-b.addRef();return b}},{key:"invoke",value:function(a,b,c){b.functionName=a;this.target.postMessage(b,c)}},{key:"promiseInvoke",value:function(a,c,d,e){var g=this;d=void 0===d?b.e:d;return Object(b.d)(d,function(b,d,m){var k=c.id=g.newId();g.set(k,{resolve:b,reject:d});g.invoke(a,c,e);m.add(function(){g.invoke("rpc.promise.cancel",{id:k})})})}},{key:"newId",value:function(){return g?this.nextId--:this.nextId++}},{key:"numObjects",get:function(){return this.objects.size}}]);return a}(),r=function(a){function b(){q(this,
-b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.rpc=null;a.rpcId=null;return a}n(b,a);e(b,[{key:"initializeSharedObject",value:function(a,b){b=void 0===b?a.newId():b;this.rpc=a;this.rpcId=b;this.isOwner=!1;a.set(b,this)}},{key:"initializeCounterpart",value:function(a,b){b=void 0===b?{}:b;this.initializeSharedObject(a);this.referencedGeneration=this.unreferencedGeneration=0;this.isOwner=!0;b.id=this.rpcId;b.type=this.RPC_TYPE_ID;a.invoke("SharedObject.new",b)}},{key:"dispose",
-value:function(){c(b.prototype.__proto__||Object.getPrototypeOf(b.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}):c(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),
-"refCountReachedZero",this).call(this)}},{key:"ownerDispose",value:function(){var a=this.rpc,d=this.rpcId;c(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"refCountReachedZero",this).call(this);a.delete(d);a.invoke("SharedObject.dispose",{id:d})}},{key:"counterpartRefCountReachedZero",value:function(a){this.unreferencedGeneration=a;0===this.refCount&&a===this.referencedGeneration&&this.ownerDispose()}}]);return b}(h.a),u=function(a){function b(a,c){c=void 0===c?{}:c;q(this,b);var d=p(this,
-(b.__proto__||Object.getPrototypeOf(b)).call(this));c=void 0===c?{}:c;null!=a&&d.initializeSharedObject(a,c.id);return d}n(b,a);return b}(r);d("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});d("SharedObject.refCountReachedZero",function(a){this.get(a.id).counterpartRefCountReachedZero(a.gen)});var v=new Map;d("SharedObject.new",function(a){--(new (v.get(a.type))(this,
-a)).refCount})},function(h,f,a){h=a(74);a="undefined"!==typeof self&&"undefined"!==typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self;h="undefined"!==typeof window&&window||"undefined"!==typeof h&&h||a;f.root=h;if(!h)throw Error("RxJS could not find any global context (window, self, global)");},function(h,f,a){function q(){try{return n.apply(this,arguments)}catch(d){return p.errorObject.e=d,p.errorObject}}var p=a(13),n;f.tryCatch=function(a){n=a;return q}},function(h,f,a){function q(a,
-b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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)}a.d(f,"g",function(){return y});f.k=function(){return new c.e([y.DATA,y.ANNOTATION,y.DEFAULT_ANNOTATION])};a.d(f,"f",function(){return x});a.d(f,"j",function(){return A});a.d(f,"i",function(){return z});a.d(f,"d",function(){return D});a.d(f,"a",function(){return E});a.d(f,"e",function(){return G});a.d(f,"c",function(){return C});f.l=function(a,b,c,d,e){return d.registerDisposer(new B(a,b,c,function(a){var b=a.redrawNeeded.add(function(){return d.scheduleRedraw()}),
-c=e&&e(a);d.scheduleRedraw();return function(){void 0!==c&&c();b();d.scheduleRedraw()}},d.visibility))};a.d(f,"h",function(){return F});a.d(f,"b",function(){return L});h=a(10);var d=a.n(h);h=a(243);var b=a.n(h),c=a(9),e=a(139);h=a(1);var g=a(2),l=a(4),k=a(7),t=a(244),m=a(14),r=a(29),u=a(40),v=function O(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return O(a,b,c)}else{if("value"in d)return d.value;b=d.get;
-return void 0===b?void 0:b.call(c)}},w=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),y;(function(a){a[a.DATA=0]="DATA";a[a.ANNOTATION=1]="ANNOTATION";a[a.DEFAULT_ANNOTATION=2]="DEFAULT_ANNOTATION"})(y||(y={}));var x=function(a){function b(){q(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,
-arguments));a.ready=!1;a.role=y.DATA;a.layerChanged=new k.a;a.redrawNeeded=new k.a;a.readyStateChanged=new k.a;a.voxelSize=null;a.boundingBox=null;return a}n(b,a);w(b,[{key:"setReady",value:function(a){this.ready=a;this.readyStateChanged.dispatch();this.layerChanged.dispatch()}},{key:"handleAction",value:function(a){}},{key:"getValueAt",value:function(a){}},{key:"transformPickedValue",value:function(a,b){return a}},{key:"updateMouseState",value:function(a,b,c,d){}}]);return b}(h.a),A=function(a){function b(){q(this,
-b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.visibility=new r.a;return a}n(b,a);return b}(x),z=function(a){function b(a,d){q(this,b);var g=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));g.manager=a;g.layersChanged=new k.a;g.readyStateChanged=new k.a;g.specificationChanged=new k.a;g.renderLayers=[];g.isReady=!1;g.tabs=g.registerDisposer(new u.c);g.tool=g.registerDisposer(new c.b(function(a){return Object(e.c)(g,a)},function(a){return a.toJSON()}));d;
-g.tabs.changed.add(g.specificationChanged.dispatch);g.tool.changed.add(g.specificationChanged.dispatch);return g}n(b,a);w(b,[{key:"restoreState",value:function(a){this.tool.restoreState(a.tool);this.tabs.restoreState(a.tab)}},{key:"addRenderLayer",value:function(a){this.renderLayers.push(a);var b=this.layersChanged,c=this.readyStateChanged;a.layerChanged.add(b.dispatch);a.readyStateChanged.add(c.dispatch);c.dispatch();b.dispatch()}},{key:"removeRenderLayer",value:function(a){var b=this.renderLayers,
-c=this.layersChanged,d=this.readyStateChanged,e=b.indexOf(a);if(-1===e)throw Error("Attempted to remove invalid RenderLayer");b.splice(e,1);a.layerChanged.remove(c.dispatch);a.readyStateChanged.remove(d.dispatch);a.dispose();d.dispatch();c.dispatch()}},{key:"disposed",value:function(){for(var a=this.layersChanged,c=this.readyStateChanged,d=$jscomp.makeIterator(this.renderLayers),e=d.next();!e.done;e=d.next())e=e.value,e.layerChanged.remove(a.dispatch),e.readyStateChanged.remove(c.dispatch),e.dispose();
-v(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"getValueAt",value:function(a,b){var c=this.renderLayers,d=b.pickedRenderLayer;if(null!==d&&-1!==c.indexOf(d)){var e=d.transformPickedValue(b.pickedValue,b.pickedOffset);return this.transformPickedValue(e)}b=$jscomp.makeIterator(c);for(c=b.next();!c.done&&(c=c.value,!c.ready||(e=c.getValueAt(a),void 0===e));c=b.next());return this.transformPickedValue(e)}},{key:"transformPickedValue",value:function(a){return a}},
-{key:"toJSON",value:function(){var a={};return a.tab=this.tabs.toJSON(),a.tool=this.tool.toJSON(),a}},{key:"handleAction",value:function(a){}}]);return b}(h.a),D=function(a){function b(a,c,d){c=void 0===c?null:c;d=void 0===d?!0:d;q(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.visible=d;e.readyStateChanged=new k.a;e.layerChanged=new k.a;e.specificationChanged=new k.a;e.wasDisposed=!1;e.layer_=null;e.name_=a;e.layer=c;return e}n(b,a);w(b,[{key:"isReady",value:function(){var a=
-this.layer;return null!==a&&a.isReady}},{key:"handleLayerChanged",value:function(){this.visible&&this.layerChanged.dispatch()}},{key:"setVisible",value:function(a){a!==this.visible&&(this.visible=a,this.layerChanged.dispatch())}},{key:"disposed",value:function(){this.wasDisposed=!0;this.layer=null;v(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"layer",get:function(){return this.layer_},set:function(a){var b=this,c=this.layer_;null!=c&&(this.unregisterUserLayer(),
-c.dispose());this.layer_=a;if(null!=a){var d=[a.layersChanged.add(function(){return b.handleLayerChanged()}),a.readyStateChanged.add(this.readyStateChanged.dispatch),a.specificationChanged.add(this.specificationChanged.dispatch)];this.unregisterUserLayer=function(){d.forEach(function(a){return a()})};this.readyStateChanged.dispatch();this.handleLayerChanged()}}},{key:"name",get:function(){return this.name_},set:function(a){a!==this.name_&&(this.name_=a,this.layerChanged.dispatch())}}]);return b}(h.a),
-E=function(a){function b(){q(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));a.managedLayers=[];a.layerSet=new Set;a.layersChanged=new k.a;a.readyStateChanged=new k.a;a.specificationChanged=new k.a;a.boundPositions=new WeakSet;a.numDirectUsers=0;a.renderLayerToManagedLayerMapGeneration=-1;a.renderLayerToManagedLayerMap_=new Map;a.scheduleRemoveLayersWithSingleRef=a.registerCancellable(d()(function(){return a.removeLayersWithSingleRef()},0));a.layersChanged.add(a.scheduleRemoveLayersWithSingleRef);
-return a}n(b,a);w(b,[{key:"filter",value:function(a){var b=this,c=!1;this.managedLayers=this.managedLayers.filter(function(d){return a(d)?!0:(b.unbindManagedLayer(d),b.layerSet.delete(d),c=!0,!1)});c&&this.layersChanged.dispatch()}},{key:"removeLayersWithSingleRef",value:function(){0<this.numDirectUsers||this.filter(function(a){return 1!==a.refCount})}},{key:"updateSignalBindings",value:function(a,b){b(a.layerChanged,this.layersChanged.dispatch);b(a.readyStateChanged,this.readyStateChanged.dispatch);
-b(a.specificationChanged,this.specificationChanged.dispatch)}},{key:"useDirectly",value:function(){var a=this;1===++this.numDirectUsers&&this.layersChanged.remove(this.scheduleRemoveLayersWithSingleRef);return function(){0===--a.numDirectUsers&&(a.layersChanged.add(a.scheduleRemoveLayersWithSingleRef),a.scheduleRemoveLayersWithSingleRef())}}},{key:"addManagedLayer",value:function(a,b){this.updateSignalBindings(a,t.a);this.layerSet.add(a);void 0===b&&(b=this.managedLayers.length);this.managedLayers.splice(b,
-0,a);this.layersChanged.dispatch();this.readyStateChanged.dispatch();return a}},{key:"addUserLayer",value:function(a,b,c){a=new D(a,b,c);return this.addManagedLayer(a)}},{key:"readyRenderLayers",value:function(){function a(a,l){for(;;)switch(b){case 0:m=$jscomp.makeIterator(r.managedLayers),k=m.next();case 1:if(k.done){b=3;break}g=k.value;if(g.visible&&g.layer){b=4;break}b=2;break;case 4:e=$jscomp.makeIterator(g.layer.renderLayers),d=e.next();case 5:if(d.done){b=7;break}c=d.value;if(c.ready){b=8;
-break}b=6;break;case 8:return b=9,{value:c,done:!1};case 9:if(void 0===l){b=10;break}b=-1;throw l;case 10:case 6:d=e.next();b=5;break;case 7:case 2:k=m.next();b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,c,d,e,g,k,m,r=this,l={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();l[Symbol.iterator]=function(){return this};return l}},{key:"unbindManagedLayer",value:function(a){this.updateSignalBindings(a,
-t.b);a.dispose()}},{key:"clear",value:function(){for(var a=$jscomp.makeIterator(this.managedLayers),b=a.next();!b.done;b=a.next())this.unbindManagedLayer(b.value);this.managedLayers.length=0;this.layerSet.clear();this.layersChanged.dispatch()}},{key:"remove",value:function(a){var b=this.managedLayers[a];this.unbindManagedLayer(b);this.managedLayers.splice(a,1);this.layerSet.delete(b);this.layersChanged.dispatch()}},{key:"removeManagedLayer",value:function(a){a=this.managedLayers.indexOf(a);if(-1===
-a)throw Error("Internal error: invalid managed layer.");this.remove(a)}},{key:"reorderManagedLayer",value:function(a,b){var c=this.managedLayers.length;a===b||0>a||a>=c||0>b||b>=c||(a=$jscomp.makeIterator(this.managedLayers.splice(a,1)).next().value,this.managedLayers.splice(b,0,a),this.layersChanged.dispatch())}},{key:"disposed",value:function(){this.clear();v(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"getLayerByName",value:function(a){return this.managedLayers.find(function(b){return b.name===
-a})}},{key:"getUniqueLayerName",value:function(a){for(var b=a,c=0;void 0!==this.getLayerByName(b);)b=a+ ++c;return b}},{key:"has",value:function(a){return this.layerSet.has(a)}},{key:"initializePosition",value:function(a){var b=this,c=this.boundPositions;c.has(a)||(c.add(a),c=d()(function(){b.updatePositionFromLayers(a)}),this.readyStateChanged.add(c),a.changed.add(c),this.updatePositionFromLayers(a))}},{key:"updatePositionFromLayers",value:function(a){if(!a.valid)for(var b=$jscomp.makeIterator(this.managedLayers),
-c=b.next();!c.done;c=b.next())if(c=c.value.layer,null!=c){c=$jscomp.makeIterator(c.renderLayers);for(var d=c.next();!d.done;d=c.next())if(d=d.value,d.ready&&(a.voxelSize.valid||null==d.voxelSize||(g.s.copy(a.voxelSize.size,d.voxelSize),a.voxelSize.setValid()),!a.spatialCoordinatesValid&&!a.voxelCoordinatesValid&&null!=d.boundingBox)){d=d.boundingBox;var e=a.spatialCoordinates;g.s.add(e,d.lower,d.upper);g.s.scale(e,e,.5);a.spatialCoordinatesValid=!0;a.changed.dispatch()}}}},{key:"invokeAction",value:function(a){for(var b=
-$jscomp.makeIterator(this.managedLayers),c=b.next();!c.done;c=b.next())if(c=c.value,null!==c.layer&&c.visible){c=c.layer;c.handleAction(a);c=$jscomp.makeIterator(c.renderLayers);for(var d=c.next();!d.done;d=c.next())d=d.value,d.ready&&d.handleAction(a)}}},{key:"renderLayerToManagedLayerMap",get:function(){var a=this.layersChanged.count,b=this.renderLayerToManagedLayerMap_;if(this.renderLayerToManagedLayerMapGeneration!==a){this.renderLayerToManagedLayerMapGeneration=a;b.clear();a=$jscomp.makeIterator(this.managedLayers);
-for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=c.layer;if(null!==d){d=$jscomp.makeIterator(d.renderLayers);for(var e=d.next();!e.done;e=d.next())b.set(e.value,c)}}}return b}},{key:"renderLayers",get:function(){var a=this;$jscomp.initSymbol();$jscomp.initSymbolIterator();var b={};return b[Symbol.iterator]=function(){function b(b,l){for(;;)switch(c){case 0:r=$jscomp.makeIterator(a.managedLayers),m=r.next();case 1:if(m.done){c=3;break}k=m.value;if(null!==k.layer){c=4;break}c=2;break;case 4:g=
-$jscomp.makeIterator(k.layer.renderLayers),e=g.next();case 5:if(e.done){c=7;break}d=e.value;c=8;return{value:d,done:!1};case 8:if(void 0===l){c=9;break}c=-1;throw l;case 9:case 6:e=g.next();c=5;break;case 7:case 2:m=r.next();c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,d,e,g,k,m,r,l={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();l[Symbol.iterator]=function(){return this};
-return l},b}},{key:"visibleRenderLayers",get:function(){var a=this;$jscomp.initSymbol();$jscomp.initSymbolIterator();var b={};return b[Symbol.iterator]=function(){function b(b,l){for(;;)switch(c){case 0:r=$jscomp.makeIterator(a.managedLayers),m=r.next();case 1:if(m.done){c=3;break}k=m.value;if(null!==k.layer&&k.visible){c=4;break}c=2;break;case 4:g=$jscomp.makeIterator(k.layer.renderLayers),e=g.next();case 5:if(e.done){c=7;break}d=e.value;c=8;return{value:d,done:!1};case 8:if(void 0===l){c=9;break}c=
--1;throw l;case 9:case 6:e=g.next();c=5;break;case 7:case 2:m=r.next();c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,d,e,g,k,m,r,l={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();l[Symbol.iterator]=function(){return this};return l},b}}]);return b}(h.a),G=function(){function a(){var c=this;q(this,a);this.changed=new k.a;this.position=g.s.create();this.active=!1;this.pickedRenderLayer=
-null;this.pickedValue=new m.a(0,0);this.pickedOffset=0;this.updater=this.pickedAnnotationId=this.pickedAnnotationLayer=void 0;this.stale=!1;this.triggerUpdate=b()(function(){c.update()},50,{leading:!0,trailing:!0})}w(a,[{key:"updateUnconditionally",value:function(){this.triggerUpdate.cancel();this.update();return this.active}},{key:"updateIfStale",value:function(){this.stale&&this.update()}},{key:"update",value:function(){var a=this.updater;this.stale=!1;a?this.setActive(a(this)):this.setActive(!1)}},
-{key:"setActive",value:function(a){this.stale=!1;if(this.active!==a||!0===a)this.active=a,this.changed.dispatch()}}]);return a}(),C=function(a){function b(a,c){q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.layerManager=a;d.mouseState=c;d.values=new Map;d.changed=new k.a;d.needsUpdate=!0;d.registerDisposer(c.changed.add(function(){d.handleChange()}));d.registerDisposer(a.layersChanged.add(function(){d.handleLayerChange()}));return d}n(b,a);w(b,[{key:"handleLayerChange",
-value:function(){this.mouseState.active&&this.handleChange()}},{key:"handleChange",value:function(){this.needsUpdate=!0;this.changed.dispatch()}},{key:"update",value:function(){if(this.needsUpdate){this.needsUpdate=!1;var a=this.values,b=this.mouseState;a.clear();if(b.active)for(var c=b.position,d=$jscomp.makeIterator(this.layerManager.managedLayers),e=d.next();!e.done;e=d.next()){e=e.value;var g=e.layer;e.visible&&g&&a.set(g,g.getValueAt(c,b))}}}},{key:"get",value:function(a){this.update();return this.values.get(a)}},
-{key:"toJSON",value:function(){this.update();for(var a={},b=this.values,c=$jscomp.makeIterator(this.layerManager.managedLayers),d=c.next();!d.done;d=c.next()){d=d.value;var e=d.layer;e&&(e=b.get(e),void 0!==e&&(e instanceof m.a&&(e={t:"u64",v:e}),a[d.name]=e))}return a}}]);return b}(h.a),B=function(a){function b(a,c,e,g,k){q(this,b);var m=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));m.layerManager=a;m.renderLayerType=c;m.roles=e;m.layerAdded=g;m.visibility=k;m.visibleLayers=new Map;
-m.newVisibleLayers=new Set;m.debouncedUpdateVisibleLayers=m.registerCancellable(d()(function(){return m.updateVisibleLayers()},0));m.registerDisposer(a.layersChanged.add(m.debouncedUpdateVisibleLayers));m.registerDisposer(e.changed.add(m.debouncedUpdateVisibleLayers));m.updateVisibleLayers();return m}n(b,a);w(b,[{key:"disposed",value:function(){this.visibleLayers.forEach(function(a){return a()});this.visibleLayers.clear();v(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},
-{key:"updateVisibleLayers",value:function(){for(var a=this.visibleLayers,b=this.newVisibleLayers,c=this.renderLayerType,d=this.layerAdded,e=this.roles,g={},m=$jscomp.makeIterator(this.layerManager.readyRenderLayers()),k=m.next();!k.done;g={disposer:g.disposer,visibilityDisposer:g.visibilityDisposer,typedLayer:g.typedLayer},k=m.next())k=k.value,k instanceof c&&e.has(k.role)&&(g.typedLayer=k,b.add(g.typedLayer),a.has(g.typedLayer)||(g.visibilityDisposer=g.typedLayer.visibility.add(this.visibility),
-g.disposer=d(g.typedLayer),a.set(g.typedLayer.addRef(),function(a){return function(){a.disposer();a.visibilityDisposer();a.typedLayer.dispose()}}(g))));c=$jscomp.makeIterator(a);for(d=c.next();!d.done;d=c.next())e=$jscomp.makeIterator(d.value),d=e.next().value,e=e.next().value,b.has(d)||(a.delete(d),e());b.clear()}},{key:"getVisibleLayers",value:function(){this.debouncedUpdateVisibleLayers.flush();return[].concat($jscomp.arrayFromIterable(this.visibleLayers.keys()))}}]);return b}(h.a),F=function(a){function b(a){q(this,
-b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.layerManager=a;c.changed=new k.a;c.visible_=!1;c.registerDisposer(a);return c}n(b,a);w(b,[{key:"toJSON",value:function(){if(void 0!==this.layer)return{layer:this.layer.name,visible:!0===this.visible?!0:void 0}}},{key:"restoreState",value:function(a){if(void 0===a)this.reset();else{Object(l.t)(a);var b=Object(l.v)(a,"layer",l.y);this.layer=void 0!==b?this.layerManager.getLayerByName(b):void 0;this.visible=Object(l.v)(a,"visible",
-l.w)?!0:!1}}},{key:"reset",value:function(){this.layer=void 0}},{key:"layer",get:function(){return this.layer_},set:function(a){var b=this;if(a!==this.layer_){void 0!==this.layer_&&(this.existingLayerDisposer(),this.existingLayerDisposer=void 0);this.layer_=a;if(void 0!==a){var c=function(){b.layer_=void 0;b.visible=!1;b.existingLayerDisposer=void 0;b.changed.dispatch()};a.registerDisposer(c);var d=a.specificationChanged.add(function(){b.changed.dispatch()});this.existingLayerDisposer=function(){var b=
-a.layer;null!==b&&(b=b.tool.value,void 0!==b&&b.deactivate());a.unregisterDisposer(c);d()}}else this.visible_=!1;this.changed.dispatch()}}},{key:"visible",get:function(){return this.visible_},set:function(a){void 0===this.layer_&&(a=!1);this.visible_!==a&&(this.visible_=a,this.changed.dispatch())}}]);return b}(h.a),L=function(a){function b(a,c){q(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.layerManager=a;e.filter=c;e.changed=new k.a;e.validate=d()(function(){var a=e.layerName_;
-void 0!==a&&(a=e.layerManager.getLayerByName(a),void 0!==a&&e.filter(a)?e.layer_=a:(e.layer_=void 0,e.layerName_=void 0),e.changed.dispatch())},0);e.registerDisposer(a);e.registerDisposer(a.specificationChanged.add(function(){var a=e.layer_;void 0!==a&&(e.layerManager.layerSet.has(a)&&e.filter(a)?(a=a.name,a!==e.layerName_&&(e.layerName_=a,e.changed.dispatch())):(e.layer_=void 0,e.layerName_=void 0,e.changed.dispatch()))}));return e}n(b,a);w(b,[{key:"restoreState",value:function(a){this.layerName=
-Object(l.y)(a)}},{key:"toJSON",value:function(){var a=this.layer_;return void 0!==a?a.name:this.layerName_}},{key:"reset",value:function(){this.layer_=this.layerName_=void 0;this.changed.dispatch()}},{key:"layer",get:function(){return this.layer_},set:function(a){this.layer_!==a&&(void 0!==a&&this.layerManager.layerSet.has(a)&&this.filter(a)?(this.layer_=a,this.layerName_=a.name):this.layerName_=this.layer_=void 0,this.changed.dispatch())}},{key:"layerName",get:function(){return this.layerName_},
-set:function(a){a!==this.layerName_&&(this.layer_=void 0,this.layerName_=a,this.changed.dispatch(),this.validate())}}]);return b}(h.a)},function(h,f,a){h=a(70);a=a(71);f.async=new a.AsyncScheduler(h.AsyncAction)},function(h,f,a){a.d(f,"a",function(){return b});f.b=function(a,d,g,l){for(var c=[],e=3;e<arguments.length;++e)c[e-3]=arguments[e];return a.memoize.get(Object(p.g)({id:"getMemoizedBuffer",getter:Object(n.a)(g),args:c}),function(){var e=new q.b(b.fromData(a,g.apply(null,[].concat($jscomp.arrayFromIterable(c))),
-d,WebGL2RenderingContext.STATIC_DRAW));e.registerDisposer(e.value);return e})};var q=a(1),p=a(4),n=a(23),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),b=function(){function a(b,c){c=void 0===c?WebGL2RenderingContext.ARRAY_BUFFER:c;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");
-this.gl=b;this.bufferType=c;this.gl=b;this.buffer=b.createBuffer()}d(a,[{key:"bind",value:function(){this.gl.bindBuffer(this.bufferType,this.buffer)}},{key:"bindToVertexAttrib",value:function(a,b,c,d,t,m){c=void 0===c?WebGL2RenderingContext.FLOAT:c;d=void 0===d?!1:d;t=void 0===t?0:t;m=void 0===m?0:m;this.bind();this.gl.enableVertexAttribArray(a);this.gl.vertexAttribPointer(a,b,c,d,t,m)}},{key:"setData",value:function(a,b){b=void 0===b?WebGL2RenderingContext.STATIC_DRAW:b;var c=this.gl;this.bind();
-c.bufferData(this.bufferType,a,b)}},{key:"dispose",value:function(){this.gl.deleteBuffer(this.buffer);this.gl=this.buffer=void 0}}],[{key:"fromData",value:function(b,c,d,k){b=new a(b,d);b.setData(c,k);return b}}]);return a}()},function(h,f,a){a.d(f,"k",function(){return n});f.s=function(a){return(a[3]+1/256*a[2]+1/65536*a[1]+1/16777216*a[0])/256};a.d(f,"h",function(){return d});a.d(f,"g",function(){return e});a.d(f,"i",function(){return g});a.d(f,"e",function(){return l});f.r=function(a,b){for(var c=
-0;4>c;++c)a[c]=(b>>8*c&255)/255;return a};f.a=function(a,b){b=void 0===b?1:b;switch(a){case q.b.FLOAT32:if(1===b)return"float";if(1<b&&4>b)return"vec"+b;break;case q.b.UINT8:if(1===b)return"uint8_t";if(1<b&&4>b)return"uint8x"+b+"_t";break;case q.b.UINT16:if(1===b)return"uint16_t";if(2===b)return"uint16x2_t";break;case q.b.UINT32:if(1===b)return"uint32_t";break;case q.b.UINT64:if(1===b)return"uint64_t"}throw Error("No shader type for "+q.b[a]+"["+b+"].");};var q=a(50),p=a(246),n="\nvec4 packFloat01ToFixedPoint(const float value) {\n  const vec4 shift = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0);\n  const vec4 mask = vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);\n  vec4 result = fract(value * shift);\n  result -= result.xxyz * mask;\n  return result * 256.0 / 255.0;\n}\n",
-d="\nvec3 hueToRgb(float hue) {\n  float hue6 = hue * 6.0;\n  float r = abs(hue6 - 3.0) - 1.0;\n  float g = 2.0 - abs(hue6 - 2.0);\n  float b = 2.0 - abs(hue6 - 4.0);\n  return clamp(vec3(r, g, b), 0.0, 1.0);\n}\nvec3 hsvToRgb(vec3 c) {\n  vec3 hueRgb = hueToRgb(c.x);\n  return c.z * ((hueRgb - 1.0) * c.y + 1.0);\n}\n";h=["float","vec2","vec3","vec4"].map(function(a){return"\n"+a+" unnormalizeUint8("+a+" value) {\n  return floor(value * 255.0 + 0.5);\n}\n"}).join("");f.q=h;var b=[h,"\nfloat uintleToFloat(float v) {\n  return unnormalizeUint8(v);\n}\nfloat uintleToFloat(vec2 v) {\n  v = unnormalizeUint8(v);\n  return v.x + v.y * 256.0;\n}\nfloat uintleToFloat(vec3 v) {\n  v = unnormalizeUint8(v);\n  return v.x + v.y * 256.0 + v.z * 256.0 * 256.0;\n}\n"];
-f.p=b;var c=[h,"\nfloat uintbeToFloat(float v) {\n  return unnormalizeUint8(v);\n}\nfloat uintbeToFloat(vec2 v) {\n  v = unnormalizeUint8(v);\n  return v.y + v.x * 256.0;\n}\nfloat uintbeToFloat(vec3 v) {\n  v = unnormalizeUint8(v);\n  return v.z + v.y * 256.0 + v.x * 256.0 * 256.0;\n}\n"];(function(){var a=p.a===p.b.BIG?"be":"le";return[p.a===p.b.BIG?c:b,"\nfloat uintToFloat(float v) {\n  return uint"+a+"ToFloat(v);\n}\nfloat uintToFloat(vec2 v) {\n  return uint"+a+"ToFloat(v);\n}\nfloat uintToFloat(vec3 v) {\n  return uint"+
-a+"ToFloat(v);\n}\n"]})();f.n="\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n";f.o=[h,"\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n","\nstruct uint8_t {\n  float value;\n};\nstruct uint8x2_t {\n  vec2 value;\n};\nstruct uint8x3_t {\n  vec3 value;\n};\nstruct uint8x4_t {\n  vec4 value;\n};\nfloat toRaw(uint8_t x) { return unnormalizeUint8(x.value); }\nfloat toNormalized(uint8_t x) { return x.value; }\nvec2 toRaw(uint8x2_t x) { return unnormalizeUint8(x.value); }\nvec2 toNormalized(uint8x2_t x) { return x.value; }\nvec3 toRaw(uint8x3_t x) { return unnormalizeUint8(x.value); }\nvec3 toNormalized(uint8x3_t x) { return x.value; }\nvec4 toRaw(uint8x4_t x) { return unnormalizeUint8(x.value); }\nvec4 toNormalized(uint8x4_t x) { return x.value; }\nuint64_t toUint64(uint8_t x) {\n  uint64_t result;\n  result.low = vec4(x.value, 0.0, 0.0, 0.0);\n  result.high = vec4(0.0, 0.0, 0.0, 0.0);\n  return result;\n}\n"];
-f.f="\nfloat toRaw(float x) { return x; }\nfloat toNormalized(float x) { return x; }\nvec2 toRaw(vec2 x) { return x; }\nvec2 toNormalized(vec2 x) { return x; }\nvec3 toRaw(vec3 x) { return x; }\nvec3 toNormalized(vec3 x) { return x; }\nvec4 toRaw(vec4 x) { return x; }\nvec4 toNormalized(vec4 x) { return x; }\n";f.l=["\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n",b,"\nstruct uint16_t {\n  vec2 value;\n};\nstruct uint16x2_t {\n  vec4 value;\n};\nfloat toRaw(uint16_t x) { return uintleToFloat(x.value); }\nfloat toNormalized(uint16_t x) { return toRaw(x) / 65535.0; }\nvec2 toRaw(uint16x2_t x) { return vec2(uintleToFloat(x.value.xy), uintleToFloat(x.value.zw)); }\nvec2 toNormalized(uint16x2_t x) { return toRaw(x) / 65535.0; }\nuint64_t toUint64(uint16_t x) {\n  uint64_t result;\n  result.low = vec4(x.value, 0.0, 0.0);\n  result.high = vec4(0.0, 0.0, 0.0, 0.0);\n  return result;\n}\n"];
-h=["\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n","\nstruct uint32_t {\n  vec4 value;\n};\nuint64_t toUint64(uint32_t x) {\n  uint64_t result;\n  result.low = x.value;\n  result.high = vec4(0.0, 0.0, 0.0, 0.0);\n  return result;\n}\n"];f.m=h;var e=["\nvec3 getSubscriptsFromNormalized(vec3 normalizedPosition, vec3 size) {\n  return floor(min(normalizedPosition * size, size - 1.0));\n}\n","\nfloat getFortranOrderIndex(vec3 subscripts, vec3 size) {\n  return subscripts.x + size.x * (subscripts.y + size.y * subscripts.z);\n}\n",
-"\nfloat getFortranOrderIndexFromNormalized(vec3 normalizedPosition, vec3 size) {\n  return getFortranOrderIndex(getSubscriptsFromNormalized(normalizedPosition, size), size);\n}\n"],g="\nfloat imod(float x, float y) {\n  return x - y * floor(x / y);\n}\n",l="\nfloat exactDot(vec4 a, vec4 b) {\n  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n}\nfloat exactDot(vec3 a, vec3 b) {\n  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n";f.d=[h,"\nbool equals(uint32_t a, uint32_t b) {\n  return all(lessThan(abs(a.value - b.value), vec4(1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0)));\n}\n"];
-f.b=[h,"\nuint32_t add(uint32_t a, float b) {\n  uint32_t result;\n  float partial = 0.0;\n\n  partial += a.value.x * 255.0 + b;\n  {\n    float byte0 = mod(partial, 256.0);\n    result.value.x = byte0 / 255.0;\n    partial = (partial - byte0) / 256.0;\n  }\n\n  partial += a.value.y * 255.0;\n  {\n    float byte1 = mod(partial, 256.0);\n    result.value.y = byte1 / 255.0;\n    partial = (partial - byte1) / 256.0;\n  }\n\n  partial += a.value.z * 255.0;\n  {\n    float byte2 = mod(partial, 256.0);\n    result.value.z = byte2 / 255.0;\n    partial = (partial - byte2) / 256.0;\n  }\n\n  partial += a.value.w * 255.0;\n  {\n    float byte3 = mod(partial, 256.0);\n    result.value.w = byte3 / 255.0;\n    partial = (partial - byte3) / 256.0;\n  }\n  return result;\n}\n\nuint32_t add(uint32_t a, uint32_t b) {\n  uint32_t result;\n  float partial = 0.0;\n\n  partial += a.value.x * 255.0 + b.value.x * 255.0;\n  {\n    float byte0 = mod(partial, 256.0);\n    result.value.x = byte0 / 255.0;\n    partial = (partial - byte0) / 256.0;\n  }\n\n  partial += a.value.y * 255.0 + b.value.y * 255.0;\n  {\n    float byte1 = mod(partial, 256.0);\n    result.value.y = byte1 / 255.0;\n    partial = (partial - byte1) / 256.0;\n  }\n\n  partial += a.value.z * 255.0 + b.value.z * 255.0;\n  {\n    float byte2 = mod(partial, 256.0);\n    result.value.z = byte2 / 255.0;\n    partial = (partial - byte2) / 256.0;\n  }\n\n  partial += a.value.w * 255.0 + b.value.w * 255.0;\n  {\n    float byte3 = mod(partial, 256.0);\n    result.value.w = byte3 / 255.0;\n    partial = (partial - byte3) / 256.0;\n  }\n  return result;\n}\n"];
-f.j=[h,"\nuint32_t multiply(uint32_t a, float b) {\n  uint32_t result;\n  float partial = 0.0;\n  partial += a.value.x * 255.0 * b;\n  {\n    float byte0 = mod(floor(partial + 0.5), 256.0);\n    result.value.x = byte0 / 255.0;\n    partial = (partial - byte0) / 256.0;\n  }\n\n  partial += a.value.y * 255.0 * b;\n  {\n    float byte1 = mod(floor(partial + 0.5), 256.0);\n    result.value.y = byte1 / 255.0;\n    partial = (partial - byte1) / 256.0;\n  }\n\n  partial += a.value.z * 255.0 * b;\n  {\n    float byte2 = mod(floor(partial + 0.5), 256.0);\n    result.value.z = byte2 / 255.0;\n    partial = (partial - byte2) / 256.0;\n  }\n\n  partial += a.value.w * 255.0 * b;\n  {\n    float byte3 = mod(floor(partial + 0.5), 256.0);\n    result.value.w = byte3 / 255.0;\n    partial = (partial - byte3) / 256.0;\n  }\n  return result;\n}\n"];
-f.c=[h,"\nfloat divmod(uint32_t dividend, float divisor, out uint32_t quotient) {\n\n  float partial = dividend.value.w * 255.0;\n  float remainder;\n\n  remainder = mod(partial, divisor);\n  quotient.value.w = (partial - remainder) / divisor / 255.0;\n  partial = remainder * 256.0 + dividend.value.z * 255.0;\n\n  remainder = mod(partial, divisor);\n  quotient.value.z = (partial - remainder) / divisor / 255.0;\n  partial = remainder * 256.0 + dividend.value.y * 255.0;\n\n  remainder = mod(partial, divisor);\n  quotient.value.y = (partial - remainder) / divisor / 255.0;\n  partial = remainder * 256.0 + dividend.value.x * 255.0;\n\n  remainder = mod(partial, divisor);\n  quotient.value.x = (partial - remainder) / divisor / 255.0;\n\n  return remainder;\n}\n"]},
-function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function p(a,b){var c="";b&1&&(c+="control+");b&2&&(c+="alt+");b&4&&(c+="meta+");b&8&&(c+="shift+");return c+a}function n(a){return"string"===typeof a?{action:a}:a}function d(a){function b(b,
-m){for(;;)switch(c){case 0:g=a.indexOf(":");a:{b=void 0;var k=a.substring(g+1).split("+"),r=0;k=$jscomp.makeIterator(k);for(var l=k.next();!l.done;l=k.next())switch(l=l.value,l){case "control":r|=1;break;case "alt":r|=2;break;case "meta":r|=4;break;case "shift":r|=8;break;default:if(void 0===b)b=l;else{e=void 0;break a}}e=void 0===b?void 0:p(b,r)}if(void 0!==e){c=1;break}c=-1;throw Error("Invalid event identifier: "+JSON.stringify(a));case 1:if(-1===g){c=2;break}d=a.substring(0,g);if("at"===d||"bubble"===
-d){c=4;break}c=-1;throw Error("Invalid event phase: "+JSON.stringify(d));case 4:return c=5,{value:d+":"+e,done:!1};case 5:if(void 0===m){c=6;break}c=-1;throw m;case 6:c=3;break;case 2:return c=7,{value:"at:"+e,done:!1};case 7:if(void 0===m){c=8;break}c=-1;throw m;case 8:return c=9,{value:"bubble:"+e,done:!1};case 9:if(void 0===m){c=10;break}c=-1;throw m;case 10:case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,d,e,g,k={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,
-a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();k[Symbol.iterator]=function(){return this};return k}a.d(f,"a",function(){return l});f.b=function(a,b,c){a=k[b.eventPhase]+":"+p(a,(b.ctrlKey?1:0)|(b.altKey?2:0)|(b.metaKey?4:0)|(b.shiftKey?8:0));c=c.get(a);void 0!==c&&(!1!==c.stopPropagation&&b.stopPropagation(),a=new CustomEvent("action:"+c.action,{bubbles:!0,detail:b,cancelable:!0}),a=!b.target.dispatchEvent(a),(!1!==c.preventDefault||a)&&b.preventDefault())};
-f.c=function(a,c,d,e){return Object(b.c)(a,"action:"+c,d,e)};var b=a(1);h=a(257);var c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),e=function m(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return m(a,b,c)}else{if("value"in
-d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},g;(function(a){a[a.CONTROL=1]="CONTROL";a[a.ALT=2]="ALT";a[a.META=4]="META";a[a.SHIFT=8]="SHIFT"})(g||(g={}));var l=function(a){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:
-a}q(b,a);c(b,[{key:"setFromObject",value:function(a){for(var b=$jscomp.makeIterator(Object.keys(a)),c=b.next();!c.done;c=b.next())c=c.value,this.set(c,n(a[c]))}},{key:"set",value:function(a,c){c=n(c);a=$jscomp.makeIterator(d(a));for(var g=a.next();!g.done;g=a.next())g=g.value,e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"set",this).call(this,g,c)}},{key:"delete",value:function(a){a=$jscomp.makeIterator(d(a));for(var c=a.next();!c.done;c=a.next())c=c.value,e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),
-"delete",this).call(this,c)}}],[{key:"fromObject",value:function(a,c){c=void 0===c?{}:c;var d=new b;d.label=c.label;if(void 0!==c.parents){c=$jscomp.makeIterator(c.parents);for(var e=c.next();!e.done;e=c.next()){var g=$jscomp.makeIterator(e.value);e=g.next().value;g=g.next().value;d.addParent(e,g)}}c=$jscomp.makeIterator(Object.keys(a));for(e=c.next();!e.done;e=c.next())e=e.value,d.set(e,n(a[e]));return d}}]);return b}(h.a),k=[];k[Event.AT_TARGET]="at";k[Event.CAPTURING_PHASE]="capture";k[Event.BUBBLING_PHASE]=
-"bubble"},function(h,f,a){f.a=function(a){if(a instanceof Object){var d=a[q];void 0===d&&(d=a[q]=p++);return"o"+d}return""+JSON.stringify(a)};$jscomp.initSymbol();var q=Symbol("objectId"),p=0},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function d(a){if("number"!==typeof a||0>a)throw Error("Expected non-negative number as limit, but received: "+JSON.stringify(a));return a}a.d(f,"b",function(){return w});a.d(f,"a",function(){return y});a.d(f,"d",function(){return x});
-a.d(f,"c",function(){return A});a.d(f,"e",function(){return z});f.f=function(a,b){a=function(a){function b(a){for(var c=[],d=0;d<arguments.length;++d)c[d-0]=arguments[d];n(this,b);var e;d=q(this,(e=b.__proto__||Object.getPrototypeOf(b)).call.apply(e,[].concat([this],$jscomp.arrayFromIterable(c))));d.parameters=c[1].parameters;return d}p(b,a);u(b,[{key:"initializeCounterpart",value:function(a,c){c.parameters=this.parameters;r(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initializeCounterpart",
-this).call(this,a,c)}}],[{key:"encodeOptions",value:function(a){var c=r(b.__proto__||Object.getPrototypeOf(b),"encodeOptions",this).call(this,a);c.parameters=a.parameters;return c}}]);return b}(a);return a=v([Object(m.g)(b.RPC_ID)],a)};var b=a(30),c=a(75),e=a(9),g=a(4),l=a(98),k=a(23),t=a(7),m=a(15),r=function E(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return E(a,b,c)}else{if("value"in d)return d.value;
-b=d.get;return void 0===b?void 0:b.call(c)}},u=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),v=this&&this.__decorate||function(a,b,c,d){var e=arguments.length,g=3>e?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,k;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)g=Reflect.decorate(a,
-b,c,d);else for(var m=a.length-1;0<=m;m--)if(k=a[m])g=(3>e?k(g):3<e?k(b,c,g):k(b,c))||g;return 3<e&&g&&Object.defineProperty(b,c,g),g},w=function(){function a(c){n(this,a);this.source=c;this.state=b.d.SYSTEM_MEMORY}u(a,[{key:"copyToGPU",value:function(a){this.state=b.d.GPU_MEMORY}},{key:"freeGPUMemory",value:function(a){this.state=b.d.SYSTEM_MEMORY}},{key:"gl",get:function(){return this.source.gl}}]);return a}(),y=function G(a){var b=void 0===a?{}:a;a=void 0===b.defaultItemLimit?Number.POSITIVE_INFINITY:
-b.defaultItemLimit;b=void 0===b.defaultSizeLimit?Number.POSITIVE_INFINITY:b.defaultSizeLimit;n(this,G);this.sizeLimit=new e.c(b,d);this.itemLimit=new e.c(a,d)},x=function(a){function d(a,b,e){n(this,d);var g=q(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));g.gl=b;g.capacities=e;g.visibleChunksChanged=new t.a;g.pendingChunkUpdates=null;g.pendingChunkUpdatesTail=null;g.chunkUpdateDeadline=null;g.chunkUpdateDelay=30;b=function(b){return{itemLimit:g.registerDisposer(c.a.makeFromExisting(a,b.itemLimit)).rpcId,
-sizeLimit:g.registerDisposer(c.a.makeFromExisting(a,b.sizeLimit)).rpcId}};g.initializeCounterpart(a,{gpuMemoryCapacity:b(e.gpuMemory),systemMemoryCapacity:b(e.systemMemory),downloadCapacity:b(e.download)});return g}p(d,a);u(d,[{key:"scheduleChunkUpdate",value:function(){var a=this.chunkUpdateDeadline;a=null===a||Date.now()<a?0:this.chunkUpdateDelay;setTimeout(this.processPendingChunkUpdates.bind(this),a)}},{key:"processPendingChunkUpdates",value:function(){var a=this.chunkUpdateDeadline;null===a&&
-(a=Date.now()+30);for(var b=!1;;){if(Date.now()>a){setTimeout(this.processPendingChunkUpdates.bind(this),this.chunkUpdateDelay);break}var c=this.pendingChunkUpdates;this.applyChunkUpdate(c)&&(b=!0);c=this.pendingChunkUpdates=c.nextUpdate;--window.numPendingChunkUpdates;if(null==c){this.pendingChunkUpdatesTail=null;break}}b&&this.visibleChunksChanged.dispatch()}},{key:"applyChunkUpdate",value:function(a){var c=!1,d=this.rpc.get(a.source);if(void 0===a.id){c=$jscomp.makeIterator(d.chunks.keys());for(var e=
-c.next();!e.done;e=c.next())d.deleteChunk(e.value);c=!0}else if(e=a.state,e===b.d.EXPIRED)d.deleteChunk(a.id);else{var g=a.id;a["new"]?(a=d.getChunk(a),d.addChunk(g,a)):a=d.chunks.get(g);if(e!==a.state)switch(e){case b.d.GPU_MEMORY:a.copyToGPU(this.gl);c=!0;break;case b.d.SYSTEM_MEMORY:a.freeGPUMemory(this.gl);break;default:throw Error("INTERNAL ERROR: Invalid chunk state: "+b.d[e]);}}return c}}]);return d}(m.b);x=v([Object(m.g)(b.b)],x);window.numPendingChunkUpdates=0;Object(m.e)("Chunk.update",
-function(a){var b=this.get(a.source),c=b.chunkManager.chunkQueueManager;b.immediateChunkUpdates?c.applyChunkUpdate(a)&&c.visibleChunksChanged.dispatch():(b=c.pendingChunkUpdatesTail,++window.numPendingChunkUpdates,null==b?(c.pendingChunkUpdates=a,c.pendingChunkUpdatesTail=a,c.scheduleChunkUpdate()):(b.nextUpdate=a,c.pendingChunkUpdatesTail=a))});var A=function(a){function b(a){n(this,b);var c=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.chunkQueueManager=a;c.memoize=new l.b;c.registerDisposer(a.addRef());
-c.initializeCounterpart(a.rpc,{chunkQueueManager:a.rpcId});return c}p(b,a);u(b,[{key:"getChunkSource",value:function(a,b){var c=this,d=a.encodeOptions(b);d.constructorId=Object(k.a)(a);d=Object(g.g)(d);return this.memoize.get(d,function(){var d=new a(c,b);d.initializeCounterpart(c.rpc,{});return d})}},{key:"gl",get:function(){return this.chunkQueueManager.gl}}]);return b}(m.b);A=v([Object(m.g)(b.a)],A);var z=function(a){function c(a,b){n(this,c);b=q(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));
-b.chunkManager=a;b.chunks=new Map;b.immediateChunkUpdates=!1;return b}p(c,a);u(c,[{key:"initializeCounterpart",value:function(a,b){b.chunkManager=this.chunkManager.rpcId;r(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"initializeCounterpart",this).call(this,a,b)}},{key:"deleteChunk",value:function(a){var c=this.chunks.get(a);c.state===b.d.GPU_MEMORY&&c.freeGPUMemory(this.gl);this.chunks.delete(a)}},{key:"addChunk",value:function(a,b){this.chunks.set(a,b)}},{key:"getChunk",value:function(a){throw Error("Not implemented.");
-}},{key:"invalidateCache",value:function(){this.rpc.invoke(b.c,{id:this.rpcId})}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}],[{key:"encodeOptions",value:function(a){return{}}}]);return c}(m.b)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}
-function n(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 d(a,b,c){var d=a.createShader(c);a.shaderSource(d,b);a.compileShader(d);if(!a.getShaderParameter(d,a.COMPILE_STATUS)){a=a.getShaderInfoLog(d)||"";var g=a.replace("\x00","");d=[];
-g=$jscomp.makeIterator(g.split("\n"));for(var k=g.next();!k.done;k=g.next()){k=k.value;var m=k.match(/^ERROR:\s*(\d+):(\d+)\s*(.+)$/);null!==m?d.push({message:m[3].trim(),file:parseInt(m[1],10),line:parseInt(m[2],10)}):(m=k.match(/^ERROR:\s*(.+)$/),null!==m?d.push({message:m[1]}):(k=k.trim())&&d.push({message:k}))}throw new e(c,b,a,d);}return d}a.d(f,"a",function(){return t});f.b=function(a,b,c){var d=new Map;return function(e){var g=d.get(e);void 0===g&&(g=new t(b),g.require(e),c(g),g=a.registerDisposer(g.build()),
-d.set(e,g));return g}};h=a(1);var b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),c;(function(a){a[a.VERTEX=WebGL2RenderingContext.VERTEX_SHADER]="VERTEX";a[a.FRAGMENT=WebGL2RenderingContext.FRAGMENT_SHADER]="FRAGMENT"})(c||(c={}));var e=function(a){function b(a,d,e,g){q(this,b);var k="Error compiling "+
-c[a].toLowerCase()+" shader: "+e,m=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,k));m.name="ShaderCompilationError";m.log=e;m.message=k;m.shaderType=a;m.source=d;m.errorMessages=g;return m}n(b,a);return b}(Error),g=function(a){function b(a,c,d){q(this,b);var e="Error linking shader: "+d,g=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,e));g.name="ShaderLinkError";g.log=d;g.message=e;g.vertexSource=a;g.fragmentSource=c;return g}n(b,a);return b}(Error),l=function(a){function c(a,
-b,e,k,m){q(this,c);var l=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));l.gl=a;l.vertexSource=b;l.fragmentSource=e;l.attributes=new Map;l.uniforms=new Map;var r=l.vertexShader=d(a,b,a.VERTEX_SHADER),t=l.fragmentShader=d(a,e,a.FRAGMENT_SHADER),u=a.createProgram();a.attachShader(u,r);a.attachShader(u,t);a.linkProgram(u);if(!a.getProgramParameter(u,a.LINK_STATUS))throw a=a.getProgramInfoLog(u)||"",new g(b,e,a);l.program=u;e=l.uniforms;b=l.attributes;if(k)for(k=$jscomp.makeIterator(k),r=k.next();!r.done;r=
-k.next())r=r.value,e.set(r,a.getUniformLocation(u,r));if(m)for(m=$jscomp.makeIterator(m),r=m.next();!r.done;r=m.next())k=r.value,b.set(k,a.getAttribLocation(u,k));return l}n(c,a);b(c,[{key:"uniform",value:function(a){return this.uniforms.get(a)}},{key:"attribute",value:function(a){return this.attributes.get(a)}},{key:"textureUnit",value:function(a){return this.textureUnits.get(a)}},{key:"bind",value:function(){this.gl.useProgram(this.program)}},{key:"disposed",value:function(){var a=this.gl;a.deleteShader(this.vertexShader);
-this.vertexShader=void 0;a.deleteShader(this.fragmentShader);this.fragmentShader=void 0;a.deleteProgram(this.program);this.uniforms=this.attributes=this.gl=this.program=void 0}}]);return c}(h.a),k=function(){function a(){q(this,a);this.code="";this.parts=new Set}b(a,[{key:"add",value:function(a){if(!this.parts.has(a))switch(this.parts.add(a),typeof a){case "string":this.code+=a;break;case "function":this.add(a());break;default:if(Array.isArray(a)){a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=
-a.next())this.add(b.value)}else throw Error("Invalid code type");}}},{key:"toString",value:function(){return this.code}}]);return a}(),t=function(){function a(b){q(this,a);this.gl=b;this.nextTextureUnit=this.nextSymbolID=0;this.varyingsCodeFS=this.varyingsCodeVS=this.attributesCode=this.uniformsCode="";this.fragmentExtensionsSet=new Set;this.fragmentExtensions="";this.vertexCode=new k;this.vertexMain="";this.fragmentCode=new k;this.fragmentMain=this.outputBufferCode="";this.required=new Set;this.uniforms=
-[];this.attributes=[];this.initializers=[];this.textureUnits=new Map}b(a,[{key:"allocateTextureUnit",value:function(a,b){b=void 0===b?1:b;if(this.textureUnits.has(a))throw Error("Duplicate texture unit symbol: "+a);var c=this.nextTextureUnit;this.nextTextureUnit+=b;this.textureUnits.set(a,c);return c}},{key:"addTextureSampler2D",value:function(a,b,c){var d=this.allocateTextureUnit(b,c);this.addUniform("highp sampler2D",a,c);this.addInitializer(function(b){if(c){for(var e=new Int32Array(c),g=0;g<c;++g)e[g]=
-g+d;b.gl.uniform1iv(b.uniform(a),e)}else b.gl.uniform1i(b.uniform(a),d)});return d}},{key:"symbol",value:function(a){return a+this.nextSymbolID++}},{key:"addAttribute",value:function(a,b){this.attributes.push(b);this.attributesCode+="in "+a+" "+b+";\n";return b}},{key:"addVarying",value:function(a,b){this.varyingsCodeVS+="out "+a+" "+b+";\n";this.varyingsCodeFS+="in "+a+" "+b+";\n"}},{key:"addOutputBuffer",value:function(a,b,c){null!==c&&(this.outputBufferCode+="layout(location = "+c+") ");this.outputBufferCode+=
-"out "+a+" "+b+";\n"}},{key:"addUniform",value:function(a,b,c){this.uniforms.push(b);this.uniformsCode=null!=c?this.uniformsCode+("uniform "+a+" "+b+"["+c+"];\n"):this.uniformsCode+("uniform "+a+" "+b+";\n");return b}},{key:"addFragmentExtension",value:function(a){this.fragmentExtensionsSet.has(a)||(this.fragmentExtensionsSet.add(a),this.fragmentExtensions+="#extension "+a+" : require\n")}},{key:"addVertexCode",value:function(a){this.vertexCode.add(a)}},{key:"addFragmentCode",value:function(a){this.fragmentCode.add(a)}},
-{key:"setVertexMain",value:function(a){this.vertexMain=a}},{key:"addVertexMain",value:function(a){this.vertexMain=(this.vertexMain||"")+a}},{key:"setFragmentMain",value:function(a){this.fragmentMain="void main() {\n"+a+"\n}\n"}},{key:"setFragmentMainFunction",value:function(a){this.fragmentMain=a}},{key:"addInitializer",value:function(a){this.initializers.push(a)}},{key:"require",value:function(a){this.required.has(a)||(this.required.add(a),a(this))}},{key:"build",value:function(){var a=new l(this.gl,
-"#version 300 es\nprecision highp float;\n"+this.uniformsCode+"\n"+this.attributesCode+"\n"+this.varyingsCodeVS+"\n"+this.vertexCode+"\nvoid main() {\n"+this.vertexMain+"\n}\n","#version 300 es\n"+this.fragmentExtensions+"\nprecision highp float;\n"+this.uniformsCode+"\n"+this.varyingsCodeFS+"\n"+this.outputBufferCode+"\n"+this.fragmentCode+"\n"+this.fragmentMain+"\n",this.uniforms,this.attributes);a.textureUnits=this.textureUnits;var b=this.initializers;if(0<b.length){a.bind();b=$jscomp.makeIterator(b);
-for(var c=b.next();!c.done;c=b.next())c=c.value,c(a)}return a}}]);return a}()},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"c",function(){return e});a.d(f,"b",function(){return g});var p=a(39),n=a(50),d=a(2);
-a.d(f,"a",function(){return n.b});var b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),c=function k(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return k(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===
-b?void 0:b.call(c)}},e;(function(a){a[a.UNKNOWN=0]="UNKNOWN";a[a.IMAGE=1]="IMAGE";a[a.SEGMENTATION=2]="SEGMENTATION"})(e||(e={}));var g=function(a){function g(a){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");for(var b=void 0===a.lowerVoxelBound?d.h:a.lowerVoxelBound,c=a.upperVoxelBound,e=a.chunkDataSize,k=a.voxelSize,m=a.transform,t=void 0===a.baseVoxelOffset?d.h:a.baseVoxelOffset,f=void 0===a.lowerClipBound?d.s.multiply(d.s.create(),k,b):a.lowerClipBound,h=void 0===
-a.upperClipBound?d.s.multiply(d.s.create(),k,c):a.upperClipBound,p=d.s.multiply(d.s.create(),e,k),E=d.s.create(),G=d.s.create(),C=0;3>C;++C)E[C]=Math.floor(b[C]/e[C]),G[C]=Math.floor((c[C]-1)/e[C]+1);k=(g.__proto__||Object.getPrototypeOf(g)).call(this,{voxelSize:k,transform:m,lowerChunkBound:E,upperChunkBound:G,chunkSize:p});if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");k=!k||"object"!==typeof k&&"function"!==typeof k?this:k;k.baseVoxelOffset=t;k.lowerClipBound=
-f;k.upperClipBound=h;k.lowerVoxelBound=b;k.upperVoxelBound=c;k.chunkDataSize=e;b=k.dataType=a.dataType;c=k.numChannels=a.numChannels;k.chunkBytes=Object(d.l)(e)*n.a[b]*c;k.compressedSegmentationBlockSize=a.compressedSegmentationBlockSize;return k}q(g,a);b(g,[{key:"toObject",value:function(){return Object.assign({},c(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"toObject",this).call(this),{numChannels:this.numChannels,chunkDataSize:this.chunkDataSize,dataType:this.dataType,lowerVoxelBound:this.lowerVoxelBound,
-upperVoxelBound:this.upperVoxelBound,lowerClipBound:this.lowerClipBound,upperClipBound:this.upperClipBound,baseVoxelOffset:this.baseVoxelOffset,compressedSegmentationBlockSize:this.compressedSegmentationBlockSize})}}],[{key:"make",value:function(a){return new g(Object.assign({},a,{transform:Object(p.k)(a.transform,a.volumeSourceOptions)}))}},{key:"fromObject",value:function(a){return new g(a)}},{key:"withDefaultCompression",value:function(a){var b=a.compressedSegmentationBlockSize,c=a.dataType,d=
-a.voxelSize,k=a.transform,m=a.lowerVoxelBound,t=a.upperVoxelBound;k=Object(p.k)(k,a.volumeSourceOptions);void 0!==b||a.volumeType!==e.SEGMENTATION||c!==n.b.UINT32&&c!==n.b.UINT64||(b=Object(p.l)({voxelSize:d,transform:k,lowerVoxelBound:m,upperVoxelBound:t,maxVoxelsPerChunkLog2:9}));return new g(Object.assign({},a,{compressedSegmentationBlockSize:b,transform:k}))}},{key:"getDefaults",value:function(a){var b=Object.assign({},a,{transform:Object(p.k)(a.transform,a.volumeSourceOptions)});return(void 0===
-a.chunkDataSizes?Object(p.j)(b):a.chunkDataSizes).map(function(b){return g.withDefaultCompression(Object.assign({},a,{chunkDataSize:b}))})}}]);return g}(p.i)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a,b,c,d){d=void 0===d?{}:d;return e.a.forPromise(new Promise(function(e){e(a.getVolume(b,c,d))}),{initialMessage:"Retrieving metadata for volume "+c+".",delay:!0,errorPrefix:"Error retrieving metadata for volume "+c+": "})}f.d=d;a.d(f,"b",function(){return t});a.d(f,"c",function(){return m});a.d(f,"a",function(){return r});
-f.e=function(a,b){u.set(a,b)};f.f=function(a,b){v.set(a,b)};var b=a(18),c=a(26),e=a(31);h=a(1);var g=a(4),l=a(7),k=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),t=function(a){function b(a,c,d){q(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));a.initialSpecification=c;a.manager=d;return a}
-n(b,a);k(b,[{key:"toJSON",value:function(){var a=this.layer;if(!a)return this.initialSpecification;a=a.toJSON();this.visible||(a.visible=!1);return a}}]);return b}(b.d),m=function(a){function b(a,c,d,e,g){q(this,b);var k=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));k.dataSourceProvider=a;k.layerManager=c;k.chunkManager=d;k.layerSelectedValues=e;k.voxelSize=g;k.changed=new l.a;k.voxelCoordinatesSet=new l.b;k.spatialCoordinatesSet=new l.b;k.registerDisposer(c.layersChanged.add(k.changed.dispatch));
-k.registerDisposer(c.specificationChanged.add(k.changed.dispatch));return k}n(b,a);k(b,[{key:"reset",value:function(){this.layerManager.clear()}},{key:"restoreState",value:function(a){Object(g.t)(a);this.layerManager.clear();for(var b=$jscomp.makeIterator(Object.keys(a)),c=b.next();!c.done;c=b.next())c=c.value,this.layerManager.addManagedLayer(this.getLayer(c,a[c]))}},{key:"initializeLayerFromSpec",value:function(a,b){var e=this;a.initialSpecification=b;"string"===typeof b&&(b={source:b});Object(g.t)(b);
-var k=Object(g.v)(b,"type",g.y);a.visible=Object(g.v)(b,"visible",function(a){if(void 0===a||!0===a)return!0;if(!1===a)return!1;throw Error("Expected boolean, but received: "+JSON.stringify(a)+".");});var m=function(b,c){b=new b(e,c);b.restoreState(c);a.layer=b},l=a.sourceUrl=Object(g.v)(b,"source",g.y);if(void 0===k){if(void 0===l)throw Error("Either layer 'type' or 'source' URL must be specified.");d(this.dataSourceProvider,this.chunkManager,l).then(function(d){if(-1!==e.layerManager.managedLayers.indexOf(a)){var g=
-v.get(d.volumeType);if(void 0!==g)m(g,b);else throw Error("Unsupported volume type: "+c.c[d.volumeType]+".");}})}else if(l=u.get(k),void 0!==l)m(l,b);else throw Error("Unsupported layer type: "+JSON.stringify(k)+".");}},{key:"getLayer",value:function(a,b){a=new t(a,b,this);this.initializeLayerFromSpec(a,b);return a}},{key:"add",value:function(a,b){-1===this.layerManager.managedLayers.indexOf(a)&&(a.name=this.layerManager.getUniqueLayerName(a.name));this.layerManager.addManagedLayer(a,b)}},{key:"toJSON",
-value:function(){for(var a={},b=0,c=$jscomp.makeIterator(this.layerManager.managedLayers),d=c.next();!d.done;d=c.next()){d=d.value;var e=d.toJSON();null!=e&&(a[d.name]=e,++b)}if(0!==b)return a}},{key:"setVoxelCoordinates",value:function(a){this.voxelCoordinatesSet.dispatch(a)}},{key:"setSpatialCoordinates",value:function(a){this.spatialCoordinatesSet.dispatch(a)}},{key:"worker",get:function(){return this.chunkManager.rpc}},{key:"rpc",get:function(){return this.chunkManager.rpc}},{key:"rootLayers",
-get:function(){return this.layerManager}}]);return b}(h.a),r=function(a){function c(a){q(this,c);var d=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.master=a;d.changed=new l.a;d.layerManager=new b.a;d.registerDisposer(a);a=d.layerManager;d.registerDisposer(a.layersChanged.add(d.changed.dispatch));d.registerDisposer(a.specificationChanged.add(d.changed.dispatch));return d}n(c,a);k(c,[{key:"reset",value:function(){this.layerManager.clear()}},{key:"restoreState",value:function(a){var b=
-this.master.layerManager,c=[];a=$jscomp.makeIterator(new Set(Object(g.a)(a,g.A)));for(var d=a.next();!d.done;d=a.next()){d=d.value;var e=b.getLayerByName(d);if(void 0===e)throw Error("Undefined layer referenced in subset specification: "+JSON.stringify(d));c.push(e)}this.layerManager.clear();b=$jscomp.makeIterator(c);for(c=b.next();!c.done;c=b.next())this.layerManager.addManagedLayer(c.value.addRef())}},{key:"toJSON",value:function(){return this.layerManager.managedLayers.map(function(a){return a.name})}},
-{key:"initializeLayerFromSpec",value:function(a,b){this.master.initializeLayerFromSpec(a,b)}},{key:"getLayer",value:function(a,b){return this.master.getLayer(a,b)}},{key:"add",value:function(a,b){-1===this.master.layerManager.managedLayers.indexOf(a)&&(a.name=this.master.layerManager.getUniqueLayerName(a.name),this.master.layerManager.addManagedLayer(a.addRef()));this.layerManager.addManagedLayer(a,b)}},{key:"setVoxelCoordinates",value:function(a){this.master.setVoxelCoordinates(a)}},{key:"setSpatialCoordinates",
-value:function(a){this.master.setSpatialCoordinates(a)}},{key:"voxelCoordinatesSet",get:function(){return this.master.voxelCoordinatesSet}},{key:"spatialCoordinatesSet",get:function(){return this.master.spatialCoordinatesSet}},{key:"worker",get:function(){return this.master.rpc}},{key:"rpc",get:function(){return this.master.rpc}},{key:"dataSourceProvider",get:function(){return this.master.dataSourceProvider}},{key:"chunkManager",get:function(){return this.master.chunkManager}},{key:"voxelSize",get:function(){return this.master.voxelSize}},
-{key:"layerSelectedValues",get:function(){return this.master.layerSelectedValues}},{key:"rootLayers",get:function(){return this.master.rootLayers}}]);return c}(h.a),u=new Map,v=new Map},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a){return A.get(a)}function b(a){var b=d(a.type).toJSON(a);b.type=y[a.type].toLowerCase();b.id=a.id;b.description=a.description||void 0;a=a.segments;void 0!==a&&0<a.length&&(b.segments=a.map(function(a){return a.toString()}));
-return b}function c(a,b){b=void 0===b?!1:b;Object(t.t)(a);var c=Object(t.v)(a,"type",function(a){return Object(t.m)(a,y)});b={id:Object(t.v)(a,"id",b?t.y:t.A)||e(),description:Object(t.v)(a,"description",t.y),segments:Object(t.v)(a,"segments",function(a){return void 0===a?void 0:Object(t.a)(a,function(a){return u.a.parseString(a)})}),type:c};d(c).restoreState(b,a);return b}function e(){return Object(m.a)(160)}function g(a,b){return a.id<b.id?-1:a.id===b.id?0:1}function l(a){for(var b=0,c=[],e=0,k=
-0,m=$jscomp.makeIterator(x),l=m.next();!l.done;l=m.next()){l=l.value;c[l]=b;for(var r=a[l],t=0,u=$jscomp.makeIterator(r),f=u.next();!f.done;f=u.next())f=f.value.segments,void 0!==f&&(t+=f.length);k+=r.length;e+=t;r.sort(g);r=r.length;l=d(l);b+=l.serializedBytes*r}var v=new Uint32Array(k+1),h=new Uint32Array(2*e);e=[];b=new ArrayBuffer(b);var n=0,w=0;k={};m=$jscomp.makeIterator(x);for(l=m.next();!l.done;k={serializer:k.serializer},l=m.next())l=l.value,r=a[l],e[l]=r.map(function(a){return a.id}),t=
-r.length,u=d(l),k.serializer=u.serializer(b,c[l],t),r.forEach(function(a){return function(b,c){a.serializer(b,c);v[w++]=n;b=b.segments;if(void 0!==b)for(b=$jscomp.makeIterator(b),c=b.next();!c.done;c=b.next())c=c.value,h[2*n]=c.low,h[2*n+1]=c.high,++n}}(k));return{data:new Uint8Array(b),typeToIds:e,typeToOffset:c,segmentListIndex:v,segmentList:h}}a.d(f,"a",function(){return w});a.d(f,"c",function(){return y});f.g=d;a.d(f,"b",function(){return z});a.d(f,"d",function(){return D});f.h=e;f.i=function(a,
-b){return{type:y.AXIS_ALIGNED_BOUNDING_BOX,id:"data-bounds",description:"Data Bounds",pointA:a,pointB:b}};f.f=function(a){if(null==a)return a;var b=a.segments;void 0!==b&&(a.segments=b.map(function(a){return new u.a(a.low,a.high)}));return a};h=a(1);var k=a(2),t=a(4),m=a(136),r=a(7),u=a(14),v=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,
-c);d&&a(b,d);return b}}(),w=function(a){function b(a){q(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.id=a;c.changed=new r.a;return c}n(b,a);return b}(h.a),y;(function(a){a[a.POINT=0]="POINT";a[a.LINE=1]="LINE";a[a.AXIS_ALIGNED_BOUNDING_BOX=2]="AXIS_ALIGNED_BOUNDING_BOX";a[a.ELLIPSOID=3]="ELLIPSOID"})(y||(y={}));var x=[y.POINT,y.LINE,y.AXIS_ALIGNED_BOUNDING_BOX,y.ELLIPSOID];f.e=x;var A=new Map;A.set(y.LINE,{icon:"\ua579",description:"Line",toJSON:function(a){return{pointA:Array.from(a.pointA),
-pointB:Array.from(a.pointB)}},restoreState:function(a,b){a.pointA=Object(t.v)(b,"pointA",t.k);a.pointB=Object(t.v)(b,"pointB",t.k)},serializedBytes:24,serializer:function(a,b,c){var d=new Float32Array(a,b,6*c);return function(a,b){var c=a.pointA;a=a.pointB;b*=6;d[b]=c[0];d[b+1]=c[1];d[b+2]=c[2];d[b+3]=a[0];d[b+4]=a[1];d[b+5]=a[2]}}});A.set(y.POINT,{icon:"\u26ac",description:"Point",toJSON:function(a){return{point:Array.from(a.point)}},restoreState:function(a,b){a.point=Object(t.v)(b,"point",t.k)},
-serializedBytes:12,serializer:function(a,b,c){var d=new Float32Array(a,b,3*c);return function(a,b){a=a.point;b*=3;d[b]=a[0];d[b+1]=a[1];d[b+2]=a[2]}}});A.set(y.AXIS_ALIGNED_BOUNDING_BOX,{icon:"\u2751",description:"Bounding Box",toJSON:function(a){return{pointA:Array.from(a.pointA),pointB:Array.from(a.pointB)}},restoreState:function(a,b){a.pointA=Object(t.v)(b,"pointA",t.k);a.pointB=Object(t.v)(b,"pointB",t.k)},serializedBytes:24,serializer:function(a,b,c){var d=new Float32Array(a,b,6*c);return function(a,
-b){var c=a.pointA;a=a.pointB;b*=6;d[b]=Math.min(c[0],a[0]);d[b+1]=Math.min(c[1],a[1]);d[b+2]=Math.min(c[2],a[2]);d[b+3]=Math.max(c[0],a[0]);d[b+4]=Math.max(c[1],a[1]);d[b+5]=Math.max(c[2],a[2])}}});A.set(y.ELLIPSOID,{icon:"\u25ce",description:"Ellipsoid",toJSON:function(a){return{center:Array.from(a.center),radii:Array.from(a.radii)}},restoreState:function(a,b){a.center=Object(t.v)(b,"center",t.k);a.radii=Object(t.v)(b,"radii",t.j)},serializedBytes:24,serializer:function(a,b,c){var d=new Float32Array(a,
-b,6*c);return function(a,b){var c=a.radii;b*=6;d.set(a.center,b);d.set(c,b+3)}}});var z=function(a){function d(a){a=void 0===a?k.k.create():a;q(this,d);var b=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.objectToLocal=a;b.annotationMap=new Map;b.changed=new r.a;b.readonly=!1;b.pending=new Set;b.references=new Map;return b}n(d,a);$jscomp.initSymbol();$jscomp.initSymbolIterator();v(d,[{key:"add",value:function(a,b){b=void 0===b?!0:b;if(!a.id)a.id=e();else if(this.annotationMap.has(a.id))throw Error("Annotation id already exists: "+
-JSON.stringify(a.id)+".");this.annotationMap.set(a.id,a);this.changed.dispatch();b||this.pending.add(a.id);return this.getReference(a.id)}},{key:"commit",value:function(a){this.pending.delete(a.id)}},{key:"update",value:function(a,b){if(null===a.value)throw Error("Annotation already deleted.");a.value=b;this.annotationMap.set(b.id,b);a.changed.dispatch();this.changed.dispatch()}},{key:Symbol.iterator,value:function(){return this.annotationMap.values()}},{key:"get",value:function(a){return this.annotationMap.get(a)}},
-{key:"delete",value:function(a){null!==a.value&&(a.value=null,this.annotationMap.delete(a.id),this.pending.delete(a.id),a.changed.dispatch(),this.changed.dispatch())}},{key:"getReference",value:function(a){var b=this,c=this.references.get(a);if(void 0!==c)return c.addRef();c=new w(a);c.value=this.annotationMap.get(a)||null;this.references.set(a,c);c.registerDisposer(function(){b.references.delete(a)});return c}},{key:"toJSON",value:function(){for(var a=[],c=this.pending,d=$jscomp.makeIterator(this),
-e=d.next();!e.done;e=d.next())e=e.value,c.has(e.id)||a.push(b(e));return a}},{key:"clear",value:function(){this.annotationMap.clear();this.pending.clear();this.changed.dispatch()}},{key:"restoreState",value:function(a){var b=this.annotationMap;b.clear();this.pending.clear();void 0!==a&&Object(t.a)(a,function(a){a=c(a);b.set(a.id,a)});a=$jscomp.makeIterator(this.references.values());for(var d=a.next();!d.done;d=a.next()){d=d.value;var e=b.get(d.id);d.value=e||null;d.changed.dispatch()}this.changed.dispatch()}},
-{key:"reset",value:function(){this.clear()}}]);return d}(h.a),D=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);return b}(z);(function(){function a(){q(this,a);this.annotations=[[],[],[],[]]}v(a,[{key:"add",value:function(a){this.annotations[a.type].push(a)}},{key:"serialize",value:function(){return l(this.annotations)}}]);return a})()},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
-}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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)}a.d(f,"b",function(){return e});
-a.d(f,"a",function(){return g});f.c=function(a){return function(a){function e(){q(this,e);var a=p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments));a.visibility=new g;return a}n(e,a);c(e,[{key:"initializeCounterpart",value:function(a,c){c=void 0===c?{}:c;c.visibility=this.registerDisposer(d.a.makeFromExisting(a,this.visibility)).rpcId;b(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"initializeCounterpart",this).call(this,a,c)}}]);return e}(a)};var d=a(75);h=a(9);var b=
-function k(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return k(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),e=function(a){function b(a){a=
-void 0===a?Number.NEGATIVE_INFINITY:a;q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a))}n(b,a);c(b,[{key:"visible",get:function(){return this.value===Number.POSITIVE_INFINITY}},{key:"ignored",get:function(){return this.value===Number.NEGATIVE_INFINITY}}]);return b}(h.f);e.VISIBLE=Number.POSITIVE_INFINITY;e.IGNORED=Number.NEGATIVE_INFINITY;var g=function(a){function b(){q(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.contributors=
-new Map;return a}n(b,a);c(b,[{key:"add",value:function(a){var b=this,c=this.contributors,d=a.changed.add(function(){b.update()}),e=function(){c.delete(e);d();b.update()};c.set(e,a);this.update();return e}},{key:"update",value:function(){for(var a=Number.NEGATIVE_INFINITY,b=$jscomp.makeIterator(this.contributors.values()),c=b.next();!c.done;c=b.next())a=Math.max(a,c.value.value);this.value=a}}]);return b}(e)},function(h,f,a){a.d(f,"d",function(){return q});var q;(function(a){a[a.GPU_MEMORY=0]="GPU_MEMORY";
-a[a.SYSTEM_MEMORY=1]="SYSTEM_MEMORY";a[a.SYSTEM_MEMORY_WORKER=2]="SYSTEM_MEMORY_WORKER";a[a.DOWNLOADING=3]="DOWNLOADING";a[a.QUEUED=4]="QUEUED";a[a.NEW=5]="NEW";a[a.FAILED=6]="FAILED";a[a.EXPIRED=7]="EXPIRED"})(q||(q={}));var p;(function(a){a[a.FIRST_TIER=0]="FIRST_TIER";a[a.FIRST_ORDERED_TIER=0]="FIRST_ORDERED_TIER";a[a.VISIBLE=0]="VISIBLE";a[a.PREFETCH=1]="PREFETCH";a[a.LAST_ORDERED_TIER=1]="LAST_ORDERED_TIER";a[a.RECENT=2]="RECENT";a[a.LAST_TIER=2]="LAST_TIER"})(p||(p={}));f.b="ChunkQueueManager";
-f.a="ChunkManager";f.c="ChunkSource.invalidate"},function(h,f,a){a.d(f,"a",function(){return n});var q=function(){function a(a,c){for(var b=0;b<c.length;b++){var d=c[b];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();a(247);var p=null,n=function(){function a(b){b=void 0===b?!1:b;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");null===p&&(p=
-document.createElement("ul"),p.id="statusContainer",document.body.appendChild(p));var c=document.createElement("li");this.element=c;!0===b&&(b=200);!1!==b?(this.setVisible(!1),this.timer=setTimeout(this.setVisible.bind(this,!0),b)):this.timer=null;p.appendChild(c)}q(a,[{key:"dispose",value:function(){p.removeChild(this.element);this.element=void 0;null!==this.timer&&clearTimeout(this.timer)}},{key:"setText",value:function(a,c){this.element.textContent=a;c&&this.setVisible(!0)}},{key:"setHTML",value:function(a,
-c){this.element.innerHTML=a;c&&this.setVisible(!0)}},{key:"setVisible",value:function(a){null!==this.timer&&(clearTimeout(this.timer),this.timer=null);this.element.style.display=a?"block":"none"}},{key:"setErrorMessage",value:function(a){var b=this;this.element.textContent=a+" ";a=document.createElement("button");a.textContent="Dismiss";a.addEventListener("click",function(){b.dispose()});this.element.appendChild(a)}}],[{key:"forPromise",value:function(b,c){var d=new a(c.delay);d.setText(c.initialMessage);
-var g=d.dispose.bind(d);b.then(g,function(a){d.setErrorMessage((void 0===c.errorPrefix?"":c.errorPrefix)+(a instanceof Error?a.message:""+a));d.setVisible(!0)});return b}},{key:"showMessage",value:function(b){var c=new a;c.element.textContent=b;c.setVisible(!0);return c}},{key:"showTemporaryMessage",value:function(a,c){c=void 0===c?2E3:c;var b=this.showMessage(a);setTimeout(function(){return b.dispose()},c);return b}}]);return a}()},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==
-b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}a.d(f,"b",function(){return c});a.d(f,"c",function(){return e});f.d=function(a,d){return new Promise(function(e,g){if(a===b)d(e,g,b);else{var k=
-new c,l=a.add(function(){k.cancel()});d(function(a){l();e(a)},function(a){l();g(a)},k)}})};var n=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();h=new (function(){function a(){p(this,a);this.name="CancellationError";this.message="CANCELED"}n(a,[{key:"toString",value:function(){return"CANCELED"}}]);return a}());
-f.a=h;var d=function(){},b={isCanceled:!1,add:function(){return d},remove:d};f.e=b;var c=function(){function a(){p(this,a)}n(a,[{key:"cancel",value:function(){var a=this.handlers;if(null!==a&&(this.handlers=null,void 0!==a)){a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next())b=b.value,b()}}},{key:"add",value:function(a){var b=this,c=this.handlers;if(null===c)return a(),d;void 0===c&&(c=this.handlers=new Set);c.add(a);return function(){b.remove(a)}}},{key:"remove",value:function(a){var b=
-this.handlers;null!=b&&b.delete(a)}},{key:"isCanceled",get:function(){return null===this.handlers}}]);return a}(),e=function(a){function c(){p(this,c);var a=(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a.consumers=new Set;return a}q(c,a);n(c,[{key:"addConsumer",value:function(a){var c=this;a=void 0===a?b:a;var d=this.consumers;d.has(a)||
-a.isCanceled||(d.add(a),a.add(function(){d.delete(a);0===d.size&&c.cancel()}))}}]);return c}(c)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a,b){for(var c=$jscomp.makeIterator(l),d=c.next();!d.done;d=c.next())if(d=d.value,d=d(a,b),null!=d)return d;throw Error("No chunk format handler found.");}f.c=function(a){l.push(a)};a.d(f,"b",function(){return k});a.d(f,"a",function(){return t});h=a(44);var b=a(2),c=function(){function a(a,b){for(var c=
-0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),e=b.s.create(),g=b.s.create(),l=[],k=function(a){function k(a,b){q(this,k);b=p(this,(k.__proto__||Object.getPrototypeOf(k)).call(this,a,b));b.chunkFormatHandler=b.registerDisposer(d(a.chunkQueueManager.gl,b.spec));return b}n(k,a);c(k,[{key:"getValueAt",value:function(a,c){c=void 0===c?this.spec.chunkLayout:
-c;var d=this.spec,k=c.size;c.globalToLocalSpatial(g,a);for(a=0;3>a;++a)e[a]=Math.floor(g[a]/k[a]);a=Object(b.t)(e);a=this.chunks.get(a);if(!a)return null;c=d.voxelSize;for(var l=0;3>l;++l)e[l]=Math.floor((g[l]-e[l]*k[l])/c[l]);k=a.chunkDataSize;for(c=0;3>c;++c)if(e[c]>=k[c])return;d=d.numChannels;if(1===d)return a.getChannelValueAt(e,0);k=Array(d);for(c=0;c<d;++c)k[c]=a.getChannelValueAt(e,c);return k}},{key:"getChunk",value:function(a){return this.chunkFormatHandler.getChunk(this,a)}},{key:"chunkFormat",
-get:function(){return this.chunkFormatHandler.chunkFormat}}]);return k}(h.c),t=function(a){function b(a,c){q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));d.chunkDataSize=c.chunkDataSize||a.spec.chunkDataSize;return d}n(b,a);c(b,[{key:"chunkFormat",get:function(){return this.source.chunkFormat}}]);return b}(h.b)},function(h,f,a){a.d(f,"a",function(){return q});f.b=1E-6;var q="undefined"!==typeof Float32Array?Float32Array:Array;f.c=Math.random},function(h,f,a){function q(a,
-b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a,b){if(!(a instanceof
-b))throw new TypeError("Cannot call a class as a function");}a.d(f,"b",function(){return g});a.d(f,"c",function(){return l});a.d(f,"a",function(){return k});h=a(10);var d=a.n(h);h=a(1);var b=a(7),c=function m(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return m(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=
-b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=function(){function a(c,d){d=void 0===d?c:d;n(this,a);this.value_=c;this.defaultValue=d;this.changed=new b.a}e(a,[{key:"toggle",value:function(){this.value=!this.value}},{key:"toJSON",value:function(){if(this.value_!==this.defaultValue)return this.value_}},{key:"restoreState",value:function(a){this.value=!0===a||!1===
-a?a:this.defaultValue}},{key:"reset",value:function(){this.value=this.defaultValue}},{key:"value",get:function(){return this.value_},set:function(a){a!==this.value_&&(this.value_=a,this.changed.dispatch())}}]);return a}(),l=function(a){function b(a){n(this,b);var c=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.model=a;c.element=document.createElement("input");var d=c.element;d.type="checkbox";c.registerDisposer(a.changed.add(function(){c.updateCheckbox()}));c.updateCheckbox();c.registerEventListener(d,
-"change",function(b){a.value=this.checked});d.addEventListener("mousedown",function(a){a.preventDefault()});return c}p(b,a);e(b,[{key:"updateCheckbox",value:function(){this.element.checked=this.model.value}},{key:"disposed",value:function(){var a=this.element,d=a.parentElement;d&&d.removeChild(a);c(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}}]);return b}(h.a),k=function(a){function b(a,c){n(this,b);var e=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));
-e.model=a;e.element=c;e.initialDisplay=e.element.style.display;e.updateVisibility();e.registerDisposer(a.changed.add(e.registerCancellable(d()(function(){return e.updateVisibility()},0))));return e}p(b,a);e(b,[{key:"updateVisibility",value:function(){this.element.style.display=this.model.value?this.initialDisplay:"none"}}]);return b}(h.a)},function(h,f,a){f.isArray=Array.isArray||function(a){return a&&"number"===typeof a.length}},function(h,f,a){f.isScheduler=function(a){return a&&"function"===typeof a.schedule}},
-function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(0);var p=a(124),n=a(42),d=a(37);a=function(a){function b(b,c){a.call(this);this.array=b;this.scheduler=c;c||1!==b.length||(this._isScalar=!0,this.value=b[0])}q(b,a);b.create=function(a,c){return new b(a,c)};b.of=function(){for(var a=[],c=0;c<arguments.length;c++)a[c-0]=arguments[c];c=a[a.length-
-1];d.isScheduler(c)?a.pop():c=null;var l=a.length;return 1<l?new b(a,c):1===l?new p.ScalarObservable(a[0],c):new n.EmptyObservable(c)};b.dispatch=function(a){var b=a.array,c=a.index,d=a.subscriber;c>=a.count?d.complete():(d.next(b[c]),d.closed||(a.index=c+1,this.schedule(a)))};b.prototype._subscribe=function(a){var c=this.array,d=c.length,e=this.scheduler;if(e)return e.schedule(b.dispatch,0,{array:c,index:0,count:d,subscriber:a});for(e=0;e<d&&!a.closed;e++)a.next(c[e]);a.complete()};return b}(h.Observable);
-f.ArrayObservable=a},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a,b,c){for(var d=0;3>d;++d)a[d]=Number.POSITIVE_INFINITY,
-b[d]=Number.NEGATIVE_INFINITY;c=$jscomp.makeIterator(c);for(d=c.next();!d.done;d=c.next()){var e=d.value.spec;d=e.lowerChunkBound;e=e.upperChunkBound;for(var g=0;3>g;++g)a[g]=Math.min(a[g],d[g]),b[g]=Math.max(b[g],e[g])}}function d(a,b,c,d){for(var e=v.FULLY_INSIDE,g=0;3>g;++g){var k=a[g];var l=b[g],m=c[g],r=d[g];k=k>=r||l<=m?v.FULLY_OUTSIDE:k>=m&&l<=r?v.FULLY_INSIDE:v.PARTIALLY_INSIDE;switch(k){case v.FULLY_OUTSIDE:return k;case v.PARTIALLY_INSIDE:e=k}}return e}function b(a){var b=a.transform,c=
-a.transformedSources,d=b.changed.count;d!==a.transformedSourcesGeneration&&(a.transformedSourcesGeneration=d,c=m.k.equals(b.transform,m.d)?a.sources.map(function(a){return a.map(function(a){return{source:a,chunkLayout:a.spec.chunkLayout}})}):a.sources.map(function(a){return a.map(function(a){var c=a.spec.chunkLayout;return{chunkLayout:l.a.get(c.size,g(c.transform,b)),source:a}})}),a.transformedSources=c);return c}function c(a,b){var c=b.length,d=0;if(1<c)for(var e=0,g=0;g<c;++g){var k=b[g].chunkLayout;
-var l=k.size;k=k.globalToLocalSpatialVector(u,a);for(var m=0,r=0,t=1,f=0;3>f;++f){var v=l[f];t*=v;v*=k[f];m=Math.min(m,v);r=Math.max(r,v)}l=t/(r-m);l>e&&(e=l,d=g)}return b[d]}function e(a){var b=a.voxelSize,c=void 0===a.lowerVoxelBound?m.h:a.lowerVoxelBound,d=a.upperVoxelBound,e=void 0===a.maxVoxelsPerChunkLog2?18:a.maxVoxelsPerChunkLog2;a=void 0===a.transform?m.d:a.transform;a=Object(m.c)(m.s.create(),a);b=m.s.multiply(a,a,b);a=m.s.fromValues(1,1,1);if(void 0===d)var g=m.f;else{g=m.s.create();for(var k=
-0;3>k;++k)g[k]=Math.pow(2,Math.floor(Math.log2(d[k]-c[k])))}for(c=0;c<e;++c){d=Infinity;k=-1;for(var l=0;3>l;++l)if(!(a[l]>=g[l])){var r=a[l]*b[l];r<d&&(d=r,k=l)}d=k;if(-1===d)break;a[d]*=2}return a}function g(a,b){b=b.transform;return void 0===b?void 0===a?m.d:a:void 0===a?b:m.k.multiply(m.k.create(),b,a)}f.m=b;a.d(f,"h",function(){return y});f.l=e;a.d(f,"a",function(){return x});f.k=g;f.j=function(a){if(void 0!==a.chunkDataSizes)return a.chunkDataSizes;var b=void 0===a.chunkLayoutPreference?x.ISOTROPIC:
-a.chunkLayoutPreference;switch(b){case x.ISOTROPIC:return[e(a)];case x.FLAT:b=[];for(var c=0;3>c;++c){var d=c;var g=a.lowerVoxelBound;var k=a.upperVoxelBound,l=c,r=a.voxelSize,t=a.maxVoxelsPerChunkLog2,f=a.transform;m.s.subtract(u,void 0===k?m.f:k,void 0===g?m.h:g);u[l]=1;g=e({voxelSize:r,upperVoxelBound:u,maxVoxelsPerChunkLog2:t,transform:f});b[d]=g}b.push(e(a));return b}throw Error("Invalid chunk layout preference: "+b+".");};a.d(f,"i",function(){return A});var l=a(232),k=a(43),t=a(233);a(50);var m=
-a(2);h=a(15);var r=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),u=m.s.create(),v;(function(a){a[a.FULLY_OUTSIDE=0]="FULLY_OUTSIDE";a[a.FULLY_INSIDE=1]="FULLY_INSIDE";a[a.PARTIALLY_INSIDE=2]="PARTIALLY_INSIDE"})(v||(v={}));var w=[m.s.create(),m.s.create(),m.s.create(),m.s.create()],y=function(a){function e(){q(this,
-e);var a=(e.__proto__||Object.getPrototypeOf(e)).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=m.k.create();a.viewportAxes=[m.s.create(),m.s.create(),m.s.create()];a.previousViewportAxes=[m.s.create(),m.s.create()];a.centerDataPosition=m.s.create();a.viewportPlaneDistanceToOrigin=0;a.visibleChunkLayouts=
-new Map;a.visibleLayers=new Map;a.visibleSourcesStale=!0;a.pixelSize=0;m.k.identity(a.viewportToData);return a}p(e,a);r(e,[{key:"onViewportChanged",value:function(){}},{key:"maybeSetHasValidViewport",value:function(){!this.hasValidViewport&&-1!==this.width&&-1!==this.height&&this.hasViewportToData&&(this.hasValidViewport=!0,this.onHasValidViewport());if(this.hasValidViewport)this.onViewportChanged()}},{key:"onHasValidViewport",value:function(){}},{key:"setViewportSize",value:function(a,b){return a!==
-this.width||b!==this.height?(this.width=a,this.height=b,this.maybeSetHasValidViewport(),!0):!1}},{key:"setViewportToDataMatrix",value:function(a){if(this.hasViewportToData&&m.k.equals(this.viewportToData,a))return!1;this.hasViewportToData=!0;var b=this.viewportToData;m.k.copy(b,a);Object(m.o)(b);m.s.transformMat4(this.centerDataPosition,m.h,a);a=0;for(var c=this.viewportAxes,d=this.previousViewportAxes,e=0;3>e;++e){var g=c[e];Object(m.p)(g,m.e[e],b);0===e&&(a=m.s.length(g));m.s.normalize(g,g)}this.viewportAxes=
-c;this.previousViewportAxes=d;if(!Object(t.a)(a,this.pixelSize)||.95>m.s.dot(c[0],d[0])||.95>m.s.dot(c[1],d[1]))m.s.copy(d[0],c[0]),m.s.copy(d[1],c[1]),this.visibleSourcesStale=!0,this.pixelSize=a;this.viewportPlaneDistanceToOrigin=m.s.dot(this.centerDataPosition,this.viewportAxes[2]);this.onViewportToDataMatrixChanged();this.maybeSetHasValidViewport();return!0}},{key:"onViewportToDataMatrixChanged",value:function(){}},{key:"updateVisibleSources",value:function(){if(this.visibleSourcesStale){this.visibleSourcesStale=
-!1;var a=1.1*this.pixelSize,d=this.visibleChunkLayouts,e=this.viewportAxes[2],g=this.visibleLayers;d.clear();var k={};g=$jscomp.makeIterator(g);for(var l=g.next();!l.done;k={smallestVoxelSize:k.smallestVoxelSize,visibleSources:k.visibleSources},l=g.next()){l=$jscomp.makeIterator(l.value);var m=l.next().value;k.visibleSources=l.next().value;k.visibleSources.length=0;l=b(m);var r=l.length;m=void 0;k.smallestVoxelSize=l[0][0].source.spec.voxelSize;var t=function(b){return function(c){for(var d=0;3>d;++d){var e=
-c[d];if(e>a&&e>b.smallestVoxelSize[d])return!0}return!1}}(k),u=function(a){return function(b,c){var e=b.source,g=b.chunkLayout;a.visibleSources[a.visibleSources.length++]=b;b=d.get(g);void 0===b&&(b=new Map,d.set(g,b));b.set(e,c)}}(k);for(m=r-1;;){r=c(e,l[m]);u(r,m);if(0===m||!t(r.source.spec.voxelSize))break;--m}k.visibleSources.reverse()}}}},{key:"computeVisibleChunks",value:function(a,b){var c=this;this.updateVisibleSources();for(var e=this.width,g=this.height,l=this.viewportToData,r=0;3>r;++r)w[0][r]=
--m.e[0][r]*e/2-m.e[1][r]*g/2,w[1][r]=-m.e[0][r]*e/2+m.e[1][r]*g/2,w[2][r]=m.e[0][r]*e/2-m.e[1][r]*g/2,w[3][r]=m.e[0][r]*e/2+m.e[1][r]*g/2;for(e=0;4>e;++e)m.s.transformMat4(w[e],w[e],l);var t=m.s.create(),f=m.s.create(),h=m.s.create(),p=m.s.create(),x=m.s.create(),D=m.s.create(),y=[],z=[];this.visibleChunkLayouts.forEach(function(e,g){function l(){for(var a=0,b=0,c=0;3>c;++c){var d=D[c],e=t[c],g=f[c]-e,k=x[c]*g;a+=d*(e+k);b+=d*(e+g-k)}return a<G?!1:b<=G}function r(a){function c(){F=Object(k.c)(y,0,
-w,function(a){var b=a.spec;switch(d(t,f,b.lowerChunkBound,b.upperChunkBound)){case v.PARTIALLY_INSIDE:return!0;case v.FULLY_INSIDE:z.push(a);default:return!1}})}if(0!==z.length||0!==F){for(var e=1,m=0;3>m;++m)e*=Math.max(0,f[m]-t[m]);if(0!==e&&l())if(1===e)b(g,q,t,z);else{for(var u;;)if(e=t[a],m=f[a],u=m-e,1===u)a=(a+1)%3;else break;u=e+Math.floor(.5*u);var h=(a+1)%3,n=z.length;f[a]=u;var w=F;c();r(h);z.length=n;F=w;f[a]=m;t[a]=u;c();r(h);t[a]=e;z.length=n;F=w}}}var q=a(g);n(h,p,e.keys());m.s.set(t,
-Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);m.s.set(f,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);g.globalToLocalSpatialVector(D,c.viewportAxes[2]);for(var C=0;3>C;++C)x[C]=0<D[C]?1:0;var G=m.s.dot(g.globalToLocalGrid(u,c.centerDataPosition),D);for(C=0;4>C;++C)for(var E=g.globalToLocalGrid(u,w[C]),A=0;3>A;++A)t[A]=Math.min(t[A],Math.floor(E[A])),f[A]=Math.max(f[A],Math.floor(E[A])+1);m.s.max(t,t,h);m.s.min(f,f,p);z.length=0;y.length=
-0;e=$jscomp.makeIterator(e.keys());for(C=e.next();!C.done;C=e.next())switch(C=C.value,E=C.spec,d(t,f,E.lowerChunkBound,E.upperChunkBound)){case v.FULLY_INSIDE:z.push(C);break;case v.PARTIALLY_INSIDE:y.push(C)}var F=y.length;r(0)})}}]);return e}(h.b),x;(function(a){a[a.ISOTROPIC=0]="ISOTROPIC";a[a.FLAT=1]="FLAT"})(x||(x={}));var A=function(){function a(b){q(this,a);var c=b.chunkSize,d=b.transform,e=void 0===b.lowerChunkBound?m.h:b.lowerChunkBound,g=b.upperChunkBound;this.voxelSize=b.voxelSize;this.chunkLayout=
-l.a.get(c,d);this.lowerChunkBound=e;this.upperChunkBound=g}r(a,[{key:"toObject",value:function(){return{transform:this.chunkLayout.transform,chunkSize:this.chunkLayout.size,voxelSize:this.voxelSize,lowerChunkBound:this.lowerChunkBound,upperChunkBound:this.upperChunkBound}}}]);return a}();f.f="SliceView";f.d="sliceview/RenderLayer";f.b="SliceView.addVisibleLayer";f.c="SliceView.removeVisibleLayer";f.g="SliceView.updateView";f.e="SliceView.updateTransform"},function(h,f,a){function q(a,b){if(!(a instanceof
-b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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)}a.d(f,"b",function(){return l});a.d(f,"a",function(){return k});a.d(f,"c",function(){return t});a.d(f,"d",function(){return m});h=a(245);a.n(h);h=a(1);var d=a(8),b=a(7),c=a(29),e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=function u(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,
-b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return u(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},l=function(a){function b(a){a=void 0===a?new c.b:a;q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.visibility=a;d.element=document.createElement("div");d.element.classList.add("neuroglancer-tab-content");return d}n(b,a);e(b,[{key:"disposed",value:function(){Object(d.b)(this.element);g(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),
-"disposed",this).call(this)}},{key:"visible",get:function(){return this.visibility.visible}}]);return b}(h.a);a=function(a){function c(){q(this,c);var a=p(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments));a.changed=new b.a;a.options=new Map;a.optionsChanged=new b.a;a.selectedValue=void 0;a.defaultValue=void 0;a.ready_=!0;return a}n(c,a);e(c,[{key:"add",value:function(a,b){var c=this.options;if(c.has(a))throw Error("Option already defined: "+JSON.stringify(a)+".");c.set(a,b);this.optionsChanged.dispatch();
-void 0===this.defaultValue&&(this.default=a)}},{key:"toJSON",value:function(){var a=this.value;if(a!==this.defaultValue)return a}},{key:"reset",value:function(){this.value=void 0}},{key:"restoreState",value:function(a){"string"!==typeof a&&(a=void 0);this.value=a}},{key:"value",get:function(){var a=this.selectedValue;return void 0!==a?a:this.defaultValue},set:function(a){void 0!==a&&this.ready_&&!this.options.has(a)&&(a=void 0);this.selectedValue!==a&&(this.selectedValue=a,this.changed.dispatch())}},
-{key:"default",set:function(a){this.defaultValue!==a&&(this.defaultValue=a,this.changed.dispatch())},get:function(){return this.defaultValue}},{key:"validValue",get:function(){var a=this.selectedValue;return void 0!==a&&this.options.has(a)?a:this.defaultValue}},{key:"ready",get:function(){return this.ready_},set:function(a){if(a!==this.ready_){if(this.ready_=a)this.value=this.value;this.changed.dispatch()}}}]);return c}(h.a);var k=function(a){function k(a,d){d=void 0===d?new c.b:d;q(this,k);var e=
-p(this,(k.__proto__||Object.getPrototypeOf(k)).call(this));e.getter=a;e.visibility=d;e.element=document.createElement("div");e.tabs=new Map;e.tabVisibilityChanged=new b.b;e.element.className="neuroglancer-stack-view";e.registerDisposer(d.changed.add(function(){return e.updateSelectedTab()}));e.updateSelectedTab();return e}n(k,a);e(k,[{key:"invalidate",value:function(a){var b=this.tabs,c=b.get(a);void 0!==c&&(c.dispose(),b.delete(a),a===this.displayedTab&&(this.displayedTab=void 0,this.updateSelectedTab()))}},
-{key:"hideTab",value:function(a){var b=this.tabs.get(a);void 0!==b&&(b.visibility.value=c.b.IGNORED,b.element.style.display="none");this.tabVisibilityChanged.dispatch(a,!1)}},{key:"showTab",value:function(a){var b=this.tabs,d=b.get(a);void 0===d&&(d=this.getter(a),this.element.appendChild(d.element),b.set(a,d));d.element.style.display=null;d.visibility.value=c.b.VISIBLE;this.tabVisibilityChanged.dispatch(a,!0)}},{key:"updateSelectedTab",value:function(){var a=this.displayedTab,b=this.visible?this.selectedTabValue:
-void 0;b!==a&&(void 0!==a&&this.hideTab(a),this.displayedTab=b,void 0!==b&&this.showTab(b))}},{key:"invalidateAll",value:function(){for(var a=this.tabs,b=$jscomp.makeIterator(a.values()),c=b.next();!c.done;c=b.next())c.value.dispose();a.clear();this.updateSelectedTab()}},{key:"disposed",value:function(){this.selectedTabValue=void 0;this.invalidateAll();Object(d.b)(this.element);g(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"disposed",this).call(this)}},{key:"visible",get:function(){return this.visibility.visible}},
-{key:"selected",get:function(){return this.selectedTabValue},set:function(a){this.selectedTabValue=a;this.updateSelectedTab()}}]);return k}(h.a),t=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);return b}(a),m=function(a){function b(a,d){d=void 0===d?new c.b:d;q(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.state=a;e.visibility=d;e.element=document.createElement("div");e.tabBar=document.createElement("div");
-e.tabLabels=new Map;e.tabsGeneration=-1;a=e.element;var g=e.tabBar;a.className="neuroglancer-tab-view";g.className="neuroglancer-tab-view-bar";a.appendChild(g);e.registerDisposer(d.changed.add(function(){e.updateTabs()}));d=e.stack=e.registerDisposer(new k(function(a){return e.state.options.get(a).getter()},e.visibility));a.appendChild(d.element);e.registerDisposer(e.state.changed.add(function(){return e.updateSelectedTab()}));e.registerDisposer(e.state.optionsChanged.add(function(){return e.updateTabs()}));
-e.stack.tabVisibilityChanged.add(function(a,b){a=e.tabLabels.get(a);b?a.classList.add("neuroglancer-selected-tab-label"):a.classList.remove("neuroglancer-selected-tab-label")});e.updateTabs();return e}n(b,a);e(b,[{key:"updateTabs",value:function(){this.tabsGeneration!==this.state.optionsChanged.count&&(this.destroyTabs(),this.visible&&this.makeTabs(),this.updateSelectedTab())}},{key:"updateSelectedTab",value:function(){this.stack.selected=this.state.value}},{key:"destroyTabs",value:function(){-1!==
-this.tabsGeneration&&(this.stack.selected=void 0,this.tabLabels.clear(),Object(d.a)(this.tabBar),this.tabsGeneration=-1,this.stack.invalidateAll())}},{key:"makeTabs",value:function(){var a=this,b=this.tabBar,c=this.tabLabels,d=Array.from(this.state.options);d.sort(function(a,b){a=$jscomp.makeIterator(a);a.next();a=a.next().value;a=void 0===a.order?0:a.order;b=$jscomp.makeIterator(b);b.next();b=b.next().value;return a-(void 0===b.order?0:b.order)});var e={};d=$jscomp.makeIterator(d);for(var g=d.next();!g.done;e=
-{id:e.id},g=d.next()){g=$jscomp.makeIterator(g.value);e.id=g.next().value;g=g.next().value.label;var k=document.createElement("div");k.classList.add("neuroglancer-tab-label");k.textContent=g;k.addEventListener("click",function(b){return function(){a.state.value=b.id}}(e));c.set(e.id,k);b.appendChild(k)}this.tabsGeneration=this.state.optionsChanged.count}},{key:"disposed",value:function(){Object(d.a)(this.tabBar);this.tabLabels.clear();Object(d.b)(this.element);g(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),
-"disposed",this).call(this)}},{key:"visible",get:function(){return this.visibility.visible}}]);return b}(h.a)},function(h,f,a){f.b=function(a,d){p.set(a,d)};f.a=function(a){for(var d=new q.b,b=$jscomp.makeIterator(p),c=b.next();!c.done;c=b.next()){var e=$jscomp.makeIterator(c.value);c=e.next().value;e=e.next().value;d.register(c,e(a))}return d};var q=a(46),p=new Map},function(h,f,a){var q=this&&this.__extends||function(a,f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=
-f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(d){a.call(this);this.scheduler=d}q(f,a);f.create=function(a){return new f(a)};f.dispatch=function(a){a.subscriber.complete()};f.prototype._subscribe=function(a){var b=this.scheduler;if(b)return b.schedule(f.dispatch,0,{subscriber:a});a.complete()};return f}(a(0).Observable);f.EmptyObservable=h},function(h,f,a){f.c=function(a,f,h,d){for(;f<h;){var b=a[f];d(b)?++f:(--h,a[f]=a[h],a[h]=b)}return h};f.b=
-function(a,f){if(a.length===f)return a;f=new a.constructor(f);f.set(a);return f};f.d=function(a,f,h,d){for(var b=a.length/f,c=new a.constructor(a.length*h*d),e=a.length*d,g=f*d,l=0;l<b;++l)for(var k=0;k<f;++k)for(var t=a[l*f+k],m=l*g+k,r=0;r<h;++r)for(var u=0;u<d;++u)c[r*e+u*f+m]=t;return c};f.a=function(a,f,h,d,b){d=void 0===d?0:d;for(b=void 0===b?a.length:b;d<b;){var c=d+b-1>>1,e=h(f,a[c]);if(0<e)d=c+1;else if(0>e)b=c;else return c}return~d}},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
-}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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)}a.d(f,"a",function(){return A});
-a.d(f,"c",function(){return z});a.d(f,"b",function(){return D});a.d(f,"d",function(){return E});h=a(10);var d=a.n(h),b=a(30);h=a(24);var c=a(39),e=a(76);f=a(1);var g=a(2),l=a(23),k=a(7),t=a(29),m=a(99),r=a(25),u=a(52);a=a(15);var v=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),w=function C(a,b,c){null===
-a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return C(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},y=this&&this.__decorate||function(a,b,c,d){var e=arguments.length,g=3>e?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,k;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)g=Reflect.decorate(a,b,c,d);else for(var l=a.length-1;0<=l;l--)if(k=a[l])g=(3>e?k(g):3<e?
-k(b,c,g):k(b,c))||g;return 3<e&&g&&Object.defineProperty(b,c,g),g},x=g.k.create(),A=function(a){function l(a,b,c){q(this,l);var e=p(this,(l.__proto__||Object.getPrototypeOf(l)).call(this));e.chunkManager=a;e.layerManager=b;e.navigationState=c;e.gl=e.chunkManager.gl;e.dataToViewport=g.k.create();e.viewportToDevice=g.k.create();e.dataToDevice=g.k.create();e.visibleChunks=new Map;e.viewChanged=new k.a;e.renderingStale=!0;e.visibleChunksStale=!0;e.visibleLayerList=[];e.newVisibleLayers=new Set;e.offscreenFramebuffer=
-e.registerDisposer(new m.b(e.gl,{colorBuffers:Object(m.e)(e.gl,1),depthBuffer:new m.d(e.gl)}));e.numVisibleChunks=0;e.updateVisibleLayers=e.registerCancellable(d()(function(){e.updateVisibleLayersNow()},0));e.invalidateVisibleSources=function(){e.visibleSourcesStale=!0;e.viewChanged.dispatch()};e.setViewportSizeDebounced=e.registerCancellable(d()(function(a,b){return e.setViewportSize(a,b)},0));g.k.identity(e.dataToViewport);e.initializeCounterpart(e.chunkManager.rpc,{chunkManager:a.rpcId});e.registerDisposer(c.changed.add(function(){e.updateViewportFromNavigationState()}));
-e.updateViewportFromNavigationState();e.registerDisposer(b.layersChanged.add(function(){e.hasValidViewport&&e.updateVisibleLayers()}));e.viewChanged.add(function(){e.renderingStale=!0});e.registerDisposer(a.chunkQueueManager.visibleChunksChanged.add(e.viewChanged.dispatch));e.updateViewportFromNavigationState();e.updateVisibleLayers();return e}n(l,a);v(l,[{key:"isReady",value:function(){this.setViewportSizeDebounced.flush();if(!this.hasValidViewport)return!1;this.maybeUpdateVisibleChunks();for(var a=
-0,c=$jscomp.makeIterator(this.visibleLayers.values()),d=c.next();!d.done;d=c.next()){d=$jscomp.makeIterator(d.value);for(var e=d.next();!e.done;e=d.next()){var g=e.value;e=g.source;g=this.visibleChunks.get(g.chunkLayout);if(!g)return!1;e=e.chunks;g=$jscomp.makeIterator(g);for(var k=g.next();!k.done;k=g.next())(k=e.get(k.value))&&k.state===b.d.GPU_MEMORY&&++a}}return a===this.numVisibleChunks}},{key:"updateViewportFromNavigationState",value:function(){var a=this.navigationState;a.valid&&(a.toMat4(x),
-this.setViewportToDataMatrix(x))}},{key:"bindVisibleRenderLayer",value:function(a){a.redrawNeeded.add(this.viewChanged.dispatch);a.transform.changed.add(this.invalidateVisibleSources)}},{key:"unbindVisibleRenderLayer",value:function(a){a.redrawNeeded.remove(this.viewChanged.dispatch);a.transform.changed.remove(this.invalidateVisibleSources)}},{key:"updateVisibleLayersNow",value:function(){if(this.wasDisposed||!this.hasValidViewport)return!1;var a=this.visibleLayers,b=this.rpc,d={id:this.rpcId},g=
-this.newVisibleLayers,k=!1,l=this.visibleLayerList;l.length=0;for(var m=$jscomp.makeIterator(this.layerManager.readyRenderLayers()),r=m.next();!r.done;r=m.next())r=r.value,r instanceof e.a&&(g.add(r),l.push(r),a.has(r)||(a.set(r.addRef(),[]),this.bindVisibleRenderLayer(r),d.layerId=r.rpcId,b.invoke(c.b,d),k=!0));l=$jscomp.makeIterator(a.keys());for(r=l.next();!r.done;r=l.next())m=r.value,g.has(m)||(a.delete(m),this.unbindVisibleRenderLayer(m),d.layerId=m.rpcId,b.invoke(c.c,d),m.dispose(),k=!0);g.clear();
-k&&(this.visibleSourcesStale=!0);this.viewChanged.dispatch();return k}},{key:"onViewportChanged",value:function(){var a=this.width,b=this.height,c=this.viewportToDevice,d=this.dataToViewport,e=this.dataToDevice;g.k.ortho(c,-a/2,a/2,b/2,-b/2,-10,10);g.k.multiply(e,c,d);this.visibleChunksStale=!0;this.viewChanged.dispatch()}},{key:"setViewportSize",value:function(a,b){this.setViewportSizeDebounced.cancel();return w(l.prototype.__proto__||Object.getPrototypeOf(l.prototype),"setViewportSize",this).call(this,
-a,b)?(this.rpc.invoke(c.g,{id:this.rpcId,width:a,height:b}),!0):!1}},{key:"onViewportToDataMatrixChanged",value:function(){var a=this.viewportToData,b=this.dataToViewport;g.k.invert(b,a);Object(g.o)(b);this.rpc.invoke(c.g,{id:this.rpcId,viewportToData:a})}},{key:"onHasValidViewport",value:function(){this.updateVisibleLayers()}},{key:"updateRendering",value:function(){this.setViewportSizeDebounced.flush();if(this.renderingStale&&this.hasValidViewport&&0!==this.width&&0!==this.height){this.renderingStale=
-!1;this.maybeUpdateVisibleChunks();var a=this.gl,b=this.offscreenFramebuffer;b.bind(this.width,this.height);a.disable(a.SCISSOR_TEST);a.clearStencil(0);a.clearColor(0,0,0,0);a.colorMask(!0,!0,!0,!0);a.clear(a.COLOR_BUFFER_BIT);a.enable(a.STENCIL_TEST);a.disable(a.DEPTH_TEST);a.stencilOpSeparate(a.FRONT_AND_BACK,a.KEEP,a.KEEP,a.REPLACE);for(var c=0,d=$jscomp.makeIterator(this.visibleLayerList),e=d.next();!e.done;e=d.next())e=e.value,a.clear(a.STENCIL_BUFFER_BIT),a.stencilFuncSeparate(a.FRONT_AND_BACK,
-a.GREATER,1,1),e.setGLBlendMode(a,c),e.draw(this),++c;a.disable(a.BLEND);a.disable(a.STENCIL_TEST);b.unbind()}}},{key:"maybeUpdateVisibleChunks",value:function(){this.updateVisibleLayers.flush();if(!this.visibleChunksStale&&!this.visibleSourcesStale)return!1;this.visibleChunksStale=!1;this.updateVisibleChunks();return!0}},{key:"updateVisibleChunks",value:function(){var a=this.visibleChunks,b=0;this.computeVisibleChunks(function(b){var c=a.get(b);void 0===c?(c=[],a.set(b,c)):c.length=0;return c},function(a,
-c,d,e){a=Object(g.t)(d);c[c.length]=a;b+=e.length});this.numVisibleChunks=b}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.visibleLayers.keys()),b=a.next();!b.done;b=a.next())b=b.value,this.unbindVisibleRenderLayer(b),b.dispose();this.visibleLayers.clear();this.visibleLayerList.length=0}}]);return l}(Object(t.c)(c.h));A=y([Object(a.g)(c.f)],A);var z=function(a){function b(a,c){q(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));a.spec=c.spec;return a}
-n(b,a);v(b,[{key:"initializeCounterpart",value:function(a,c){c.spec=this.spec.toObject();w(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initializeCounterpart",this).call(this,a,c)}}],[{key:"encodeOptions",value:function(a){var c=w(b.__proto__||Object.getPrototypeOf(b),"encodeOptions",this).call(this,a);c.spec=a.spec.toObject();return c}}]);return b}(h.e),D=function(a){function c(a,d){q(this,c);a=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,a));a.chunkGridPosition=d.chunkGridPosition;
-a.state=b.d.SYSTEM_MEMORY;return a}n(c,a);return c}(h.b),E=function(a){function b(a,c){q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.gl=a;d.copyVertexPositionsBuffer=Object(u.a)(d.gl);d.textureCoordinateAdjustment=new Float32Array(4);var e=new r.a(a);e.addVarying("vec2","vTexCoord");e.addUniform("sampler2D","uSampler");e.addInitializer(function(b){a.uniform1i(b.uniform("uSampler"),0)});e.addUniform("vec4","uColorFactor");e.addUniform("vec4","uBackgroundColor");e.addUniform("mat4",
-"uProjectionMatrix");e.addUniform("vec4","uTextureCoordinateAdjustment");e.require(c);e.setFragmentMain("\nvec4 sampledColor = texture(uSampler, vTexCoord);\nif (sampledColor.a == 0.0) {\n  sampledColor = uBackgroundColor;\n}\nemit(sampledColor * uColorFactor, vec4(0,0,0,0));\n");e.addAttribute("vec4","aVertexPosition");e.setVertexMain("\nvTexCoord = uTextureCoordinateAdjustment.xy + 0.5 * (aVertexPosition.xy + 1.0) * uTextureCoordinateAdjustment.zw;\ngl_Position = uProjectionMatrix * aVertexPosition;\n");
-d.shader=d.registerDisposer(e.build());return d}n(b,a);v(b,[{key:"draw",value:function(a,b,c,d,e,g,k,l){var m=this.gl,r=this.shader,t=this.textureCoordinateAdjustment;t[0]=e;t[1]=g;t[2]=k-e;t[3]=l-g;r.bind();m.activeTexture(m.TEXTURE0);m.bindTexture(m.TEXTURE_2D,a);m.uniformMatrix4fv(r.uniform("uProjectionMatrix"),!1,b);m.uniform4fv(r.uniform("uColorFactor"),c);m.uniform4fv(r.uniform("uBackgroundColor"),d);m.uniform4fv(r.uniform("uTextureCoordinateAdjustment"),t);a=r.attribute("aVertexPosition");
-this.copyVertexPositionsBuffer.bindToVertexAttrib(a,2);m.drawArrays(m.TRIANGLE_FAN,0,4);m.disableVertexAttribArray(a);m.bindTexture(m.TEXTURE_2D,null)}}],[{key:"get",value:function(a,c){return a.memoize.get("sliceview/SliceViewRenderHelper:"+Object(l.a)(c),function(){return new b(a,c)})}}]);return b}(f.a)},function(h,f){},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a,b){void 0===b&&(b=-1===a.indexOf("/")?":":"/");a=a.lastIndexOf(b);return-1===a?0:a+1}a.d(f,"a",function(){return g});
-a.d(f,"b",function(){return k});var b=a(32),c=a(62);h=a(1);var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);return b}(h.a),l=/^(?:([a-zA-Z-+_]+):\/\/)?(.*)$/,k=function(a){function g(){q(this,
-g);var a=p(this,(g.__proto__||Object.getPrototypeOf(g)).apply(this,arguments));a.dataSources=new Map;return a}n(g,a);e(g,[{key:"register",value:function(a,b){this.dataSources.set(a,this.registerDisposer(b))}},{key:"getDataSource",value:function(a){a=a.match(l);if(null===a||void 0===a[1])throw Error('Data source URL must have the form "<protocol>://<path>".');var b=a[1],c=this.dataSources.get(b);if(void 0===c)throw Error("Unsupported data source: "+JSON.stringify(b)+".");return[c,a[2],b]}},{key:"getVolume",
-value:function(a,c,d,e){d=void 0===d?{}:d;e=void 0===e?b.e:e;c=$jscomp.makeIterator(this.getDataSource(c));var g=c.next().value,k=c.next().value;return new Promise(function(b){b(g.getVolume(a,k,d,e))})}},{key:"getAnnotationSource",value:function(a,c,d){d=void 0===d?b.e:d;c=$jscomp.makeIterator(this.getDataSource(c));var e=c.next().value,g=c.next().value;return new Promise(function(b){b(e.getAnnotationSource(a,g,d))})}},{key:"getVectorGraphicsSource",value:function(a,c,d,e){d=void 0===d?{}:d;e=void 0===
-e?b.e:e;c=$jscomp.makeIterator(this.getDataSource(c));var g=c.next().value,k=c.next().value;return new Promise(function(b){b(g.getVectorGraphicsSource(a,k,d,e))})}},{key:"getMeshSource",value:function(a,c,d){d=void 0===d?b.e:d;c=$jscomp.makeIterator(this.getDataSource(c));var e=c.next().value,g=c.next().value;return new Promise(function(b){b(e.getMeshSource(a,g,d))})}},{key:"getSkeletonSource",value:function(a,c,d){d=void 0===d?b.e:d;c=$jscomp.makeIterator(this.getDataSource(c));var e=c.next().value,
-g=c.next().value;return new Promise(function(b){b(e.getSkeletonSource(a,g,d))})}},{key:"volumeCompleter",value:function(a,d,e){e=void 0===e?b.e:e;var g=a.match(l),k=g[1];if(void 0===k){d=[];e=$jscomp.makeIterator(this.dataSources);for(g=e.next();!g.done;g=e.next()){var m=$jscomp.makeIterator(g.value);g=m.next().value;m=m.next().value;g+="://";g.startsWith(a)&&d.push({value:g,description:m.description})}return Promise.resolve({offset:0,completions:d})}a=this.dataSources.get(k);return void 0!==a&&void 0!==
-a.volumeCompleter?a.volumeCompleter(g[2],d,e).then(function(a){return Object(c.a)(k.length+3,a)}):Promise.reject(null)}},{key:"suggestLayerName",value:function(a){a=$jscomp.makeIterator(this.getDataSource(a));var b=a.next().value;a=a.next().value;b=b.suggestLayerName;if(void 0!==b)return b(a);b=d(a,void 0);return a.substring(b)}},{key:"findSourceGroup",value:function(a){var b=$jscomp.makeIterator(this.getDataSource(a));a=b.next().value;var c=b.next().value;b=b.next().value;return(a.findSourceGroup||
-d)(c)+b.length+3}}]);return g}(h.a)},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,
-b):a.__proto__=b)}a.d(f,"b",function(){return e});a.d(f,"a",function(){return l});var n=a(79);h=a(1);var d=a(61),b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),c=function t(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==
-a)return t(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a(283);var e=0,g=d.a.fromObject({escape:{action:"close"}}),l=function(a){function l(){if(!(this instanceof l))throw new TypeError("Cannot call a class as a function");var a=q(this,(l.__proto__||Object.getPrototypeOf(l)).call(this));a.keyMap=new d.a;a.keyMap.addParent(g,Number.NEGATIVE_INFINITY);++e;var b=a.container=document.createElement("div");b.className="overlay";var c=a.content=document.createElement("div");
-a.registerDisposer(new n.a(c));c.className="overlay-content";b.appendChild(c);document.body.appendChild(b);a.registerDisposer(new d.b(a.container,a.keyMap));a.registerEventListener(b,"action:close",function(){a.dispose()});c.focus();return a}p(l,a);b(l,[{key:"disposed",value:function(){--e;document.body.removeChild(this.container);c(l.prototype.__proto__||Object.getPrototypeOf(l.prototype),"disposed",this).call(this)}}]);return l}(h.a)},function(h,f,a){(function(a,f){h.exports=f()})(this,function(){function a(a){return new RegExp("(^|\\s)"+
-a+"(?:$|\\s)\\s*")}function f(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild);return a}function h(a,b){return f(a).appendChild(b)}function d(a,b,c,d){a=document.createElement(a);c&&(a.className=c);d&&(a.style.cssText=d);if("string"==typeof b)a.appendChild(document.createTextNode(b));else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function b(a,b,c,e){a=d(a,b,c,e);a.setAttribute("role","presentation");return a}function c(a,b){3==b.nodeType&&(b=b.parentNode);if(a.contains)return a.contains(b);
-do if(11==b.nodeType&&(b=b.host),b==a)return!0;while(b=b.parentNode)}function e(){try{var a=document.activeElement}catch(la){a=document.body||null}for(;a&&a.shadowRoot&&a.shadowRoot.activeElement;)a=a.shadowRoot.activeElement;return a}function g(b,c){var d=b.className;a(c).test(d)||(b.className+=(d?" ":"")+c)}function l(b,c){b=b.split(" ");for(var d=0;d<b.length;d++)b[d]&&!a(b[d]).test(c)&&(c+=" "+b[d]);return c}function k(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,
-b)}}function t(a,b,c){b||(b={});for(var d in a)!a.hasOwnProperty(d)||!1===c&&b.hasOwnProperty(d)||(b[d]=a[d]);return b}function m(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));d=d||0;for(e=e||0;;){var g=a.indexOf("\t",d);if(0>g||g>=b)return e+(b-d);e+=g-d;e+=c-e%c;d=g+1}}function r(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function u(a,b,c){for(var d=0,e=0;;){var g=a.indexOf("\t",d);-1==g&&(g=a.length);var I=g-d;if(g==a.length||e+I>=b)return d+Math.min(I,b-
-e);e+=g-d;e+=c-e%c;d=g+1;if(e>=b)return d}}function v(a){for(;Oc.length<=a;)Oc.push(w(Oc)+" ");return Oc[a]}function w(a){return a[a.length-1]}function y(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function x(a,b,c){for(var d=0,e=c(b);d<a.length&&c(a[d])<=e;)d++;a.splice(d,0,b)}function A(){}function z(a,b){Object.create?a=Object.create(a):(A.prototype=a,a=new A);b&&t(b,a);return a}function D(a){return/\w/.test(a)||"\u0080"<a&&(a.toUpperCase()!=a.toLowerCase()||bg.test(a))}function E(a,
-b){return b?-1<b.source.indexOf("\\w")&&D(a)?!0:b.test(a):D(a)}function G(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function C(a){return 768<=a.charCodeAt(0)&&cg.test(a)}function B(a,b,c){for(;(0>c?0<b:b<a.length)&&C(a.charAt(b));)b+=c;return b}function F(a,b,c){for(var d=b>c?-1:1;;){if(b==c)return b;var e=(b+c)/2;e=0>d?Math.ceil(e):Math.floor(e);if(e==b)return a(e)?b:c;a(e)?c=e:b=e+d}}function L(a,c,e){this.input=e;this.scrollbarFiller=d("div",null,"CodeMirror-scrollbar-filler");
-this.scrollbarFiller.setAttribute("cm-not-content","true");this.gutterFiller=d("div",null,"CodeMirror-gutter-filler");this.gutterFiller.setAttribute("cm-not-content","true");this.lineDiv=b("div",null,"CodeMirror-code");this.selectionDiv=d("div",null,null,"position: relative; z-index: 1");this.cursorDiv=d("div",null,"CodeMirror-cursors");this.measure=d("div",null,"CodeMirror-measure");this.lineMeasure=d("div",null,"CodeMirror-measure");this.lineSpace=b("div",[this.measure,this.lineMeasure,this.selectionDiv,
-this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");var g=b("div",[this.lineSpace],"CodeMirror-lines");this.mover=d("div",[g],null,"position: relative");this.sizer=d("div",[this.mover],"CodeMirror-sizer");this.sizerWidth=null;this.heightForcer=d("div",null,null,"position: absolute; height: 30px; width: 1px;");this.gutters=d("div",null,"CodeMirror-gutters");this.lineGutter=null;this.scroller=d("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex",
-"-1");this.wrapper=d("div",[this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror");V&&8>ca&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0);sa||eb&&Yb||(this.scroller.draggable=!0);a&&(a.appendChild?a.appendChild(this.wrapper):a(this.wrapper));this.reportedViewFrom=this.reportedViewTo=this.viewFrom=this.viewTo=c.first;this.view=[];this.externalMeasured=this.renderedView=null;this.lastWrapHeight=this.lastWrapWidth=this.viewOffset=0;this.updateLineNumbers=null;this.nativeBarWidth=
-this.barHeight=this.barWidth=0;this.scrollbarsClipped=!1;this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null;this.alignWidgets=!1;this.maxLine=this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null;this.maxLineLength=0;this.maxLineChanged=!1;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=!1;this.activeTouch=this.selForContextMenu=null;e.init(this)}function J(a,b){b-=a.first;if(0>b||b>=a.size)throw Error("There is no line "+(b+a.first)+" in the document.");
-for(;!a.lines;)for(var c=0;;++c){var d=a.children[c],e=d.chunkSize();if(b<e){a=d;break}b-=e}return a.lines[b]}function O(a,b,c){var d=[],e=b.line;a.iter(b.line,c.line+1,function(a){a=a.text;e==c.line&&(a=a.slice(0,c.ch));e==b.line&&(a=a.slice(b.ch));d.push(a);++e});return d}function M(a,b,c){var d=[];a.iter(b,c,function(a){d.push(a.text)});return d}function P(a,b){if(b-=a.height)for(;a;a=a.parent)a.height+=b}function N(a){if(null==a.parent)return null;var b=a.parent;a=r(b.lines,a);for(var c=b.parent;c;b=
-c,c=c.parent)for(var d=0;c.children[d]!=b;++d)a+=c.children[d].chunkSize();return a+b.first}function S(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],g=e.height;if(b<g){a=e;continue a}b-=g;c+=e.chunkSize()}return c}while(!a.lines);for(d=0;d<a.lines.length;++d){e=a.lines[d].height;if(b<e)break;b-=e}return c+d}function U(a,b){return b>=a.first&&b<a.first+a.size}function Z(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function H(a,b,c){void 0===c&&(c=
-null);if(!(this instanceof H))return new H(a,b,c);this.line=a;this.ch=b;this.sticky=c}function Q(a,b){return a.line-b.line||a.ch-b.ch}function aa(a,b){return a.sticky==b.sticky&&0==Q(a,b)}function ba(a){return H(a.line,a.ch)}function ka(a,b){return 0>Q(a,b)?b:a}function fa(a,b){return 0>Q(a,b)?a:b}function R(a,b){if(b.line<a.first)return H(a.first,0);var c=a.first+a.size-1;if(b.line>c)return H(c,J(a,c).text.length);a=J(a,b.line).text.length;c=b.ch;b=null==c||c>a?H(b.line,a):0>c?H(b.line,0):b;return b}
-function X(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=R(a,b[d]);return c}function Ka(a,b,c){this.marker=a;this.from=b;this.to=c}function Ba(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function Za(a,b){if(b.full)return null;var c=U(a,b.from.line)&&J(a,b.from.line).markedSpans,d=U(a,b.to.line)&&J(a,b.to.line).markedSpans;if(!c&&!d)return null;a=b.from.ch;var e=b.to.ch,g=0==Q(b.from,b.to),k;if(c)for(var I=0;I<c.length;++I){var l=c[I],m=l.marker;if(null==l.from||(m.inclusiveLeft?
-l.from<=a:l.from<a)||!(l.from!=a||"bookmark"!=m.type||g&&l.marker.insertLeft)){var r=null==l.to||(m.inclusiveRight?l.to>=a:l.to>a);(k||(k=[])).push(new Ka(m,l.from,r?null:l.to))}}c=k;var t;if(d)for(k=0;k<d.length;++k)if(I=d[k],l=I.marker,null==I.to||(l.inclusiveRight?I.to>=e:I.to>e)||I.from==e&&"bookmark"==l.type&&(!g||I.marker.insertLeft))m=null==I.from||(l.inclusiveLeft?I.from<=e:I.from<e),(t||(t=[])).push(new Ka(l,m?null:I.from-e,null==I.to?null:I.to-e));d=1==b.text.length;e=w(b.text).length+(d?
-a:0);if(c)for(g=0;g<c.length;++g)if(k=c[g],null==k.to)(I=Ba(t,k.marker),I)?d&&(k.to=null==I.to?null:I.to+e):k.to=a;if(t)for(a=0;a<t.length;++a)g=t[a],null!=g.to&&(g.to+=e),null==g.from?Ba(c,g.marker)||(g.from=e,d&&(c||(c=[])).push(g)):(g.from+=e,d&&(c||(c=[])).push(g));c&&(c=Ta(c));t&&t!=c&&(t=Ta(t));a=[c];if(!d){b=b.text.length-2;var f;if(0<b&&c)for(d=0;d<c.length;++d)null==c[d].to&&(f||(f=[])).push(new Ka(c[d].marker,null,null));for(c=0;c<b;++c)a.push(f);a.push(t)}return a}function Ta(a){for(var b=
-0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&!1!==c.marker.clearWhenEmpty&&a.splice(b--,1)}return a.length?a:null}function Wb(a,b,c){var d=null;a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&-1!=r(d,c)||(d||(d=[])).push(c)}});if(!d)return null;a=[{from:b,to:c}];for(b=0;b<d.length;++b){c=d[b];for(var e=c.find(0),g=0;g<a.length;++g){var k=a[g];if(!(0>Q(k.to,e.from)||0<Q(k.from,e.to))){var I=[g,1],
-l=Q(k.from,e.from),m=Q(k.to,e.to);(0>l||!c.inclusiveLeft&&!l)&&I.push({from:k.from,to:e.from});(0<m||!c.inclusiveRight&&!m)&&I.push({from:e.to,to:k.to});a.splice.apply(a,I);g+=I.length-3}}}return a}function Eb(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Aa(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Mc(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;c=a.find();var d=b.find(),
-e=Q(c.from,d.from)||(a.inclusiveLeft?-1:0)-(b.inclusiveLeft?-1:0);return e?-e:(c=Q(c.to,d.to)||(a.inclusiveRight?1:0)-(b.inclusiveRight?1:0))?c:b.id-a.id}function wa(a,b){a=fb&&a.markedSpans;if(a)for(var c,d=0;d<a.length;++d)if(c=a[d],c.marker.collapsed&&null==(b?c.from:c.to)&&(!e||0>Mc(e,c.marker)))var e=c.marker;return e}function Fb(a,b,c,d,e){a=J(a,b);if(a=fb&&a.markedSpans)for(b=0;b<a.length;++b){var g=a[b];if(g.marker.collapsed){var k=g.marker.find(0),I=Q(k.from,c)||(g.marker.inclusiveLeft?-1:
-0)-(e.inclusiveLeft?-1:0),l=Q(k.to,d)||(g.marker.inclusiveRight?1:0)-(e.inclusiveRight?1:0);if(!(0<=I&&0>=l||0>=I&&0<=l)&&(0>=I&&(g.marker.inclusiveRight&&e.inclusiveLeft?0<=Q(k.to,c):0<Q(k.to,c))||0<=I&&(g.marker.inclusiveRight&&e.inclusiveLeft?0>=Q(k.from,d):0>Q(k.from,d))))return!0}}}function Ga(a){for(var b;b=wa(a,!0);)a=b.find(-1,!0).line;return a}function Xb(a,b){a=J(a,b);var c=Ga(a);return a==c?b:N(c)}function Nc(a,b){if(b>a.lastLine())return b;var c=J(a,b);if(!$a(a,c))return b;for(;a=wa(c,
-!1);)c=a.find(1,!0).line;return N(c)+1}function $a(a,b){var c=fb&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed&&(null==d.from||!d.marker.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&gb(a,b,d)))return!0}function gb(a,b,c){if(null==c.to)return b=c.marker.find(1,!0),gb(a,b.line,Ba(b.line.markedSpans,c.marker));if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var d,e=0;e<b.markedSpans.length;++e)if(d=b.markedSpans[e],d.marker.collapsed&&!d.marker.widgetNode&&
-d.from==c.to&&(null==d.to||d.to!=c.from)&&(d.marker.inclusiveLeft||c.marker.inclusiveRight)&&gb(a,b,d))return!0}function Ha(a){a=Ga(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;else b+=e.height}for(a=c.parent;a;c=a,a=c.parent)for(d=0;d<a.children.length&&(e=a.children[d],e!=c);++d)b+=e.height;return b}function xa(a){if(0==a.height)return 0;for(var b=a.text.length,c,d=a;c=wa(d,!0);)c=c.find(0,!0),d=c.from.line,b+=c.from.ch-c.to.ch;for(d=a;c=wa(d,!1);)a=c.find(0,
-!0),b-=d.text.length-a.from.ch,d=a.to.line,b+=d.text.length-a.to.ch;return b}function ab(a){var b=a.display;a=a.doc;b.maxLine=J(a,a.first);b.maxLineLength=xa(b.maxLine);b.maxLineChanged=!0;a.iter(function(a){var c=xa(a);c>b.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function qd(a,b,c,d){if(!a)return d(b,c,"ltr",0);for(var e=!1,g=0;g<a.length;++g){var k=a[g];if(k.from<c&&k.to>b||b==c&&k.to==b)d(Math.max(k.from,b),Math.min(k.to,c),1==k.level?"rtl":"ltr",g),e=!0}e||d(b,c,"ltr")}function Ua(a,b,
-c){var d;Zb=null;for(var e=0;e<a.length;++e){var g=a[e];if(g.from<b&&g.to>b)return e;g.to==b&&(g.from!=g.to&&"before"==c?d=e:Zb=e);g.from==b&&(g.from!=g.to&&"before"!=c?d=e:Zb=e)}return null!=d?d:Zb}function Ca(a,b){var c=a.order;null==c&&(c=a.order=dg(a.text,b));return c}function ha(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=(a=a._handlers)&&a[b];d&&(c=r(d,c),-1<c&&(a[b]=d.slice(0,c).concat(d.slice(c+1))))}}function da(a,
-b){var c=a._handlers&&a._handlers[b]||Pc;if(c.length)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function ia(a,b,c){"string"==typeof b&&(b={type:b,preventDefault:function(){this.defaultPrevented=!0}});da(a,c||b.type,a,b);return ob(b)||b.codemirrorIgnore}function $b(a){var b=a._handlers&&a._handlers.cursorActivity;if(b){a=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]);for(var c=0;c<b.length;++c)-1==r(a,b[c])&&a.push(b[c])}}function Da(a,
-b){return 0<(a._handlers&&a._handlers[b]||Pc).length}function La(a){a.prototype.on=function(a,b){T(this,a,b)};a.prototype.off=function(a,b){ha(this,a,b)}}function na(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function Qc(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function ob(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function pb(a){na(a);Qc(a)}function ac(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));Ma&&a.ctrlKey&&
-1==b&&(b=3);return b}function hb(a){if(null==rd){var b=d("span","\u200b");h(a,d("span",[b,document.createTextNode("x")]));0!=a.firstChild.offsetHeight&&(rd=1>=b.offsetWidth&&2<b.offsetHeight&&!(V&&8>ca))}a=rd?d("span","\u200b"):d("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px");a.setAttribute("cm-text","");return a}function Rc(a,b){2<arguments.length&&(b.dependencies=Array.prototype.slice.call(arguments,2));sd[a]=b}function bb(a){if("string"==typeof a&&Gb.hasOwnProperty(a))a=
-Gb[a];else if(a&&"string"==typeof a.name&&Gb.hasOwnProperty(a.name)){var b=Gb[a.name];"string"==typeof b&&(b={name:b});a=z(b,a);a.name=b.name}else{if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return bb("application/xml");if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+json$/.test(a))return bb("application/json")}return"string"==typeof a?{name:a}:a||{name:"null"}}function Na(a,b){b=bb(b);var c=sd[b.name];if(!c)return Na(a,"text/plain");a=c(a,b);if(Hb.hasOwnProperty(b.name)){c=Hb[b.name];for(var d in c)c.hasOwnProperty(d)&&
-(a.hasOwnProperty(d)&&(a["_"+d]=a[d]),a[d]=c[d])}a.name=b.name;b.helperType&&(a.helperType=b.helperType);if(b.modeProps)for(var e in b.modeProps)a[e]=b.modeProps[e];return a}function ta(a,b){a=Hb.hasOwnProperty(a)?Hb[a]:Hb[a]={};t(b,a)}function Oa(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);a={};for(var c in b){var d=b[c];d instanceof Array&&(d=d.concat([]));a[c]=d}return a}function Ib(a,b){for(var c;a.innerMode;){c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state;a=c.mode}return c||
-{mode:a,state:b}}function bc(a,b,c){return a.startState?a.startState(b,c):!0}function Sc(a,b,c,d){var e=[a.state.modeGen],g={};ie(a,b.text,a.doc.mode,c,function(a,b){return e.push(a,b)},g,d);var k=c.state;d=function(d){c.baseTokens=e;var l=a.state.overlays[d],I=1,m=0;c.state=!0;ie(a,b.text,l.mode,c,function(a,b){for(var c=I;m<a;){var d=e[I];d>a&&e.splice(I,1,a,e[I+1],d);I+=2;m=Math.min(a,d)}if(b)if(l.opaque)e.splice(c,I-c,a,"overlay "+b),I=c+2;else for(;c<I;c+=2)a=e[c+1],e[c+1]=(a?a+" ":"")+"overlay "+
-b},g);c.state=k;c.baseTokens=null;c.baseTokenPos=1};for(var l=0;l<a.state.overlays.length;++l)d(l);return{styles:e,classes:g.bgClass||g.textClass?g:null}}function ib(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=Va(a,N(b)),e=b.text.length>a.options.maxHighlightLength&&Oa(a.doc.mode,d.state),g=Sc(a,b,d);e&&(d.state=e);b.stateAfter=d.save(!e);b.styles=g.styles;g.classes?b.styleClasses=g.classes:b.styleClasses&&(b.styleClasses=null);c===a.doc.highlightFrontier&&(a.doc.modeFrontier=Math.max(a.doc.modeFrontier,
-++a.doc.highlightFrontier))}return b.styles}function Va(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return new Wa(d,!0,b);var g=eg(a,b,c),k=g>d.first&&J(d,g-1).stateAfter,l=k?Wa.fromSaved(d,k,g):new Wa(d,bc(d.mode),g);d.iter(g,b,function(c){cc(a,c.text,l);var d=l.line;c.stateAfter=d==b-1||0==d%5||d>=e.viewFrom&&d<e.viewTo?l.save():null;l.nextLine()});c&&(d.modeFrontier=l.line);return l}function cc(a,b,c,d){var e=a.doc.mode;a=new ja(b,a.options.tabSize,c);a.start=a.pos=d||0;for(""==b&&K(e,
-c.state);!a.eol();)dc(e,a,c.state),a.start=a.pos}function K(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode&&(a=Ib(a,b),a.mode.blankLine))return a.mode.blankLine(a.state)}function dc(a,b,c,d){for(var e=0;10>e;e++){d&&(d[0]=Ib(a,c).mode);var g=a.token(b,c);if(b.pos>b.start)return g}throw Error("Mode "+a.name+" failed to advance stream.");}function je(a,b,c,d){var e=a.doc,g=e.mode;b=R(e,b);var k=J(e,b.line);c=Va(a,b.line,c);a=new ja(k.text,a.options.tabSize,c);var l;for(d&&(l=[]);(d||a.pos<
-b.ch)&&!a.eol();){a.start=a.pos;var m=dc(g,a,c.state);d&&l.push(new ke(a,m,Oa(e.mode,c.state)))}return d?l:new ke(a,m,c.state)}function le(a,b){if(a)for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:(new RegExp("(?:^|s)"+c[2]+"(?:$|s)")).test(b[d])||(b[d]+=" "+c[2])}return a}function ie(a,b,c,d,e,g,k){var l=c.flattenSpans;null==l&&(l=a.options.flattenSpans);var m=0,I=null,r=
-new ja(b,a.options.tabSize,d),t=a.options.addModeClass&&[null];for(""==b&&le(K(c,d.state),g);!r.eol();){if(r.pos>a.options.maxHighlightLength){l=!1;k&&cc(a,b,d,r.pos);r.pos=b.length;var f=null}else f=le(dc(c,r,d.state,t),g);if(t){var u=t[0].name;u&&(f="m-"+(f?u+" "+f:u))}if(!l||I!=f){for(;m<r.start;)m=Math.min(r.start,m+5E3),e(m,I);I=f}r.start=r.pos}for(;m<r.pos;)a=Math.min(r.pos,m+5E3),e(a,I),m=a}function eg(a,b,c){for(var d,e,g=a.doc,k=c?-1:b-(a.doc.mode.innerMode?1E3:100);b>k;--b){if(b<=g.first)return g.first;
-var l=J(g,b-1),I=l.stateAfter;if(I&&(!c||b+(I instanceof Tc?I.lookAhead:0)<=g.modeFrontier))return b;l=m(l.text,null,a.options.tabSize);if(null==e||d>l)e=b-1,d=l}return e}function fg(a,b){a.modeFrontier=Math.min(a.modeFrontier,b);if(!(a.highlightFrontier<b-10)){for(var c=a.first,d=b-1;d>c;d--){var e=J(a,d).stateAfter;if(e&&(!(e instanceof Tc)||d+e.lookAhead<b)){c=d+1;break}}a.highlightFrontier=Math.min(a.highlightFrontier,c)}}function me(a,b){if(!a||/^\s*$/.test(a))return null;b=b.addModeClass?gg:
-hg;return b[a]||(b[a]=a.replace(/\S+/g,"cm-$&"))}function ne(a,c){var d=b("span",null,null,sa?"padding-right: .1px":null);d={pre:b("pre",[d],"CodeMirror-line"),content:d,col:0,pos:0,cm:a,trailingSpace:!1,splitSpaces:(V||sa)&&a.getOption("lineWrapping")};c.measure={};for(var e=0;e<=(c.rest?c.rest.length:0);e++){var g=e?c.rest[e-1]:c.line,k=void 0;d.pos=0;d.addToken=ig;var m=a.display.measure;if(null!=td)m=td;else{var I=h(m,document.createTextNode("A\u062eA")),r=ec(I,0,1).getBoundingClientRect();I=
-ec(I,1,2).getBoundingClientRect();f(m);m=r&&r.left!=r.right?td=3>I.right-r.right:!1}m&&(k=Ca(g,a.doc.direction))&&(d.addToken=jg(d.addToken,k));d.map=[];var t=c!=a.display.externalMeasured&&N(g);a:{var u=I=r=m=void 0,v=void 0,la=void 0,n=void 0;k=d;t=ib(a,g,t);var w=g.markedSpans,p=g.text,D=0;if(w)for(var z=p.length,x=0,q=1,y="",C=0;;){if(C==x){v=u=I=r=la="";m=null;C=Infinity;for(var E=[],G=void 0,A=0;A<w.length;++A){var B=w[A],F=B.marker;"bookmark"==F.type&&B.from==x&&F.widgetNode?E.push(F):B.from<=
-x&&(null==B.to||B.to>x||F.collapsed&&B.to==x&&B.from==x)?(null!=B.to&&B.to!=x&&C>B.to&&(C=B.to,u=""),F.className&&(v+=" "+F.className),F.css&&(la=(la?la+";":"")+F.css),F.startStyle&&B.from==x&&(I+=" "+F.startStyle),F.endStyle&&B.to==C&&(G||(G=[])).push(F.endStyle,B.to),F.title&&!r&&(r=F.title),F.collapsed&&(!m||0>Mc(m.marker,F))&&(m=B)):B.from>x&&C>B.from&&(C=B.from)}if(G)for(A=0;A<G.length;A+=2)G[A+1]==C&&(u+=" "+G[A]);if(!m||m.from==x)for(G=0;G<E.length;++G)oe(k,0,E[G]);if(m&&(m.from||0)==x){oe(k,
-(null==m.to?z+1:m.to)-x,m.marker,null==m.from);if(null==m.to)break a;m.to==x&&(m=!1)}}if(x>=z)break;for(E=Math.min(z,C);;){if(y){G=x+y.length;m||(A=G>E?y.slice(0,E-x):y,k.addToken(k,A,n?n+v:v,I,x+A.length==C?u:"",r,la));if(G>=E){y=y.slice(E-x);x=E;break}x=G;I=""}y=p.slice(D,D=t[q++]);n=me(t[q++],k.cm.options)}}else for(m=1;m<t.length;m+=2)k.addToken(k,p.slice(D,D=t[m]),me(t[m+1],k.cm.options))}g.styleClasses&&(g.styleClasses.bgClass&&(d.bgClass=l(g.styleClasses.bgClass,d.bgClass||"")),g.styleClasses.textClass&&
-(d.textClass=l(g.styleClasses.textClass,d.textClass||"")));0==d.map.length&&d.map.push(0,0,d.content.appendChild(hb(a.display.measure)));0==e?(c.measure.map=d.map,c.measure.cache={}):((c.measure.maps||(c.measure.maps=[])).push(d.map),(c.measure.caches||(c.measure.caches=[])).push({}))}sa&&(e=d.content.lastChild,/\bcm-tab\b/.test(e.className)||e.querySelector&&e.querySelector(".cm-tab"))&&(d.content.className="cm-tab-wrap-hack");da(a,"renderLine",a,c.line,d.pre);d.pre.className&&(d.textClass=l(d.pre.className,
-d.textClass||""));return d}function kg(a){var b=d("span","\u2022","cm-invalidchar");b.title="\\u"+a.charCodeAt(0).toString(16);b.setAttribute("aria-label",b.title);return b}function ig(a,b,c,e,g,k,l){if(b){if(a.splitSpaces){var m=a.trailingSpace;if(1<b.length&&!/  /.test(b))m=b;else{for(var I="",r=0;r<b.length;r++){var t=b.charAt(r);" "!=t||!m||r!=b.length-1&&32!=b.charCodeAt(r+1)||(t="\u00a0");I+=t;m=" "==t}m=I}}else m=b;I=m;r=a.cm.state.specialChars;t=!1;if(r.test(b)){m=document.createDocumentFragment();
-for(var f=0;;){r.lastIndex=f;var u=r.exec(b),h=u?u.index-f:b.length-f;if(h){var la=document.createTextNode(I.slice(f,f+h));V&&9>ca?m.appendChild(d("span",[la])):m.appendChild(la);a.map.push(a.pos,a.pos+h,la);a.col+=h;a.pos+=h}if(!u)break;f+=h+1;"\t"==u[0]?(u=a.cm.options.tabSize,u-=a.col%u,h=m.appendChild(d("span",v(u),"cm-tab")),h.setAttribute("role","presentation"),h.setAttribute("cm-text","\t"),a.col+=u):("\r"==u[0]||"\n"==u[0]?(h=m.appendChild(d("span","\r"==u[0]?"\u240d":"\u2424","cm-invalidchar")),
-h.setAttribute("cm-text",u[0])):(h=a.cm.options.specialCharPlaceholder(u[0]),h.setAttribute("cm-text",u[0]),V&&9>ca?m.appendChild(d("span",[h])):m.appendChild(h)),a.col+=1);a.map.push(a.pos,a.pos+1,h);a.pos++}}else a.col+=b.length,m=document.createTextNode(I),a.map.push(a.pos,a.pos+b.length,m),V&&9>ca&&(t=!0),a.pos+=b.length;a.trailingSpace=32==I.charCodeAt(b.length-1);if(c||e||g||t||l)return b=c||"",e&&(b+=e),g&&(b+=g),e=d("span",[m],b,l),k&&(e.title=k),a.content.appendChild(e);a.content.appendChild(m)}}
-function jg(a,b){return function(c,d,e,g,k,l,m){e=e?e+" cm-force-border":"cm-force-border";for(var I=c.pos,r=I+d.length;;){for(var t=void 0,f=0;f<b.length&&!(t=b[f],t.to>I&&t.from<=I);f++);if(t.to>=r)return a(c,d,e,g,k,l,m);a(c,d.slice(0,t.to-I),e,g,null,l,m);g=null;d=d.slice(t.to-I);I=t.to}}}function oe(a,b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e);!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",
-c.id));e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e));a.pos+=b;a.trailingSpace=!1}function pe(a,b,c){for(var d=this.line=b,e;d=wa(d,!1);)d=d.find(1,!0).line,(e||(e=[])).push(d);this.size=(this.rest=e)?N(w(this.rest))-c+1:1;this.node=this.text=null;this.hidden=$a(a,b)}function Uc(a,b,c){var d=[],e;for(e=b;e<c;)b=new pe(a.doc,J(a.doc,e),e),e+=b.size,d.push(b);return d}function lg(a,b){if(a=a.ownsGroup)try{var c=a.delayedCallbacks,d=0;do{for(;d<c.length;d++)c[d].call(null);for(var e=
-0;e<a.ops.length;e++){var g=a.ops[e];if(g.cursorActivityHandlers)for(;g.cursorActivityCalled<g.cursorActivityHandlers.length;)g.cursorActivityHandlers[g.cursorActivityCalled++].call(null,g.cm)}}while(d<c.length)}finally{Jb=null,b(a)}}function qa(a,b){var c=a._handlers&&a._handlers[b]||Pc;if(c.length){var d=Array.prototype.slice.call(arguments,2);if(Jb)var e=Jb.delayedCallbacks;else fc?e=fc:(e=fc=[],setTimeout(mg,0));for(var g=function(a){e.push(function(){return c[a].apply(null,d)})},k=0;k<c.length;++k)g(k)}}
-function mg(){var a=fc;fc=null;for(var b=0;b<a.length;++b)a[b]()}function qe(a,b,c,d){for(var e=0;e<b.changes.length;e++){var g=b.changes[e];if("text"==g){g=a;var k=b,l=k.text.className,m=re(g,k);k.text==k.node&&(k.node=m.pre);k.text.parentNode.replaceChild(m.pre,k.text);k.text=m.pre;m.bgClass!=k.bgClass||m.textClass!=k.textClass?(k.bgClass=m.bgClass,k.textClass=m.textClass,ud(g,k)):l&&(k.text.className=l)}else if("gutter"==g)se(a,b,c,d);else if("class"==g)ud(a,b);else if("widget"==g){g=a;k=b;l=d;
-k.alignable&&(k.alignable=null);m=k.node.firstChild;for(var I;m;m=I)I=m.nextSibling,"CodeMirror-linewidget"==m.className&&k.node.removeChild(m);te(g,k,l)}}b.changes=null}function gc(a){a.node==a.text&&(a.node=d("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),V&&8>ca&&(a.node.style.zIndex=2));return a.node}function re(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=
-c.measure,c.built):ne(a,b)}function ud(a,b){var c=b.bgClass?b.bgClass+" "+(b.line.bgClass||""):b.line.bgClass;c&&(c+=" CodeMirror-linebackground");if(b.background)c?b.background.className=c:(b.background.parentNode.removeChild(b.background),b.background=null);else if(c){var e=gc(b);b.background=e.insertBefore(d("div",null,c),e.firstChild);a.display.input.setUneditable(b.background)}b.line.wrapClass?gc(b).className=b.line.wrapClass:b.node!=b.text&&(b.node.className="");b.text.className=(b.textClass?
-b.textClass+" "+(b.line.textClass||""):b.line.textClass)||""}function se(a,b,c,e){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);b.gutterBackground&&(b.node.removeChild(b.gutterBackground),b.gutterBackground=null);if(b.line.gutterClass){var g=gc(b);b.gutterBackground=d("div",null,"CodeMirror-gutter-background "+b.line.gutterClass,"left: "+(a.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+"px; width: "+e.gutterTotalWidth+"px");a.display.input.setUneditable(b.gutterBackground);g.insertBefore(b.gutterBackground,
-b.text)}g=b.line.gutterMarkers;if(a.options.lineNumbers||g){var k=gc(b),l=b.gutter=d("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+"px");a.display.input.setUneditable(l);k.insertBefore(l,b.text);b.line.gutterClass&&(l.className+=" "+b.line.gutterClass);!a.options.lineNumbers||g&&g["CodeMirror-linenumbers"]||(b.lineNumber=l.appendChild(d("div",Z(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+e.gutterLeft["CodeMirror-linenumbers"]+
-"px; width: "+a.display.lineNumInnerWidth+"px")));if(g)for(b=0;b<a.options.gutters.length;++b)c=a.options.gutters[b],(k=g.hasOwnProperty(c)&&g[c])&&l.appendChild(d("div",[k],"CodeMirror-gutter-elt","left: "+e.gutterLeft[c]+"px; width: "+e.gutterWidth[c]+"px"))}}function ng(a,b,c,d){var e=re(a,b);b.text=b.node=e.pre;e.bgClass&&(b.bgClass=e.bgClass);e.textClass&&(b.textClass=e.textClass);ud(a,b);se(a,b,c,d);te(a,b,d);return b.node}function te(a,b,c){ue(a,b.line,b,c,!0);if(b.rest)for(var d=0;d<b.rest.length;d++)ue(a,
-b.rest[d],b,c,!1)}function ue(a,b,c,e,g){if(b.widgets){var k=gc(c),l=0;for(b=b.widgets;l<b.length;++l){var m=b[l],r=d("div",[m.node],"CodeMirror-linewidget");m.handleMouseEvents||r.setAttribute("cm-ignore-events","true");var I=m,t=r,f=e;if(I.noHScroll){(c.alignable||(c.alignable=[])).push(t);var u=f.wrapperWidth;t.style.left=f.fixedPos+"px";I.coverGutter||(u-=f.gutterTotalWidth,t.style.paddingLeft=f.gutterTotalWidth+"px");t.style.width=u+"px"}I.coverGutter&&(t.style.zIndex=5,t.style.position="relative",
-I.noHScroll||(t.style.marginLeft=-f.gutterTotalWidth+"px"));a.display.input.setUneditable(r);g&&m.above?k.insertBefore(r,c.gutter||c.text):k.appendChild(r);qa(m,"redraw")}}}function hc(a){if(null!=a.height)return a.height;var b=a.doc.cm;if(!b)return 0;if(!c(document.body,a.node)){var e="position: relative;";a.coverGutter&&(e+="margin-left: -"+b.display.gutters.offsetWidth+"px;");a.noHScroll&&(e+="width: "+b.display.wrapper.clientWidth+"px;");h(b.display.measure,d("div",[a.node],null,e))}return a.height=
-a.node.parentNode.offsetHeight}function cb(a,b){for(b=b.target||b.srcElement;b!=a.wrapper;b=b.parentNode)if(!b||1==b.nodeType&&"true"==b.getAttribute("cm-ignore-events")||b.parentNode==a.sizer&&b!=a.mover)return!0}function vd(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function ve(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=h(a.measure,d("pre","x"));b=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle;b={left:parseInt(b.paddingLeft),right:parseInt(b.paddingRight)};
-isNaN(b.left)||isNaN(b.right)||(a.cachedPaddingH=b);return b}function Xa(a){return 30-a.display.nativeBarWidth}function qb(a){return a.display.scroller.clientWidth-Xa(a)-a.display.barWidth}function wd(a){return a.display.scroller.clientHeight-Xa(a)-a.display.barHeight}function we(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;d<a.rest.length;d++)if(a.rest[d]==b)return{map:a.measure.maps[d],cache:a.measure.caches[d]};for(b=0;b<a.rest.length;b++)if(N(a.rest[b])>c)return{map:a.measure.maps[b],
-cache:a.measure.caches[b],before:!0}}function xd(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[rb(a,b)];if((a=a.display.externalMeasured)&&b>=a.lineN&&b<a.lineN+a.size)return a}function sb(a,b){var c=N(b),d=xd(a,c);d&&!d.text?d=null:d&&d.changes&&(qe(a,d,c,yd(a)),a.curOp.forceUpdate=!0);if(!d){var e=Ga(b);d=N(e);e=a.display.externalMeasured=new pe(a.doc,e,d);e.lineN=d;d=e.built=ne(a,e);e.text=d.pre;h(a.display.lineMeasure,d.pre);d=e}a=we(d,b,c);return{line:b,view:d,rect:null,
-map:a.map,cache:a.cache,before:a.before,hasHeights:!1}}function Pa(a,b,c,e,g){b.before&&(c=-1);var k=c+(e||"");if(b.cache.hasOwnProperty(k))a=b.cache[k];else{b.rect||(b.rect=b.view.text.getBoundingClientRect());if(!b.hasHeights){var l=b.view,m=b.rect,r=a.options.lineWrapping,t=r&&qb(a);if(!l.measure.heights||r&&l.measure.width!=t){var I=l.measure.heights=[];if(r)for(l.measure.width=t,l=l.text.firstChild.getClientRects(),r=0;r<l.length-1;r++){t=l[r];var f=l[r+1];2<Math.abs(t.bottom-f.bottom)&&I.push((t.bottom+
-f.top)/2-m.top)}I.push(m.bottom-m.top)}b.hasHeights=!0}I=e;l=xe(b.map,c,I);e=l.node;m=l.start;r=l.end;c=l.collapse;if(3==e.nodeType){for(var u=0;4>u;u++){for(;m&&C(b.line.text.charAt(l.coverStart+m));)--m;for(;l.coverStart+r<l.coverEnd&&C(b.line.text.charAt(l.coverStart+r));)++r;if(V&&9>ca&&0==m&&r==l.coverEnd-l.coverStart)var v=e.parentNode.getBoundingClientRect();else{v=ec(e,m,r).getClientRects();r=ye;if("left"==I)for(t=0;t<v.length&&(r=v[t]).left==r.right;t++);else for(t=v.length-1;0<=t&&(r=v[t]).left==
-r.right;t--);v=r}if(v.left||v.right||0==m)break;r=m;--m;c="right"}V&&11>ca&&((u=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)||(null!=zd?u=zd:(I=h(a.display.measure,d("span","x")),u=I.getBoundingClientRect(),I=ec(I,0,1).getBoundingClientRect(),u=zd=1<Math.abs(u.left-I.left)),u=!u),u||(u=screen.logicalXDPI/screen.deviceXDPI,I=screen.logicalYDPI/screen.deviceYDPI,v={left:v.left*u,right:v.right*u,top:v.top*I,bottom:v.bottom*I}))}else 0<m&&(c=I="right"),v=a.options.lineWrapping&&
-1<(u=e.getClientRects()).length?u["right"==I?u.length-1:0]:e.getBoundingClientRect();!(V&&9>ca)||m||v&&(v.left||v.right)||(v=(v=e.parentNode.getClientRects()[0])?{left:v.left,right:v.left+ic(a.display),top:v.top,bottom:v.bottom}:ye);e=v.top-b.rect.top;m=v.bottom-b.rect.top;u=(e+m)/2;I=b.view.measure.heights;for(l=0;l<I.length-1&&!(u<I[l]);l++);c={left:("right"==c?v.right:v.left)-b.rect.left,right:("left"==c?v.left:v.right)-b.rect.left,top:l?I[l-1]:0,bottom:I[l]};v.left||v.right||(c.bogus=!0);a.options.singleCursorHeightPerLine||
-(c.rtop=e,c.rbottom=m);a=c;a.bogus||(b.cache[k]=a)}return{left:a.left,right:a.right,top:g?a.rtop:a.top,bottom:g?a.rbottom:a.bottom}}function xe(a,b,c){for(var d,e,g,k,l,m,r=0;r<a.length;r+=3){l=a[r];m=a[r+1];if(b<l)e=0,g=1,k="left";else if(b<m)e=b-l,g=e+1;else if(r==a.length-3||b==m&&a[r+3]>b)g=m-l,e=g-1,b>=m&&(k="right");if(null!=e){d=a[r+2];l==m&&c==(d.insertLeft?"left":"right")&&(k=c);if("left"==c&&0==e)for(;r&&a[r-2]==a[r-3]&&a[r-1].insertLeft;)d=a[(r-=3)+2],k="left";if("right"==c&&e==m-l)for(;r<
-a.length-3&&a[r+3]==a[r+4]&&!a[r+5].insertLeft;)d=a[(r+=3)+2],k="right";break}}return{node:d,start:e,end:g,collapse:k,coverStart:l,coverEnd:m}}function ze(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function Ae(a){a.display.externalMeasure=null;f(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)ze(a.display.view[b])}function jc(a){Ae(a);a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=
-null;a.options.lineWrapping||(a.display.maxLineChanged=!0);a.display.lineNumChars=null}function Be(){return Vc&&Wc?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Ce(){return Vc&&Wc?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Ad(a){var b=
-0;if(a.widgets)for(var c=0;c<a.widgets.length;++c)a.widgets[c].above&&(b+=hc(a.widgets[c]));return b}function Xc(a,b,c,d,e){e||(e=Ad(b),c.top+=e,c.bottom+=e);if("line"==d)return c;d||(d="local");b=Ha(b);b="local"==d?b+a.display.lineSpace.offsetTop:b-a.display.viewOffset;if("page"==d||"window"==d)a=a.display.lineSpace.getBoundingClientRect(),b+=a.top+("window"==d?0:Ce()),d=a.left+("window"==d?0:Be()),c.left+=d,c.right+=d;c.top+=b;c.bottom+=b;return c}function De(a,b,c){if("div"==c)return b;var d=b.left;
-b=b.top;"page"==c?(d-=Be(),b-=Ce()):"local"!=c&&c||(c=a.display.sizer.getBoundingClientRect(),d+=c.left,b+=c.top);a=a.display.lineSpace.getBoundingClientRect();return{left:d-a.left,top:b-a.top}}function Bd(a,b,c,d,e){d||(d=J(a.doc,b.line));var g=d;b=b.ch;d=Pa(a,sb(a,d),b,e);return Xc(a,g,d,c)}function Qa(a,b,c,d,e,g){function k(b,k){b=Pa(a,e,b,k?"right":"left",g);k?b.left=b.right:b.right=b.left;return Xc(a,d,b,c)}function l(a,b,c){return k(c?a-1:a,1==m[b].level!=c)}d=d||J(a.doc,b.line);e||(e=sb(a,
-d));var m=Ca(d,a.doc.direction),r=b.ch;b=b.sticky;r>=d.text.length?(r=d.text.length,b="before"):0>=r&&(r=0,b="after");if(!m)return k("before"==b?r-1:r,"before"==b);var t=Ua(m,r,b),I=Zb;t=l(r,t,"before"==b);null!=I&&(t.other=l(r,I,"before"!=b));return t}function Ee(a,b){var c=0;b=R(a.doc,b);a.options.lineWrapping||(c=ic(a.display)*b.ch);b=J(a.doc,b.line);a=Ha(b)+a.display.lineSpace.offsetTop;return{left:c,right:c,top:a,bottom:a+b.height}}function Cd(a,b,c,d,e){a=H(a,b,c);a.xRel=e;d&&(a.outside=!0);
-return a}function Dd(a,b,c){var d=a.doc;c+=a.display.viewOffset;if(0>c)return Cd(d.first,0,null,!0,-1);var e=S(d,c),g=d.first+d.size-1;if(e>g)return Cd(d.first+d.size-1,J(d,g).text.length,null,!0,1);0>b&&(b=0);for(d=J(d,e);;)if(e=og(a,d,e,b,c),g=(d=wa(d,!1))&&d.find(0,!0),d&&(e.ch>g.from.ch||e.ch==g.from.ch&&0<e.xRel))e=N(d=g.to.line);else return e}function Fe(a,b,c,d){d-=Ad(b);b=b.text.length;var e=F(function(b){return Pa(a,c,b-1).bottom<=d},b,0);b=F(function(b){return Pa(a,c,b).top>d},e,b);return{begin:e,
-end:b}}function Ge(a,b,c,d){c||(c=sb(a,b));d=Xc(a,b,Pa(a,c,d),"line").top;return Fe(a,b,c,d)}function Ed(a,b,c,d){return a.bottom<=c?!1:a.top>c?!0:(d?a.left:a.right)>b}function og(a,b,c,d,e){e-=Ha(b);var g=sb(a,b),k=Ad(b),l=0,m=b.text.length,r=!0,t=Ca(b,a.doc.direction);t&&(t=(a.options.lineWrapping?pg:qg)(a,b,c,g,t,d,e),l=(r=1!=t.level)?t.from:t.to-1,m=r?t.to:t.from-1);var I=null,f=null;t=F(function(b){var c=Pa(a,g,b);c.top+=k;c.bottom+=k;if(!Ed(c,d,e,!1))return!1;c.top<=e&&c.left<=d&&(I=b,f=c);
-return!0},l,m);var u=!1;f?(l=d-f.left<f.right-d,r=l==r,t=I+(r?0:1),r=r?"after":"before",l=l?f.left:f.right):(r||t!=m&&t!=l||t++,r=0==t?"after":t==b.text.length?"before":Pa(a,g,t-(r?1:0)).bottom+k<=e==r?"after":"before",u=Qa(a,H(c,t,r),"line",b,g),l=u.left,u=e<u.top||e>=u.bottom);t=B(b.text,t,1);return Cd(c,t,r,u,d-l)}function qg(a,b,c,d,e,g,k){var l=F(function(l){l=e[l];var m=1!=l.level;return Ed(Qa(a,H(c,m?l.to:l.from,m?"before":"after"),"line",b,d),g,k,!0)},0,e.length-1),m=e[l];if(0<l){var r=1!=
-m.level;r=Qa(a,H(c,r?m.from:m.to,r?"after":"before"),"line",b,d);Ed(r,g,k,!0)&&r.top>k&&(m=e[l-1])}return m}function pg(a,b,c,d,e,g,k){k=Fe(a,b,d,k);c=k.begin;k=k.end;/\s/.test(b.text.charAt(k-1))&&k--;for(var l=b=null,m=0;m<e.length;m++){var r=e[m];if(!(r.from>=k||r.to<=c)){var t=Pa(a,d,1!=r.level?Math.min(k,r.to)-1:Math.max(c,r.from)).right;t=t<g?g-t+1E9:t-g;if(!b||l>t)b=r,l=t}}b||(b=e[e.length-1]);b.from<c&&(b={from:c,to:b.to,level:b.level});b.to>k&&(b={from:b.from,to:k,level:b.level});return b}
-function tb(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==ub){ub=d("pre");for(var b=0;49>b;++b)ub.appendChild(document.createTextNode("x")),ub.appendChild(d("br"));ub.appendChild(document.createTextNode("x"))}h(a.measure,ub);b=ub.offsetHeight/50;3<b&&(a.cachedTextHeight=b);f(a.measure);return b||1}function ic(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=d("span","xxxxxxxxxx"),c=d("pre",[b]);h(a.measure,c);b=b.getBoundingClientRect();b=(b.right-b.left)/10;2<b&&(a.cachedCharWidth=
-b);return b||10}function yd(a){for(var b=a.display,c={},d={},e=b.gutters.clientLeft,g=b.gutters.firstChild,k=0;g;g=g.nextSibling,++k)c[a.options.gutters[k]]=g.offsetLeft+g.clientLeft+e,d[a.options.gutters[k]]=g.clientWidth;return{fixedPos:Fd(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function Fd(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function He(a){var b=tb(a.display),c=a.options.lineWrapping,
-d=c&&Math.max(5,a.display.scroller.clientWidth/ic(a.display)-3);return function(e){if($a(a.doc,e))return 0;var g=0;if(e.widgets)for(var k=0;k<e.widgets.length;k++)e.widgets[k].height&&(g+=e.widgets[k].height);return c?g+(Math.ceil(e.text.length/d)||1)*b:g+b}}function Gd(a){var b=a.doc,c=He(a);b.iter(function(a){var b=c(a);b!=a.height&&P(a,b)})}function vb(a,b,c,d){var e=a.display;if(!c&&"true"==(b.target||b.srcElement).getAttribute("cm-not-content"))return null;c=e.lineSpace.getBoundingClientRect();
-try{var g=b.clientX-c.left;var k=b.clientY-c.top}catch(he){return null}b=Dd(a,g,k);var l;d&&1==b.xRel&&(l=J(a.doc,b.line).text).length==b.ch&&(d=m(l,l.length,a.options.tabSize)-l.length,b=H(b.line,Math.max(0,Math.round((g-ve(a.display).left)/ic(a.display))-d)));return b}function rb(a,b){if(b>=a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;a=a.display.view;for(var c=0;c<a.length;c++)if(b-=a[c].size,0>b)return c}function kc(a){a.display.input.showSelection(a.display.input.prepareSelection())}
-function Ie(a,b){void 0===b&&(b=!0);for(var c=a.doc,d={},e=d.cursors=document.createDocumentFragment(),g=d.selection=document.createDocumentFragment(),k=0;k<c.sel.ranges.length;k++)if(b||k!=c.sel.primIndex){var l=c.sel.ranges[k];if(!(l.from().line>=a.display.viewTo||l.to().line<a.display.viewFrom)){var m=l.empty();(m||a.options.showCursorWhenSelecting)&&Je(a,l.head,e);m||rg(a,l,g)}}return d}function Je(a,b,c){b=Qa(a,b,"div",null,null,!a.options.singleCursorHeightPerLine);var e=c.appendChild(d("div",
-"\u00a0","CodeMirror-cursor"));e.style.left=b.left+"px";e.style.top=b.top+"px";e.style.height=Math.max(0,b.bottom-b.top)*a.options.cursorHeight+"px";b.other&&(a=c.appendChild(d("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor")),a.style.display="",a.style.left=b.other.left+"px",a.style.top=b.other.top+"px",a.style.height=.85*(b.other.bottom-b.other.top)+"px")}function Yc(a,b){return a.top-b.top||a.left-b.left}function rg(a,b,c){function e(a,b,c,e){0>b&&(b=0);b=Math.round(b);e=Math.round(e);
-m.appendChild(d("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px;\n                             top: "+b+"px; width: "+(null==c?I-a:c)+"px;\n                             height: "+(e-b)+"px"))}function g(b,c,d){function g(c,d){return Bd(a,H(b,c),"div",m,d)}function k(b,c,d){b=Ge(a,m,null,b);c="ltr"==c==("after"==d)?"left":"right";d="after"==d?b.begin:b.end-(/\s/.test(m.text.charAt(b.end-1))?2:1);return g(d,c)[c]}var m=J(l,b),r=m.text.length,u,h,v=Ca(m,l.direction);qd(v,c||0,null==
-d?r:d,function(a,b,l,m){var n="ltr"==l,w=g(a,n?"left":"right"),p=g(b-1,n?"right":"left"),la=null==c&&0==a,D=null==d&&b==r,x=0==m;m=!v||m==v.length-1;3>=p.top-w.top?(b=(f?la:D)&&x?t:(n?w:p).left,e(b,w.top,((f?D:la)&&m?I:(n?p:w).right)-b,w.bottom)):(n?(n=f&&la&&x?t:w.left,la=f?I:k(a,l,"before"),a=f?t:k(b,l,"after"),D=f&&D&&m?I:p.right):(n=f?k(a,l,"before"):t,la=!f&&la&&x?I:w.right,a=!f&&D&&m?t:p.left,D=f?k(b,l,"after"):I),e(n,w.top,la-n,w.bottom),w.bottom<p.top&&e(t,w.bottom,null,p.top),e(a,p.top,D-
-a,p.bottom));if(!u||0>Yc(w,u))u=w;0>Yc(p,u)&&(u=p);if(!h||0>Yc(w,h))h=w;0>Yc(p,h)&&(h=p)});return{start:u,end:h}}var k=a.display,l=a.doc,m=document.createDocumentFragment(),r=ve(a.display),t=r.left,I=Math.max(k.sizerWidth,qb(a)-k.sizer.offsetLeft)-r.right,f="ltr"==l.direction;k=b.from();b=b.to();if(k.line==b.line)g(k.line,k.ch,b.ch);else{var u=J(l,k.line);r=J(l,b.line);r=Ga(u)==Ga(r);k=g(k.line,k.ch,r?u.text.length+1:null).end;b=g(b.line,r?0:null,b.ch).start;r&&(k.top<b.top-2?(e(k.right,k.top,null,
-k.bottom),e(t,b.top,b.left,b.bottom)):e(k.right,k.top,b.left-k.right,k.bottom));k.bottom<b.top&&e(t,k.bottom,null,b.top)}c.appendChild(m)}function Hd(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility="";0<a.options.cursorBlinkRate?b.blinker=setInterval(function(){return b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate):0>a.options.cursorBlinkRate&&(b.cursorDiv.style.visibility="hidden")}}function Ke(a){a.state.focused||
-(a.display.input.focus(),Id(a))}function Le(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,lc(a))},100)}function Id(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1);"nocursor"!=a.options.readOnly&&(a.state.focused||(da(a,"focus",a,b),a.state.focused=!0,g(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),sa&&setTimeout(function(){return a.display.input.reset(!0)},
-20)),a.display.input.receivedFocus()),Hd(a))}function lc(a,b){a.state.delayingBlurEvent||(a.state.focused&&(da(a,"blur",a,b),a.state.focused=!1,wb(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function Zc(a){a=a.display;for(var b=a.lineDiv.offsetTop,c=0;c<a.view.length;c++){var d=a.view[c];if(!d.hidden){if(V&&8>ca){var e=d.node.offsetTop+d.node.offsetHeight;var g=e-b;b=e}else g=d.node.getBoundingClientRect(),
-g=g.bottom-g.top;e=d.line.height-g;2>g&&(g=tb(a));if(.005<e||-.005>e)if(P(d.line,g),Me(d.line),d.rest)for(g=0;g<d.rest.length;g++)Me(d.rest[g])}}}function Me(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.parentNode.offsetHeight}function Jd(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop;d=Math.floor(d-a.lineSpace.offsetTop);var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight;d=S(b,d);e=S(b,e);if(c&&c.ensure){var g=c.ensure.from.line;
-c=c.ensure.to.line;g<d?(d=g,e=S(b,Ha(J(b,g))+a.wrapper.clientHeight)):Math.min(c,b.lastLine())>=e&&(d=S(b,Ha(J(b,c))-a.wrapper.clientHeight),e=c)}return{from:d,to:Math.max(e,d+1)}}function Ne(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=Fd(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,g=d+"px",k=0;k<c.length;k++)if(!c[k].hidden){a.options.fixedGutter&&(c[k].gutter&&(c[k].gutter.style.left=g),c[k].gutterBackground&&(c[k].gutterBackground.style.left=
-g));var l=c[k].alignable;if(l)for(var m=0;m<l.length;m++)l[m].style.left=g}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function Oe(a){if(!a.options.lineNumbers)return!1;var b=a.doc;b=Z(a.options,b.first+b.size-1);var c=a.display;if(b.length!=c.lineNumChars){var e=c.measure.appendChild(d("div",[d("div",b)],"CodeMirror-linenumber CodeMirror-gutter-elt")),g=e.firstChild.offsetWidth;e=e.offsetWidth-g;c.lineGutter.style.width="";c.lineNumInnerWidth=Math.max(g,c.lineGutter.offsetWidth-e)+1;
-c.lineNumWidth=c.lineNumInnerWidth+e;c.lineNumChars=c.lineNumInnerWidth?b.length:-1;c.lineGutter.style.width=c.lineNumWidth+"px";Kd(a);return!0}return!1}function Ld(a,b){var c=a.display,d=tb(a.display);0>b.top&&(b.top=0);var e=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:c.scroller.scrollTop,g=wd(a),k={};b.bottom-b.top>g&&(b.bottom=b.top+g);var l=a.doc.height+vd(c),m=b.top<d;d=b.bottom>l-d;b.top<e?k.scrollTop=m?0:b.top:b.bottom>e+g&&(g=Math.min(b.top,(d?l:b.bottom)-g),g!=e&&(k.scrollTop=g));
-e=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:c.scroller.scrollLeft;a=qb(a)-(a.options.fixedGutter?c.gutters.offsetWidth:0);if(c=b.right-b.left>a)b.right=b.left+a;10>b.left?k.scrollLeft=0:b.left<e?k.scrollLeft=Math.max(0,b.left-(c?0:10)):b.right>a+e-3&&(k.scrollLeft=b.right+(c?0:10)-a);return k}function $c(a,b){null!=b&&(ad(a),a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+b)}function Kb(a){ad(a);var b=a.getCursor();a.curOp.scrollToPos={from:b,to:b,margin:a.options.cursorScrollMargin}}
-function mc(a,b,c){null==b&&null==c||ad(a);null!=b&&(a.curOp.scrollLeft=b);null!=c&&(a.curOp.scrollTop=c)}function ad(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=Ee(a,b.from),d=Ee(a,b.to);Pe(a,c,d,b.margin)}}function Pe(a,b,c,d){b=Ld(a,{left:Math.min(b.left,c.left),top:Math.min(b.top,c.top)-d,right:Math.max(b.right,c.right),bottom:Math.max(b.bottom,c.bottom)+d});mc(a,b.scrollLeft,b.scrollTop)}function nc(a,b){2>Math.abs(a.doc.scrollTop-b)||(eb||Md(a,{top:b}),Qe(a,b,!0),eb&&Md(a),
-oc(a,100))}function Qe(a,b,c){b=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,b);if(a.display.scroller.scrollTop!=b||c)a.doc.scrollTop=b,a.display.scrollbars.setScrollTop(b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b)}function xb(a,b,c,d){b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth);(c?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b))&&!d||(a.doc.scrollLeft=b,Ne(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=
-b),a.display.scrollbars.setScrollLeft(b))}function pc(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+vd(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+Xa(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function Lb(a,b){b||(b=pc(a));var c=a.display.barWidth,d=
-a.display.barHeight;Re(a,b);for(b=0;4>b&&c!=a.display.barWidth||d!=a.display.barHeight;b++)c!=a.display.barWidth&&a.options.lineWrapping&&Zc(a),Re(a,pc(a)),c=a.display.barWidth,d=a.display.barHeight}function Re(a,b){var c=a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px";c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px";c.heightForcer.style.borderBottom=d.bottom+"px solid transparent";d.right&&d.bottom?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=
-d.bottom+"px",c.scrollbarFiller.style.width=d.right+"px"):c.scrollbarFiller.style.display="";d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=d.bottom+"px",c.gutterFiller.style.width=b.gutterWidth+"px"):c.gutterFiller.style.display=""}function Se(a){a.display.scrollbars&&(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&wb(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new Te[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,
-a.display.scrollbarFiller);T(b,"mousedown",function(){a.state.focused&&setTimeout(function(){return a.display.input.focus()},0)});b.setAttribute("cm-not-content","true")},function(b,c){"horizontal"==c?xb(a,b):nc(a,b)},a);a.display.scrollbars.addClass&&g(a.display.wrapper,a.display.scrollbars.addClass)}function yb(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,
-updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++sg};a=a.curOp;Jb?Jb.ops.push(a):a.ownsGroup=Jb={ops:[a],delayedCallbacks:[]}}function zb(a){lg(a.curOp,function(a){for(var b=0;b<a.ops.length;b++)a.ops[b].cm.curOp=null;a=a.ops;for(b=0;b<a.length;b++){var c=a[b],g=c.cm,k=g.display,l=g.display;!l.scrollbarsClipped&&l.scroller.offsetWidth&&(l.nativeBarWidth=l.scroller.offsetWidth-l.scroller.clientWidth,l.heightForcer.style.height=Xa(g)+"px",l.sizer.style.marginBottom=-l.nativeBarWidth+
-"px",l.sizer.style.borderRightWidth=Xa(g)+"px",l.scrollbarsClipped=!0);c.updateMaxLine&&ab(g);c.mustUpdate=c.viewChanged||c.forceUpdate||null!=c.scrollTop||c.scrollToPos&&(c.scrollToPos.from.line<k.viewFrom||c.scrollToPos.to.line>=k.viewTo)||k.maxLineChanged&&g.options.lineWrapping;c.update=c.mustUpdate&&new bd(g,c.mustUpdate&&{top:c.scrollTop,ensure:c.scrollToPos},c.forceUpdate)}for(b=0;b<a.length;b++)c=a[b],c.updatedDisplay=c.mustUpdate&&Nd(c.cm,c.update);for(b=0;b<a.length;b++)if(c=a[b],g=c.cm,
-k=g.display,c.updatedDisplay&&Zc(g),c.barMeasure=pc(g),k.maxLineChanged&&!g.options.lineWrapping&&(l=k.maxLine.text.length,l=Pa(g,sb(g,k.maxLine),l,void 0),c.adjustWidthTo=l.left+3,g.display.sizerWidth=c.adjustWidthTo,c.barMeasure.scrollWidth=Math.max(k.scroller.clientWidth,k.sizer.offsetLeft+c.adjustWidthTo+Xa(g)+g.display.barWidth),c.maxScrollLeft=Math.max(0,k.sizer.offsetLeft+c.adjustWidthTo-qb(g))),c.updatedDisplay||c.selectionChanged)c.preparedSelection=k.input.prepareSelection();for(b=0;b<a.length;b++)c=
-a[b],g=c.cm,null!=c.adjustWidthTo&&(g.display.sizer.style.minWidth=c.adjustWidthTo+"px",c.maxScrollLeft<g.doc.scrollLeft&&xb(g,Math.min(g.display.scroller.scrollLeft,c.maxScrollLeft),!0),g.display.maxLineChanged=!1),k=c.focus&&c.focus==e(),c.preparedSelection&&g.display.input.showSelection(c.preparedSelection,k),(c.updatedDisplay||c.startHeight!=g.doc.height)&&Lb(g,c.barMeasure),c.updatedDisplay&&Od(g,c.barMeasure),c.selectionChanged&&Hd(g),g.state.focused&&c.updateInput&&g.display.input.reset(c.typing),
-k&&Ke(c.cm);for(b=0;b<a.length;b++){var m=void 0;c=a[b];g=c.cm;k=g.display;l=g.doc;c.updatedDisplay&&Ue(g,c.update);null==k.wheelStartX||null==c.scrollTop&&null==c.scrollLeft&&!c.scrollToPos||(k.wheelStartX=k.wheelStartY=null);null!=c.scrollTop&&Qe(g,c.scrollTop,c.forceScroll);null!=c.scrollLeft&&xb(g,c.scrollLeft,!0,!0);if(c.scrollToPos){var r=R(l,c.scrollToPos.from),t=R(l,c.scrollToPos.to),f=c.scrollToPos.margin;null==f&&(f=0);g.options.lineWrapping||r!=t||(r=r.ch?H(r.line,"before"==r.sticky?r.ch-
-1:r.ch,"after"):r,t="before"==r.sticky?H(r.line,r.ch+1,"before"):r);for(var u=0;5>u;u++){var I=!1;m=Qa(g,r);var h=t&&t!=r?Qa(g,t):m;m={left:Math.min(m.left,h.left),top:Math.min(m.top,h.top)-f,right:Math.max(m.left,h.left),bottom:Math.max(m.bottom,h.bottom)+f};h=Ld(g,m);var v=g.doc.scrollTop,n=g.doc.scrollLeft;null!=h.scrollTop&&(nc(g,h.scrollTop),1<Math.abs(g.doc.scrollTop-v)&&(I=!0));null!=h.scrollLeft&&(xb(g,h.scrollLeft),1<Math.abs(g.doc.scrollLeft-n)&&(I=!0));if(!I)break}t=m;ia(g,"scrollCursorIntoView")||
-(f=g.display,u=f.sizer.getBoundingClientRect(),r=null,0>t.top+u.top?r=!0:t.bottom+u.top>(window.innerHeight||document.documentElement.clientHeight)&&(r=!1),null==r||tg||(t=d("div","\u200b",null,"position: absolute;\n                         top: "+(t.top-f.viewOffset-g.display.lineSpace.offsetTop)+"px;\n                         height: "+(t.bottom-t.top+Xa(g)+f.barHeight)+"px;\n                         left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;"),g.display.lineSpace.appendChild(t),
-t.scrollIntoView(r),g.display.lineSpace.removeChild(t)))}t=c.maybeHiddenMarkers;r=c.maybeUnhiddenMarkers;if(t)for(f=0;f<t.length;++f)t[f].lines.length||da(t[f],"hide");if(r)for(t=0;t<r.length;++t)r[t].lines.length&&da(r[t],"unhide");k.wrapper.offsetHeight&&(l.scrollTop=g.display.scroller.scrollTop);c.changeObjs&&da(g,"changes",g,c.changeObjs);c.update&&c.update.finish()}})}function Ea(a,b){if(a.curOp)return b();yb(a);try{return b()}finally{zb(a)}}function oa(a,b){return function(){if(a.curOp)return b.apply(a,
-arguments);yb(a);try{return b.apply(a,arguments)}finally{zb(a)}}}function ua(a){return function(){if(this.curOp)return a.apply(this,arguments);yb(this);try{return a.apply(this,arguments)}finally{zb(this)}}}function pa(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);yb(b);try{return a.apply(this,arguments)}finally{zb(b)}}}function ya(a,b,c,d){null==b&&(b=a.doc.first);null==c&&(c=a.doc.first+a.doc.size);d||(d=0);var e=a.display;d&&c<e.viewTo&&(null==e.updateLineNumbers||
-e.updateLineNumbers>b)&&(e.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=e.viewTo)fb&&Xb(a.doc,b)<e.viewTo&&jb(a);else if(c<=e.viewFrom)fb&&Nc(a.doc,c+d)>e.viewFrom?jb(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)jb(a);else if(b<=e.viewFrom){var g=cd(a,c,c+d,1);g?(e.view=e.view.slice(g.index),e.viewFrom=g.lineN,e.viewTo+=d):jb(a)}else if(c>=e.viewTo)(g=cd(a,b,b,-1))?(e.view=e.view.slice(0,g.index),e.viewTo=g.lineN):jb(a);else{g=cd(a,b,b,-1);var k=cd(a,c,c+d,1);g&&k?(e.view=
-e.view.slice(0,g.index).concat(Uc(a,g.lineN,k.lineN)).concat(e.view.slice(k.index)),e.viewTo+=d):jb(a)}if(a=e.externalMeasured)c<a.lineN?a.lineN+=d:b<a.lineN+a.size&&(e.externalMeasured=null)}function kb(a,b,c){a.curOp.viewChanged=!0;var d=a.display,e=a.display.externalMeasured;e&&b>=e.lineN&&b<e.lineN+e.size&&(d.externalMeasured=null);b<d.viewFrom||b>=d.viewTo||(a=d.view[rb(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==r(a,c)&&a.push(c)))}function jb(a){a.display.viewFrom=a.display.viewTo=
-a.doc.first;a.display.view=[];a.display.viewOffset=0}function cd(a,b,c,d){var e=rb(a,b),g=a.display.view;if(!fb||c==a.doc.first+a.doc.size)return{index:e,lineN:c};for(var k=a.display.viewFrom,l=0;l<e;l++)k+=g[l].size;if(k!=b){if(0<d){if(e==g.length-1)return null;b=k+g[e].size-b;e++}else b=k-b;c+=b}for(;Xb(a.doc,c)!=c;){if(e==(0>d?0:g.length-1))return null;c+=d*g[e-(0>d?1:0)].size;e+=d}return{index:e,lineN:c}}function Ve(a){a=a.display.view;for(var b=0,c=0;c<a.length;c++){var d=a[c];d.hidden||d.node&&
-!d.changes||++b}return b}function oc(a,b){a.doc.highlightFrontier<a.display.viewTo&&a.state.highlight.set(b,k(ug,a))}function ug(a){var b=a.doc;if(!(b.highlightFrontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=Va(a,b.highlightFrontier),e=[];b.iter(d.line,Math.min(b.first+b.size,a.display.viewTo+500),function(g){if(d.line>=a.display.viewFrom){var k=g.styles,l=g.text.length>a.options.maxHighlightLength?Oa(b.mode,d.state):null,m=Sc(a,g,d,!0);l&&(d.state=l);g.styles=m.styles;l=g.styleClasses;
-(m=m.classes)?g.styleClasses=m:l&&(g.styleClasses=null);m=!k||k.length!=g.styles.length||l!=m&&(!l||!m||l.bgClass!=m.bgClass||l.textClass!=m.textClass);for(l=0;!m&&l<k.length;++l)m=k[l]!=g.styles[l];m&&e.push(d.line);g.stateAfter=d.save()}else g.text.length<=a.options.maxHighlightLength&&cc(a,g.text,d),g.stateAfter=0==d.line%5?d.save():null;d.nextLine();if(+new Date>c)return oc(a,a.options.workDelay),!0});b.highlightFrontier=d.line;b.modeFrontier=Math.max(b.modeFrontier,d.line);e.length&&Ea(a,function(){for(var b=
-0;b<e.length;b++)kb(a,e[b],"text")})}}function Nd(a,b){var d=a.display,g=a.doc;if(b.editorIsHidden)return jb(a),!1;if(!b.force&&b.visible.from>=d.viewFrom&&b.visible.to<=d.viewTo&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo)&&d.renderedView==d.view&&0==Ve(a))return!1;Oe(a)&&(jb(a),b.dims=yd(a));var k=g.first+g.size,l=Math.max(b.visible.from-a.options.viewportMargin,g.first),m=Math.min(k,b.visible.to+a.options.viewportMargin);d.viewFrom<l&&20>l-d.viewFrom&&(l=Math.max(g.first,d.viewFrom));
-d.viewTo>m&&20>d.viewTo-m&&(m=Math.min(k,d.viewTo));fb&&(l=Xb(a.doc,l),m=Nc(a.doc,m));g=l!=d.viewFrom||m!=d.viewTo||d.lastWrapHeight!=b.wrapperHeight||d.lastWrapWidth!=b.wrapperWidth;k=a.display;0==k.view.length||l>=k.viewTo||m<=k.viewFrom?(k.view=Uc(a,l,m),k.viewFrom=l):(k.viewFrom>l?k.view=Uc(a,l,k.viewFrom).concat(k.view):k.viewFrom<l&&(k.view=k.view.slice(rb(a,l))),k.viewFrom=l,k.viewTo<m?k.view=k.view.concat(Uc(a,k.viewTo,m)):k.viewTo>m&&(k.view=k.view.slice(0,rb(a,m))));k.viewTo=m;d.viewOffset=
-Ha(J(a.doc,d.viewFrom));a.display.mover.style.top=d.viewOffset+"px";m=Ve(a);if(!g&&0==m&&!b.force&&d.renderedView==d.view&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo))return!1;a.hasFocus()?l=null:(l=e())&&c(a.display.lineDiv,l)?(l={activeElt:l},window.getSelection&&(k=window.getSelection(),k.anchorNode&&k.extend&&c(a.display.lineDiv,k.anchorNode)&&(l.anchorNode=k.anchorNode,l.anchorOffset=k.anchorOffset,l.focusNode=k.focusNode,l.focusOffset=k.focusOffset))):l=null;4<m&&(d.lineDiv.style.display=
-"none");vg(a,d.updateLineNumbers,b.dims);4<m&&(d.lineDiv.style.display="");d.renderedView=d.view;(m=l)&&m.activeElt&&m.activeElt!=e()&&(m.activeElt.focus(),m.anchorNode&&c(document.body,m.anchorNode)&&c(document.body,m.focusNode)&&(l=window.getSelection(),k=document.createRange(),k.setEnd(m.anchorNode,m.anchorOffset),k.collapse(!1),l.removeAllRanges(),l.addRange(k),l.extend(m.focusNode,m.focusOffset)));f(d.cursorDiv);f(d.selectionDiv);d.gutters.style.height=d.sizer.style.minHeight=0;g&&(d.lastWrapHeight=
-b.wrapperHeight,d.lastWrapWidth=b.wrapperWidth,oc(a,400));d.updateLineNumbers=null;return!0}function Ue(a,b){for(var c=b.viewport,d=!0;;d=!1){if(!d||!a.options.lineWrapping||b.oldDisplayWidth==qb(a))if(c&&null!=c.top&&(c={top:Math.min(a.doc.height+vd(a.display)-wd(a),c.top)}),b.visible=Jd(a.display,a.doc,c),b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break;if(!Nd(a,b))break;Zc(a);d=pc(a);kc(a);Lb(a,d);Od(a,d);b.force=!1}b.signal(a,"update",a);if(a.display.viewFrom!=a.display.reportedViewFrom||
-a.display.viewTo!=a.display.reportedViewTo)b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo}function Md(a,b){b=new bd(a,b);if(Nd(a,b)){Zc(a);Ue(a,b);var c=pc(a);kc(a);Lb(a,c);Od(a,c);b.finish()}}function vg(a,b,c){function d(b){var c=b.nextSibling;sa&&Ma&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b);return c}var e=a.display,g=a.options.lineNumbers,k=e.lineDiv,
-l=k.firstChild,m=e.view;e=e.viewFrom;for(var t=0;t<m.length;t++){var u=m[t];if(!u.hidden)if(u.node&&u.node.parentNode==k){for(;l!=u.node;)l=d(l);l=g&&null!=b&&b<=e&&u.lineNumber;u.changes&&(-1<r(u.changes,"gutter")&&(l=!1),qe(a,u,e,c));l&&(f(u.lineNumber),u.lineNumber.appendChild(document.createTextNode(Z(a.options,e))));l=u.node.nextSibling}else{var h=ng(a,u,e,c);k.insertBefore(h,l)}e+=u.size}for(;l;)l=d(l)}function Kd(a){a.display.sizer.style.marginLeft=a.display.gutters.offsetWidth+"px"}function Od(a,
-b){a.display.sizer.style.minHeight=b.docHeight+"px";a.display.heightForcer.style.top=b.docHeight+"px";a.display.gutters.style.height=b.docHeight+a.display.barHeight+Xa(a)+"px"}function We(a){var b=a.display.gutters,c=a.options.gutters;f(b);for(var e=0;e<c.length;++e){var g=c[e],k=b.appendChild(d("div",null,"CodeMirror-gutter "+g));"CodeMirror-linenumbers"==g&&(a.display.lineGutter=k,k.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=e?"":"none";Kd(a)}function Pd(a){var b=r(a.gutters,
-"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):-1<b&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function Xe(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail);null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta);return{x:b,y:c}}function wg(a){a=Xe(a);a.x*=Ia;a.y*=Ia;return a}function Ye(a,b){var c=Xe(b),d=c.x;c=c.y;var e=a.display,g=e.scroller,
-k=g.scrollWidth>g.clientWidth,l=g.scrollHeight>g.clientHeight;if(d&&k||c&&l){if(c&&Ma&&sa){k=b.target;var m=e.view;a:for(;k!=g;k=k.parentNode)for(var r=0;r<m.length;r++)if(m[r].node==k){a.display.currentWheelTarget=k;break a}}!d||eb||Ra||null==Ia?(c&&null!=Ia&&(b=c*Ia,l=a.doc.scrollTop,k=l+e.wrapper.clientHeight,0>b?l=Math.max(0,l+b-50):k=Math.min(a.doc.height,k+b+50),Md(a,{top:l,bottom:k})),20>dd&&(null==e.wheelStartX?(e.wheelStartX=g.scrollLeft,e.wheelStartY=g.scrollTop,e.wheelDX=d,e.wheelDY=c,
-setTimeout(function(){if(null!=e.wheelStartX){var a=g.scrollLeft-e.wheelStartX,b=g.scrollTop-e.wheelStartY;a=b&&e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/e.wheelDX;e.wheelStartX=e.wheelStartY=null;a&&(Ia=(Ia*dd+a)/(dd+1),++dd)}},200)):(e.wheelDX+=d,e.wheelDY+=c))):(c&&l&&nc(a,Math.max(0,g.scrollTop+c*Ia)),xb(a,Math.max(0,g.scrollLeft+d*Ia)),(!c||c&&l)&&na(b),e.wheelStartX=null)}}function Sa(a,b){b=a[b];a.sort(function(a,b){return Q(a.from(),b.from())});b=r(a,b);for(var c=1;c<a.length;c++){var d=a[c],
-e=a[c-1];if(0<=Q(e.to(),d.from())){var g=fa(e.from(),d.from()),k=ka(e.to(),d.to());d=e.empty()?d.from()==d.head:e.from()==e.head;c<=b&&--b;a.splice(--c,2,new W(d?k:g,d?g:k))}}return new Ja(a,b)}function db(a,b){return new Ja([new W(a,b||a)],0)}function lb(a){return a.text?H(a.from.line+a.text.length-1,w(a.text).length+(1==a.text.length?a.from.ch:0)):a.to}function Ze(a,b){if(0>Q(a,b.from))return a;if(0>=Q(a,b.to))return lb(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;a.line==b.to.line&&
-(d+=lb(b).ch-b.to.ch);return H(c,d)}function Qd(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new W(Ze(e.anchor,b),Ze(e.head,b)))}return Sa(c,a.sel.primIndex)}function $e(a,b,c){return a.line==b.line?H(c.line,a.ch-b.ch+c.ch):H(c.line+(a.line-b.line),a.ch)}function Rd(a){a.doc.mode=Na(a.options,a.doc.modeOption);qc(a)}function qc(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null)});a.doc.modeFrontier=a.doc.highlightFrontier=a.doc.first;
-oc(a,100);a.state.modeGen++;a.curOp&&ya(a)}function af(a,b){return 0==b.from.ch&&0==b.to.ch&&""==w(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function Sd(a,b,c,d){function e(a,c,e){a.text=c;a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null);null!=a.order&&(a.order=null);Eb(a);Aa(a,e);c=d?d(a):1;c!=a.height&&P(a,c);qa(a,"change",a,b)}function g(a,b){for(var e=[];a<b;++a)e.push(new Mb(m[a],c?c[a]:null,d));return e}var k=b.from,l=b.to,m=b.text,r=J(a,k.line),t=J(a,l.line),f=w(m),u=
-c?c[m.length-1]:null,h=l.line-k.line;b.full?(a.insert(0,g(0,m.length)),a.remove(m.length,a.size-m.length)):af(a,b)?(l=g(0,m.length-1),e(t,t.text,u),h&&a.remove(k.line,h),l.length&&a.insert(k.line,l)):r==t?1==m.length?e(r,r.text.slice(0,k.ch)+f+r.text.slice(l.ch),u):(h=g(1,m.length-1),h.push(new Mb(f+r.text.slice(l.ch),u,d)),e(r,r.text.slice(0,k.ch)+m[0],c?c[0]:null),a.insert(k.line+1,h)):1==m.length?(e(r,r.text.slice(0,k.ch)+m[0]+t.text.slice(l.ch),c?c[0]:null),a.remove(k.line+1,h)):(e(r,r.text.slice(0,
-k.ch)+m[0],c?c[0]:null),e(t,f+t.text.slice(l.ch),u),u=g(1,m.length-1),1<h&&a.remove(k.line+1,h-1),a.insert(k.line+1,u));qa(a,"change",a,b)}function Ab(a,b,c){function d(a,e,g){if(a.linked)for(var k=0;k<a.linked.length;++k){var l=a.linked[k];if(l.doc!=e){var m=g&&l.sharedHist;if(!c||m)b(l.doc,m),d(l.doc,a,m)}}}d(a,null,!0)}function bf(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;Gd(a);Rd(a);cf(a);a.options.lineWrapping||ab(a);a.options.mode=b.modeOption;ya(a)}function cf(a){("rtl"==
-a.doc.direction?g:wb)(a.display.lineDiv,"CodeMirror-rtl")}function xg(a){Ea(a,function(){cf(a);ya(a)})}function ed(a){this.done=[];this.undone=[];this.undoDepth=Infinity;this.lastModTime=this.lastSelTime=0;this.lastOrigin=this.lastSelOrigin=this.lastOp=this.lastSelOp=null;this.generation=this.maxGeneration=a||1}function Td(a,b){var c={from:ba(b.from),to:lb(b),text:O(a,b.from,b.to)};df(a,c,b.from.line,b.to.line+1);Ab(a,function(a){return df(a,c,b.from.line,b.to.line+1)},!0);return c}function ef(a){for(;a.length;)if(w(a).ranges)a.pop();
-else break}function ff(a,b,c,d){var e=a.history;e.undone.length=0;var g=+new Date,k;if(k=e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>g-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0))){if(e.lastOp==d){ef(e.done);var l=w(e.done)}else e.done.length&&!w(e.done).ranges?l=w(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges?(e.done.pop(),l=w(e.done)):l=void 0;k=l}if(k){var m=w(l.changes);0==Q(b.from,b.to)&&0==Q(b.from,m.to)?m.to=lb(b):l.changes.push(Td(a,
-b))}else for((l=w(e.done))&&l.ranges||fd(a.sel,e.done),l={changes:[Td(a,b)],generation:e.generation},e.done.push(l);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift();e.done.push(c);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=g;e.lastOp=e.lastSelOp=d;e.lastOrigin=e.lastSelOrigin=b.origin;m||da(a,"historyAdded")}function fd(a,b){var c=w(b);c&&c.ranges&&c.equals(a)||b.push(a)}function df(a,b,c,d){var e=b["spans_"+a.id],g=0;a.iter(Math.max(a.first,c),Math.min(a.first+
-a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[g]=c.markedSpans);++g})}function yg(a){if(!a)return null;for(var b,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return b?b.length?b:null:a}function gf(a,b){var c;if(c=b["spans_"+a.id]){for(var d=[],e=0;e<b.text.length;++e)d.push(yg(c[e]));c=d}else c=null;a=Za(a,b);if(!c)return a;if(!a)return c;for(b=0;b<c.length;++b)if(d=c[b],e=a[b],d&&e){var g=0;a:for(;g<e.length;++g){for(var k=e[g],l=0;l<d.length;++l)if(d[l].marker==
-k.marker)continue a;d.push(k)}}else e&&(c[b]=e);return c}function Nb(a,b,c){for(var d=[],e=0;e<a.length;++e){var g=a[e];if(g.ranges)d.push(c?Ja.prototype.deepCopy.call(g):g);else{g=g.changes;var k=[];d.push({changes:k});for(var l=0;l<g.length;++l){var m=g[l],t;k.push({from:m.from,to:m.to,text:m.text});if(b)for(var f in m)(t=f.match(/^spans_(\d+)$/))&&-1<r(b,Number(t[1]))&&(w(k)[f]=m[f],delete m[f])}}}return d}function Ud(a,b,c,d){return d?(a=a.anchor,c&&(d=0>Q(b,a),d!=0>Q(c,a)?(a=b,b=c):d!=0>Q(b,
-c)&&(b=c)),new W(a,b)):new W(c||b,b)}function gd(a,b,c,d,e){null==e&&(e=a.cm&&(a.cm.display.shift||a.extend));ra(a,new Ja([Ud(a.sel.primary(),b,c,e)],0),d)}function hf(a,b,c){for(var d=[],e=a.cm&&(a.cm.display.shift||a.extend),g=0;g<a.sel.ranges.length;g++)d[g]=Ud(a.sel.ranges[g],b[g],null,e);b=Sa(d,a.sel.primIndex);ra(a,b,c)}function Vd(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c;ra(a,Sa(e,a.sel.primIndex),d)}function zg(a,b,c){c={ranges:b.ranges,update:function(b){this.ranges=[];for(var c=0;c<b.length;c++)this.ranges[c]=
-new W(R(a,b[c].anchor),R(a,b[c].head))},origin:c&&c.origin};da(a,"beforeSelectionChange",a,c);a.cm&&da(a.cm,"beforeSelectionChange",a.cm,c);return c.ranges!=b.ranges?Sa(c.ranges,c.ranges.length-1):b}function jf(a,b,c){var d=a.history.done,e=w(d);e&&e.ranges?(d[d.length-1]=b,hd(a,b,c)):ra(a,b,c)}function ra(a,b,c){hd(a,b,c);b=a.sel;var d=a.cm?a.cm.curOp.id:NaN,e=a.history,g=c&&c.origin,k;if(!(k=d==e.lastSelOp)&&(k=g&&e.lastSelOrigin==g)&&!(k=e.lastModTime==e.lastSelTime&&e.lastOrigin==g)){k=w(e.done);
-var l=g.charAt(0);k="*"==l||"+"==l&&k.ranges.length==b.ranges.length&&k.somethingSelected()==b.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}k?e.done[e.done.length-1]=b:fd(b,e.done);e.lastSelTime=+new Date;e.lastSelOrigin=g;e.lastSelOp=d;c&&!1!==c.clearRedo&&ef(e.undone)}function hd(a,b,c){if(Da(a,"beforeSelectionChange")||a.cm&&Da(a.cm,"beforeSelectionChange"))b=zg(a,b,c);var d=c&&c.bias||(0>Q(b.primary().head,a.sel.primary().head)?-1:1);kf(a,lf(a,
-b,d,!0));c&&!1===c.scroll||!a.cm||Kb(a.cm)}function kf(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,$b(a.cm)),qa(a,"cursorActivity",a))}function mf(a){kf(a,lf(a,a.sel,null,!1))}function lf(a,b,c,d){for(var e,g=0;g<b.ranges.length;g++){var k=b.ranges[g],l=b.ranges.length==a.sel.ranges.length&&a.sel.ranges[g],m=Wd(a,k.anchor,l&&l.anchor,c,d);l=Wd(a,k.head,l&&l.head,c,d);if(e||m!=k.anchor||l!=k.head)e||(e=b.ranges.slice(0,g)),e[g]=new W(m,l)}return e?Sa(e,
-b.primIndex):b}function Ob(a,b,c,d,e){var g=J(a,b.line);if(g.markedSpans)for(var k=0;k<g.markedSpans.length;++k){var l=g.markedSpans[k],m=l.marker;if((null==l.from||(m.inclusiveLeft?l.from<=b.ch:l.from<b.ch))&&(null==l.to||(m.inclusiveRight?l.to>=b.ch:l.to>b.ch))){if(e&&(da(m,"beforeCursorEnter"),m.explicitlyCleared))if(g.markedSpans){--k;continue}else break;if(m.atomic){if(c){k=m.find(0>d?1:-1);l=void 0;if(0>d?m.inclusiveRight:m.inclusiveLeft)k=nf(a,k,-d,k&&k.line==b.line?g:null);if(k&&k.line==b.line&&
-(l=Q(k,c))&&(0>d?0>l:0<l))return Ob(a,k,b,d,e)}c=m.find(0>d?-1:1);if(0>d?m.inclusiveLeft:m.inclusiveRight)c=nf(a,c,d,c.line==b.line?g:null);return c?Ob(a,c,b,d,e):null}}}return b}function Wd(a,b,c,d,e){d=d||1;b=Ob(a,b,c,d,e)||!e&&Ob(a,b,c,d,!0)||Ob(a,b,c,-d,e)||!e&&Ob(a,b,c,-d,!0);return b?b:(a.cantEdit=!0,H(a.first,0))}function nf(a,b,c,d){return 0>c&&0==b.ch?b.line>a.first?R(a,H(b.line-1)):null:0<c&&b.ch==(d||J(a,b.line)).text.length?b.line<a.first+a.size-1?H(b.line+1,0):null:new H(b.line,b.ch+
-c)}function of(a){a.setSelection(H(a.firstLine(),0),H(a.lastLine()),Ya)}function pf(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){return d.canceled=!0}};c&&(d.update=function(b,c,e,g){b&&(d.from=R(a,b));c&&(d.to=R(a,c));e&&(d.text=e);void 0!==g&&(d.origin=g)});da(a,"beforeChange",a,d);a.cm&&da(a.cm,"beforeChange",a.cm,d);return d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function Pb(a,b,c){if(a.cm){if(!a.cm.curOp)return oa(a.cm,Pb)(a,
-b,c);if(a.cm.state.suppressEdits)return}if(Da(a,"beforeChange")||a.cm&&Da(a.cm,"beforeChange"))if(b=pf(a,b,!0),!b)return;if(c=qf&&!c&&Wb(a,b.from,b.to))for(var d=c.length-1;0<=d;--d)rf(a,{from:c[d].from,to:c[d].to,text:d?[""]:b.text,origin:b.origin});else rf(a,b)}function rf(a,b){if(1!=b.text.length||""!=b.text[0]||0!=Q(b.from,b.to)){var c=Qd(a,b);ff(a,b,c,a.cm?a.cm.curOp.id:NaN);rc(a,b,c,Za(a,b));var d=[];Ab(a,function(a,c){c||-1!=r(d,a.history)||(sf(a.history,b),d.push(a.history));rc(a,b,null,Za(a,
-b))})}}function id(a,b,c){if(!a.cm||!a.cm.state.suppressEdits||c){for(var d=a.history,e,g=a.sel,k="undo"==b?d.done:d.undone,l="undo"==b?d.undone:d.done,m=0;m<k.length&&(e=k[m],c?!e.ranges||e.equals(a.sel):e.ranges);m++);if(m!=k.length){for(d.lastOrigin=d.lastSelOrigin=null;;)if(e=k.pop(),e.ranges){fd(e,l);if(c&&!e.equals(a.sel)){ra(a,e,{clearRedo:!1});return}g=e}else break;var t=[];fd(g,l);l.push({changes:t,generation:d.generation});d.generation=e.generation||++d.maxGeneration;var f=Da(a,"beforeChange")||
-a.cm&&Da(a.cm,"beforeChange");c=function(c){var d=e.changes[c];d.origin=b;if(f&&!pf(a,d,!1))return k.length=0,{};t.push(Td(a,d));var g=c?Qd(a,d):w(k);rc(a,d,g,gf(a,d));!c&&a.cm&&a.cm.scrollIntoView({from:d.from,to:lb(d)});var l=[];Ab(a,function(a,b){b||-1!=r(l,a.history)||(sf(a.history,d),l.push(a.history));rc(a,d,null,gf(a,d))})};for(d=e.changes.length-1;0<=d;--d)if(g=c(d))return g.v}}}function tf(a,b){if(0!=b&&(a.first+=b,a.sel=new Ja(y(a.sel.ranges,function(a){return new W(H(a.anchor.line+b,a.anchor.ch),
-H(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){ya(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<c.viewTo;d++)kb(a.cm,d,"gutter")}}function rc(a,b,c,d){if(a.cm&&!a.cm.curOp)return oa(a.cm,rc)(a,b,c,d);if(b.to.line<a.first)tf(a,b.text.length-1-(b.to.line-b.from.line));else if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);tf(a,e);b={from:H(a.first,0),to:H(b.to.line+e,b.to.ch),text:[w(b.text)],origin:b.origin}}e=a.lastLine();
-b.to.line>e&&(b={from:b.from,to:H(e,J(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=O(a,b.from,b.to);c||(c=Qd(a,b));a.cm?Ag(a.cm,b,d):Sd(a,b,d);hd(a,c,Ya)}}function Ag(a,b,c){var d=a.doc,e=a.display,g=b.from,k=b.to,l=!1,m=g.line;a.options.lineWrapping||(m=N(Ga(J(d,g.line))),d.iter(m,k.line+1,function(a){if(a==e.maxLine)return l=!0}));-1<d.sel.contains(b.from,b.to)&&$b(a);Sd(d,b,c,He(a));a.options.lineWrapping||(d.iter(m,g.line+b.text.length,function(a){var b=xa(a);b>e.maxLineLength&&
-(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,l=!1)}),l&&(a.curOp.updateMaxLine=!0));fg(d,g.line);oc(a,400);c=b.text.length-(k.line-g.line)-1;b.full?ya(a):g.line!=k.line||1!=b.text.length||af(a.doc,b)?ya(a,g.line,k.line+1,c):kb(a,g.line,"text");c=Da(a,"changes");if((d=Da(a,"change"))||c)b={from:g,to:k,text:b.text,removed:b.removed,origin:b.origin},d&&qa(a,"change",a,b),c&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b);a.display.selForContextMenu=null}function Qb(a,b,c,d,e){d||(d=c);if(0>
-Q(d,c)){var g=[d,c];c=g[0];d=g[1];g}"string"==typeof b&&(b=a.splitLines(b));Pb(a,{from:c,to:d,text:b,origin:e})}function uf(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function vf(a,b,c,d){for(var e=0;e<a.length;++e){var g=a[e],k=!0;if(g.ranges)for(g.copied||(g=a[e]=g.deepCopy(),g.copied=!0),k=0;k<g.ranges.length;k++)uf(g.ranges[k].anchor,b,c,d),uf(g.ranges[k].head,b,c,d);else{for(var l=0;l<g.changes.length;++l){var m=g.changes[l];if(c<m.from.line)m.from=H(m.from.line+d,m.from.ch),m.to=
-H(m.to.line+d,m.to.ch);else if(b<=m.to.line){k=!1;break}}k||(a.splice(0,e+1),e=0)}}}function sf(a,b){var c=b.from.line,d=b.to.line;b=b.text.length-(d-c)-1;vf(a.done,c,d,b);vf(a.undone,c,d,b)}function sc(a,b,c,d){var e=b,g=b;"number"==typeof b?g=J(a,Math.max(a.first,Math.min(b,a.first+a.size-1))):e=N(b);if(null==e)return null;d(g,e)&&a.cm&&kb(a.cm,e,c);return g}function tc(a){this.lines=a;this.parent=null;for(var b=0,c=0;c<a.length;++c)a[c].parent=this,b+=a[c].height;this.height=b}function uc(a){this.children=
-a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d];b+=e.chunkSize();c+=e.height;e.parent=this}this.size=b;this.height=c;this.parent=null}function Bg(a,b,c,d){var e=new vc(a,c,d),g=a.cm;g&&e.noHScroll&&(g.display.alignWidgets=!0);sc(a,b,"widget",function(b){var c=b.widgets||(b.widgets=[]);null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e);e.line=b;g&&!$a(a,b)&&(c=Ha(b)<a.scrollTop,P(b,b.height+hc(e)),c&&$c(g,e.height),g.curOp.forceUpdate=!0);return!0});qa(g,"lineWidgetAdded",
-g,e,"number"==typeof b?b:N(b));return e}function Rb(a,c,d,e,g){if(e&&e.shared)return Cg(a,c,d,e,g);if(a.cm&&!a.cm.curOp)return oa(a.cm,Rb)(a,c,d,e,g);var k=new mb(a,g);g=Q(c,d);e&&t(e,k,!1);if(0<g||0==g&&!1!==k.clearWhenEmpty)return k;k.replacedWith&&(k.collapsed=!0,k.widgetNode=b("span",[k.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||k.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(k.widgetNode.insertLeft=!0));if(k.collapsed){if(Fb(a,c.line,c,d,k)||c.line!=d.line&&Fb(a,
-d.line,c,d,k))throw Error("Inserting collapsed marker partially overlapping an existing one");fb=!0}k.addToHistory&&ff(a,{from:c,to:d,origin:"markText"},a.sel,NaN);var l=c.line,m=a.cm,r;a.iter(l,d.line+1,function(a){m&&k.collapsed&&!m.options.lineWrapping&&Ga(a)==m.display.maxLine&&(r=!0);k.collapsed&&l!=c.line&&P(a,0);var b=new Ka(k,l==c.line?c.ch:null,l==d.line?d.ch:null);a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b];b.marker.attachLine(a);++l});k.collapsed&&a.iter(c.line,d.line+1,function(b){$a(a,
-b)&&P(b,0)});k.clearOnEnter&&T(k,"beforeCursorEnter",function(){return k.clear()});k.readOnly&&(qf=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory());k.collapsed&&(k.id=++wf,k.atomic=!0);if(m){r&&(m.curOp.updateMaxLine=!0);if(k.collapsed)ya(m,c.line,d.line+1);else if(k.className||k.title||k.startStyle||k.endStyle||k.css)for(e=c.line;e<=d.line;e++)kb(m,e,"text");k.atomic&&mf(m.doc);qa(m,"markerAdded",m,k)}return k}function Cg(a,b,c,d,e){d=t(d);d.shared=!1;var g=[Rb(a,b,c,d,e)],
-k=g[0],l=d.widgetNode;Ab(a,function(a){l&&(d.widgetNode=l.cloneNode(!0));g.push(Rb(a,R(a,b),R(a,c),d,e));for(var m=0;m<a.linked.length;++m)if(a.linked[m].isParent)return;k=w(g)});return new wc(g,k)}function xf(a){return a.findMarks(H(a.first,0),a.clipPos(H(a.lastLine())),function(a){return a.parent})}function Dg(a){for(var b=function(b){b=a[b];var c=[b.primary.doc];Ab(b.primary.doc,function(a){return c.push(a)});for(var d=0;d<b.markers.length;d++){var e=b.markers[d];-1==r(c,e.doc)&&(e.parent=null,
-b.markers.splice(d--,1))}},c=0;c<a.length;c++)b(c)}function Eg(a){var b=this;yf(b);if(!ia(b,a)&&!cb(b.display,a)){na(a);V&&(zf=+new Date);var c=vb(b,a,!0),d=a.dataTransfer.files;if(c&&!b.isReadOnly())if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,g=Array(e),k=0,l=function(a,d){if(!b.options.allowDropFileTypes||-1!=r(b.options.allowDropFileTypes,a.type)){var l=new FileReader;l.onload=oa(b,function(){var a=l.result;/[\x00-\x08\x0e-\x1f]{2}/.test(a)&&(a="");g[d]=a;++k==e&&(c=R(b.doc,
-c),a={from:c,to:c,text:b.doc.splitLines(g.join(b.doc.lineSeparator())),origin:"paste"},Pb(b.doc,a),jf(b.doc,db(c,lb(a))))});l.readAsText(a)}},m=0;m<e;++m)l(d[m],m);else if(b.state.draggingText&&-1<b.doc.sel.contains(c))b.state.draggingText(a),setTimeout(function(){return b.display.input.focus()},20);else try{if(l=a.dataTransfer.getData("Text")){b.state.draggingText&&!b.state.draggingText.copy&&(m=b.listSelections());hd(b.doc,db(c,c));if(m)for(d=0;d<m.length;++d)Qb(b.doc,"",m[d].anchor,m[d].head,"drag");
-b.replaceSelection(l,"around","paste");b.display.input.focus()}}catch(lh){}}}function yf(a){a.display.dragCursor&&(a.display.lineSpace.removeChild(a.display.dragCursor),a.display.dragCursor=null)}function Af(a){if(document.getElementsByClassName)for(var b=document.getElementsByClassName("CodeMirror"),c=0;c<b.length;c++){var d=b[c].CodeMirror;d&&a(d)}}function Fg(){var a;T(window,"resize",function(){null==a&&(a=setTimeout(function(){a=null;Af(Gg)},100))});T(window,"blur",function(){return Af(lc)})}
-function Gg(a){var b=a.display;if(b.lastWrapHeight!=b.wrapper.clientHeight||b.lastWrapWidth!=b.wrapper.clientWidth)b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize()}function Hg(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var c,d,e,g,k=0;k<b.length-1;k++){var l=b[k];if(/^(cmd|meta|m)$/i.test(l))g=!0;else if(/^a(lt)?$/i.test(l))c=!0;else if(/^(c|ctrl|control)$/i.test(l))d=!0;else if(/^s(hift)?$/i.test(l))e=!0;else throw Error("Unrecognized modifier name: "+
-l);}c&&(a="Alt-"+a);d&&(a="Ctrl-"+a);g&&(a="Cmd-"+a);e&&(a="Shift-"+a);return a}function Ig(a){var b={},c;for(c in a)if(a.hasOwnProperty(c)){var d=a[c];if(!/^(name|fallthrough|(de|at)tach)$/.test(c)){if("..."!=d)for(var e=y(c.split(" "),Hg),g=0;g<e.length;g++){if(g==e.length-1){var k=e.join(" ");var l=d}else k=e.slice(0,g+1).join(" "),l="...";var m=b[k];if(!m)b[k]=l;else if(m!=l)throw Error("Inconsistent bindings for "+k);}delete a[c]}}for(var r in b)a[r]=b[r];return a}function Sb(a,b,c,d){b=jd(b);
-var e=b.call?b.call(a,d):b[a];if(!1===e)return"nothing";if("..."===e)return"multi";if(null!=e&&c(e))return"handled";if(b.fallthrough){if("[object Array]"!=Object.prototype.toString.call(b.fallthrough))return Sb(a,b.fallthrough,c,d);for(e=0;e<b.fallthrough.length;e++){var g=Sb(a,b.fallthrough[e],c,d);if(g)return g}}}function Bf(a){a="string"==typeof a?a:nb[a.keyCode];return"Ctrl"==a||"Alt"==a||"Shift"==a||"Mod"==a}function Cf(a,b,c){var d=a;b.altKey&&"Alt"!=d&&(a="Alt-"+a);(Df?b.metaKey:b.ctrlKey)&&
-"Ctrl"!=d&&(a="Ctrl-"+a);(Df?b.ctrlKey:b.metaKey)&&"Cmd"!=d&&(a="Cmd-"+a);!c&&b.shiftKey&&"Shift"!=d&&(a="Shift-"+a);return a}function Ef(a,b){if(Ra&&34==a.keyCode&&a["char"])return!1;var c=nb[a.keyCode];return null==c||a.altGraphKey?!1:Cf(c,a,b)}function jd(a){return"string"==typeof a?xc[a]:a}function Tb(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var g=b(c[e]);d.length&&0>=Q(g.from,w(d).to);){var k=d.pop();if(0>Q(k.from,g.from)){g.from=k.from;break}}d.push(g)}Ea(a,function(){for(var b=
-d.length-1;0<=b;b--)Qb(a.doc,"",d[b].from,d[b].to,"+delete");Kb(a)})}function Xd(a,b,c){b=B(a.text,b+c,c);return 0>b||b>a.text.length?null:b}function Yd(a,b,c){a=Xd(a,b.ch,c);return null==a?null:new H(b.line,a,0>c?"after":"before")}function Zd(a,b,c,d,e){if(a&&(a=Ca(c,b.doc.direction))){a=0>e?w(a):a[0];var g=0>e==(1==a.level)?"after":"before";if(0<a.level||"rtl"==b.doc.direction){var k=sb(b,c);var l=0>e?c.text.length-1:0;var m=Pa(b,k,l).top;l=F(function(a){return Pa(b,k,a).top==m},0>e==(1==a.level)?
-a.from:a.to-1,l);"before"==g&&(l=Xd(c,l,1))}else l=0>e?a.to:a.from;return new H(d,l,g)}return new H(d,0>e?c.text.length:0,0>e?"before":"after")}function Jg(a,b,c,d){var e=Ca(b,a.doc.direction);if(!e)return Yd(b,c,d);c.ch>=b.text.length?(c.ch=b.text.length,c.sticky="before"):0>=c.ch&&(c.ch=0,c.sticky="after");var g=Ua(e,c.ch,c.sticky),k=e[g];if("ltr"==a.doc.direction&&0==k.level%2&&(0<d?k.to>c.ch:k.from<c.ch))return Yd(b,c,d);var l=function(a,c){return Xd(b,a instanceof H?a.ch:a,c)},m,r=function(c){if(!a.options.lineWrapping)return{begin:0,
-end:b.text.length};m=m||sb(a,b);return Ge(a,b,m,c)},t=r("before"==c.sticky?l(c,-1):c.ch);if("rtl"==a.doc.direction||1==k.level){var f=1==k.level==0>d,u=l(c,f?1:-1);if(null!=u&&(f?u<=k.to&&u<=t.end:u>=k.from&&u>=t.begin))return new H(c.line,u,f?"before":"after")}k=function(a,b,d){for(var g=function(a,b){return b?new H(c.line,l(a,1),"before"):new H(c.line,a,"after")};0<=a&&a<e.length;a+=b){var k=e[a],m=0<b==(1!=k.level),r=m?d.begin:l(d.end,-1);if(k.from<=r&&r<k.to)return g(r,m);r=m?k.from:l(k.to,-1);
-if(d.begin<=r&&r<d.end)return g(r,m)}};if(g=k(g+d,d,t))return g;t=0<d?t.end:l(t.begin,-1);return null==t||0<d&&t==b.text.length||!(g=k(0<d?0:e.length-1,d,r(t)))?null:g}function Ff(a,b){var c=J(a.doc,b),d=Ga(c);d!=c&&(b=N(d));return Zd(!0,a,d,b,1)}function Gf(a,b){var c=Ff(a,b.line),d=J(a.doc,c.line);a=Ca(d,a.doc.direction);return a&&0!=a[0].level?c:(d=Math.max(0,d.text.search(/\S/)),H(c.line,b.line==c.line&&b.ch<=d&&b.ch?0:d,c.sticky))}function kd(a,b,c){if("string"==typeof b&&(b=yc[b],!b))return!1;
-a.display.input.ensurePolled();var d=a.display.shift,e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=ld}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function Kg(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var e=Sb(b,a.state.keyMaps[d],c,a);if(e)return e}return a.options.extraKeys&&Sb(b,a.options.extraKeys,c,a)||Sb(b,a.options.keyMap,c,a)}function zc(a,b,c,d){var e=a.state.keySeq;if(e){if(Bf(b))return"handled";Lg.set(50,function(){a.state.keySeq==
-e&&(a.state.keySeq=null,a.display.input.reset())});b=e+" "+b}d=Kg(a,b,d);"multi"==d&&(a.state.keySeq=b);"handled"==d&&qa(a,"keyHandled",a,b,c);if("handled"==d||"multi"==d)na(c),Hd(a);return e&&!d&&/\'$/.test(b)?(na(c),!0):!!d}function Hf(a,b){var c=Ef(b,!0);return c?b.shiftKey&&!a.state.keySeq?zc(a,"Shift-"+c,b,function(b){return kd(a,b,!0)})||zc(a,c,b,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return kd(a,b)}):zc(a,c,b,function(b){return kd(a,b)}):!1}function Mg(a,b,c){return zc(a,
-"'"+c+"'",b,function(b){return kd(a,b,!0)})}function If(a){this.curOp.focus=e();if(!ia(this,a)){V&&11>ca&&27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var c=Hf(this,a);Ra&&($d=c?b:null,!c&&88==b&&!Ng&&(Ma?a.metaKey:a.ctrlKey)&&this.replaceSelection("",null,"cut"));18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||Og(this)}}function Og(a){function b(a){18!=a.keyCode&&a.altKey||(wb(c,"CodeMirror-crosshair"),ha(document,"keyup",b),ha(document,
-"mouseover",b))}var c=a.display.lineDiv;g(c,"CodeMirror-crosshair");T(document,"keyup",b);T(document,"mouseover",b)}function Jf(a){16==a.keyCode&&(this.doc.sel.shift=!1);ia(this,a)}function Kf(a){if(!(cb(this.display,a)||ia(this,a)||a.ctrlKey&&!a.altKey||Ma&&a.metaKey)){var b=a.keyCode,c=a.charCode;if(Ra&&b==$d)$d=null,na(a);else if(!Ra||a.which&&!(10>a.which)||!Hf(this,a))if(b=String.fromCharCode(null==c?b:c),"\b"!=b&&!Mg(this,a,b))this.display.input.onKeyPress(a)}}function Pg(a,b){var c=+new Date;
-if(Ac&&Ac.compare(c,a,b))return Bc=Ac=null,"triple";if(Bc&&Bc.compare(c,a,b))return Ac=new ae(c,a,b),Bc=null,"double";Bc=new ae(c,a,b);Ac=null;return"single"}function Lf(a){var b=this.display;if(!(ia(this,a)||b.activeTouch&&b.input.supportsTouch()))if(b.input.ensurePolled(),b.shift=a.shiftKey,cb(b,a))sa||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=!0},100));else if(!md(this,a,"gutterClick",!0)){var c=vb(this,a),d=ac(a),e=c?Pg(c,d):"single";window.focus();1==d&&this.state.selectingText&&
-this.state.selectingText(a);c&&Qg(this,d,c,e,a)||(1==d?c?Rg(this,c,e,a):(a.target||a.srcElement)==b.scroller&&na(a):2==d?(c&&gd(this.doc,c),setTimeout(function(){return b.input.focus()},20)):3==d&&(be?Mf(this,a):Le(this)))}}function Qg(a,b,c,d,e){var g="Click";"double"==d?g="Double"+g:"triple"==d&&(g="Triple"+g);return zc(a,Cf((1==b?"Left":2==b?"Middle":"Right")+g,e),e,function(b){"string"==typeof b&&(b=yc[b]);if(!b)return!1;var d=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),d=b(a,c)!=ld}finally{a.state.suppressEdits=
-!1}return d})}function Rg(a,b,c,d){V?setTimeout(k(Ke,a),0):a.curOp.focus=e();var g=a.getOption("configureMouse");g=g?g(a,c,d):{};null==g.unit&&(g.unit=(Sg?d.shiftKey&&d.metaKey:d.altKey)?"rectangle":"single"==c?"char":"double"==c?"word":"line");if(null==g.extend||a.doc.extend)g.extend=a.doc.extend||d.shiftKey;null==g.addNew&&(g.addNew=Ma?d.metaKey:d.ctrlKey);null==g.moveOnDrag&&(g.moveOnDrag=!(Ma?d.altKey:d.ctrlKey));var l=a.doc.sel,m;a.options.dragDrop&&Tg&&!a.isReadOnly()&&"single"==c&&-1<(m=l.contains(b))&&
-(0>Q((m=l.ranges[m]).from(),b)||0<b.xRel)&&(0<Q(m.to(),b)||0>b.xRel)?Ug(a,d,b,g):Vg(a,d,b,g)}function Ug(a,b,c,d){var e=a.display,g=!1,k=oa(a,function(b){sa&&(e.scroller.draggable=!1);a.state.draggingText=!1;ha(document,"mouseup",k);ha(document,"mousemove",l);ha(e.scroller,"dragstart",m);ha(e.scroller,"drop",k);g||(na(b),d.addNew||gd(a.doc,c,null,null,d.extend),sa||V&&9==ca?setTimeout(function(){document.body.focus();e.input.focus()},20):e.input.focus())}),l=function(a){g=g||10<=Math.abs(b.clientX-
-a.clientX)+Math.abs(b.clientY-a.clientY)},m=function(){return g=!0};sa&&(e.scroller.draggable=!0);a.state.draggingText=k;k.copy=!d.moveOnDrag;e.scroller.dragDrop&&e.scroller.dragDrop();T(document,"mouseup",k);T(document,"mousemove",l);T(e.scroller,"dragstart",m);T(e.scroller,"drop",k);Le(a);setTimeout(function(){return e.input.focus()},20)}function Nf(a,b,c){if("char"==c)return new W(b,b);if("word"==c)return a.findWordAt(b);if("line"==c)return new W(H(b.line,0),R(a.doc,H(b.line+1,0)));a=c(a,b);return new W(a.from,
-a.to)}function Vg(a,b,c,d){function g(b){if(0!=Q(w,b))if(w=b,"rectangle"==d.unit){var e=[],g=a.options.tabSize,k=m(J(t,c.line).text,c.ch,g),l=m(J(t,b.line).text,b.ch,g),r=Math.min(k,l);k=Math.max(k,l);l=Math.min(c.line,b.line);for(var h=Math.min(a.lastLine(),Math.max(c.line,b.line));l<=h;l++){var p=J(t,l).text,D=u(p,r,g);r==k?e.push(new W(H(l,D),H(l,D))):p.length>D&&e.push(new W(H(l,D),H(l,u(p,k,g))))}e.length||e.push(new W(c,c));ra(t,Sa(f.ranges.slice(0,v).concat(e),v),{origin:"*mouse",scroll:!1});
-a.scrollIntoView(b)}else e=n,r=Nf(a,b,d.unit),b=e.anchor,0<Q(r.anchor,b)?(g=r.head,b=fa(e.from(),r.anchor)):(g=r.anchor,b=ka(e.to(),r.head)),e=f.ranges.slice(0),e[v]=Wg(a,new W(R(t,b),g)),ra(t,Sa(e,v),ce)}function k(b){var c=++D,l=vb(a,b,!0,"rectangle"==d.unit);if(l)if(0!=Q(l,w)){a.curOp.focus=e();g(l);var m=Jd(r,t);(l.line>=m.to||l.line<m.from)&&setTimeout(oa(a,function(){D==c&&k(b)}),150)}else{var f=b.clientY<p.top?-20:b.clientY>p.bottom?20:0;f&&setTimeout(oa(a,function(){D==c&&(r.scroller.scrollTop+=
-f,k(b))}),50)}}function l(b){a.state.selectingText=!1;D=Infinity;na(b);r.input.focus();ha(document,"mousemove",x);ha(document,"mouseup",z);t.history.lastSelOrigin=null}var r=a.display,t=a.doc;na(b);var f=t.sel,h=f.ranges;if(d.addNew&&!d.extend){var v=t.sel.contains(c);var n=-1<v?h[v]:new W(c,c)}else n=t.sel.primary(),v=t.sel.primIndex;"rectangle"==d.unit?(d.addNew||(n=new W(c,c)),c=vb(a,b,!0,!0),v=-1):(b=Nf(a,c,d.unit),n=d.extend?Ud(n,b.anchor,b.head,d.extend):b);d.addNew?-1==v?(v=h.length,ra(t,Sa(h.concat([n]),
-v),{scroll:!1,origin:"*mouse"})):1<h.length&&h[v].empty()&&"char"==d.unit&&!d.extend?(ra(t,Sa(h.slice(0,v).concat(h.slice(v+1)),0),{scroll:!1,origin:"*mouse"}),f=t.sel):Vd(t,v,n,ce):(v=0,ra(t,new Ja([n],0),ce),f=t.sel);var w=c,p=r.wrapper.getBoundingClientRect(),D=0,x=oa(a,function(a){ac(a)?k(a):l(a)}),z=oa(a,l);a.state.selectingText=z;T(document,"mousemove",x);T(document,"mouseup",z)}function Wg(a,b){var c=b.anchor,d=b.head,e=J(a.doc,c.line);if(0==Q(c,d)&&c.sticky==d.sticky)return b;e=Ca(e);if(!e)return b;
-var g=Ua(e,c.ch,c.sticky),k=e[g];if(k.from!=c.ch&&k.to!=c.ch)return b;var l=g+(k.from==c.ch==(1!=k.level)?0:1);if(0==l||l==e.length)return b;d.line!=c.line?a=0<(d.line-c.line)*("ltr"==a.doc.direction?1:-1):(a=Ua(e,d.ch,d.sticky),g=a-g||(d.ch-c.ch)*(1==k.level?-1:1),a=a==l-1||a==l?0>g:0<g);e=e[l+(a?-1:0)];e=(l=a==(1==e.level))?e.from:e.to;l=l?"after":"before";return c.ch==e&&c.sticky==l?b:new W(new H(c.line,e,l),d)}function md(a,b,c,d){if(b.touches){var e=b.touches[0].clientX;var g=b.touches[0].clientY}else try{e=
-b.clientX,g=b.clientY}catch(he){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&na(b);d=a.display;var k=d.lineDiv.getBoundingClientRect();if(g>k.bottom||!Da(a,c))return ob(b);g-=k.top-d.viewOffset;for(k=0;k<a.options.gutters.length;++k){var l=d.gutters.childNodes[k];if(l&&l.getBoundingClientRect().right>=e)return e=S(a.doc,g),da(a,c,a,e,a.options.gutters[k],b),ob(b)}}function Mf(a,b){var c;(c=cb(a.display,b))||(c=Da(a,"gutterContextMenu")?md(a,b,"gutterContextMenu",
-!1):!1);if(!c&&!ia(a,b,"contextmenu"))a.display.input.onContextMenu(b)}function Of(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");jc(a)}function Cc(a){We(a);ya(a);Ne(a)}function Xg(a,b,c){!b!=!(c&&c!=Ub)&&(c=a.display.dragFunctions,b=b?T:ha,b(a.display.scroller,"dragstart",c.start),b(a.display.scroller,"dragenter",c.enter),b(a.display.scroller,"dragover",c.over),b(a.display.scroller,"dragleave",c.leave),b(a.display.scroller,
-"drop",c.drop))}function Yg(a){a.options.lineWrapping?(g(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(wb(a.display.wrapper,"CodeMirror-wrap"),ab(a));Gd(a);ya(a);jc(a);setTimeout(function(){return Lb(a)},100)}function ea(a,b){var c=this;if(!(this instanceof ea))return new ea(a,b);this.options=b=b?t(b):{};t(Pf,b,!1);Pd(b);var d=b.value;"string"==typeof d&&(d=new za(d,b.mode,null,b.lineSeparator,b.direction));this.doc=d;var e=new ea.inputStyles[b.inputStyle](this);
-a=this.display=new L(a,d,e);a.wrapper.CodeMirror=this;We(this);Of(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");Se(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Bb,keySeq:null,specialChars:null};b.autofocus&&!Yb&&a.input.focus();V&&11>ca&&setTimeout(function(){return c.display.input.reset(!0)},20);Zg(this);Qf||(Fg(),Qf=!0);yb(this);
-this.curOp.forceUpdate=!0;bf(this,d);b.autofocus&&!Yb||this.hasFocus()?setTimeout(k(Id,this),20):lc(this);for(var g in nd)if(nd.hasOwnProperty(g))nd[g](c,b[g],Ub);Oe(this);b.finishInit&&b.finishInit(this);for(d=0;d<de.length;++d)de[d](c);zb(this);sa&&b.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function Zg(a){function b(){e.activeTouch&&(g=setTimeout(function(){return e.activeTouch=null},1E3),k=e.activeTouch,k.end=+new Date)}
-function c(a,b){if(null==b.left)return!0;var c=b.left-a.left;a=b.top-a.top;return 400<c*c+a*a}var e=a.display;T(e.scroller,"mousedown",oa(a,Lf));V&&11>ca?T(e.scroller,"dblclick",oa(a,function(b){if(!ia(a,b)){var c=vb(a,b);!c||md(a,b,"gutterClick",!0)||cb(a.display,b)||(na(b),b=a.findWordAt(c),gd(a.doc,b.anchor,b.head))}})):T(e.scroller,"dblclick",function(b){return ia(a,b)||na(b)});be||T(e.scroller,"contextmenu",function(b){return Mf(a,b)});var g,k={end:0};T(e.scroller,"touchstart",function(b){var c;
-if(c=!ia(a,b))1!=b.touches.length?c=!1:(c=b.touches[0],c=1>=c.radiusX&&1>=c.radiusY),c=!c;c&&!md(a,b,"gutterClick",!0)&&(e.input.ensurePolled(),clearTimeout(g),c=+new Date,e.activeTouch={start:c,moved:!1,prev:300>=c-k.end?k:null},1==b.touches.length&&(e.activeTouch.left=b.touches[0].pageX,e.activeTouch.top=b.touches[0].pageY))});T(e.scroller,"touchmove",function(){e.activeTouch&&(e.activeTouch.moved=!0)});T(e.scroller,"touchend",function(d){var g=e.activeTouch;if(g&&!cb(e,d)&&null!=g.left&&!g.moved&&
-300>new Date-g.start){var k=a.coordsChar(e.activeTouch,"page");g=!g.prev||c(g,g.prev)?new W(k,k):!g.prev.prev||c(g,g.prev.prev)?a.findWordAt(k):new W(H(k.line,0),R(a.doc,H(k.line+1,0)));a.setSelection(g.anchor,g.head);a.focus();na(d)}b()});T(e.scroller,"touchcancel",b);T(e.scroller,"scroll",function(){e.scroller.clientHeight&&(nc(a,e.scroller.scrollTop),xb(a,e.scroller.scrollLeft,!0),da(a,"scroll",a))});T(e.scroller,"mousewheel",function(b){return Ye(a,b)});T(e.scroller,"DOMMouseScroll",function(b){return Ye(a,
-b)});T(e.wrapper,"scroll",function(){return e.wrapper.scrollTop=e.wrapper.scrollLeft=0});e.dragFunctions={enter:function(b){ia(a,b)||pb(b)},over:function(b){if(!ia(a,b)){var c=vb(a,b);if(c){var e=document.createDocumentFragment();Je(a,c,e);a.display.dragCursor||(a.display.dragCursor=d("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),a.display.lineSpace.insertBefore(a.display.dragCursor,a.display.cursorDiv));h(a.display.dragCursor,e)}pb(b)}},start:function(b){if(V&&(!a.state.draggingText||100>
-+new Date-zf))pb(b);else if(!ia(a,b)&&!cb(a.display,b)&&(b.dataTransfer.setData("Text",a.getSelection()),b.dataTransfer.effectAllowed="copyMove",b.dataTransfer.setDragImage&&!Rf)){var c=d("img",null,null,"position: fixed; left: 0; top: 0;");c.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";Ra&&(c.width=c.height=1,a.display.wrapper.appendChild(c),c._top=c.offsetTop);b.dataTransfer.setDragImage(c,0,0);Ra&&c.parentNode.removeChild(c)}},drop:oa(a,Eg),leave:function(b){ia(a,
-b)||yf(a)}};var l=e.input.getField();T(l,"keyup",function(b){return Jf.call(a,b)});T(l,"keydown",oa(a,If));T(l,"keypress",oa(a,Kf));T(l,"focus",function(b){return Id(a,b)});T(l,"blur",function(b){return lc(a,b)})}function Dc(a,b,c,d){var e=a.doc,g;null==c&&(c="add");"smart"==c&&(e.mode.indent?g=Va(a,b).state:c="prev");var k=a.options.tabSize,l=J(e,b),r=m(l.text,null,k);l.stateAfter&&(l.stateAfter=null);var t=l.text.match(/^\s*/)[0];if(!d&&!/\S/.test(l.text)){var f=0;c="not"}else if("smart"==c&&(f=
-e.mode.indent(g,l.text.slice(t.length),l.text),f==ld||150<f)){if(!d)return;c="prev"}"prev"==c?f=b>e.first?m(J(e,b-1).text,null,k):0:"add"==c?f=r+a.options.indentUnit:"subtract"==c?f=r-a.options.indentUnit:"number"==typeof c&&(f=r+c);f=Math.max(0,f);c="";d=0;if(a.options.indentWithTabs)for(a=Math.floor(f/k);a;--a)d+=k,c+="\t";d<f&&(c+=v(f-d));if(c!=t)return Qb(e,c,H(b,0),H(b,t.length),"+input"),l.stateAfter=null,!0;for(k=0;k<e.sel.ranges.length;k++)if(l=e.sel.ranges[k],l.head.line==b&&l.head.ch<t.length){b=
-H(b,t.length);Vd(e,k,new W(b,b));break}}function ee(a,b,c,d,e){var g=a.doc;a.display.shift=!1;d||(d=g.sel);var k=a.state.pasteIncoming||"paste"==e,l=fe(b),m=null;if(k&&1<d.ranges.length)if(Fa&&Fa.text.join("\n")==b){if(0==d.ranges.length%Fa.text.length){m=[];for(var r=0;r<Fa.text.length;r++)m.push(g.splitLines(Fa.text[r]))}}else l.length==d.ranges.length&&a.options.pasteLinesPerSelection&&(m=y(l,function(a){return[a]}));for(r=d.ranges.length-1;0<=r;r--){var t=d.ranges[r];var f=t.from(),u=t.to();t.empty()&&
-(c&&0<c?f=H(f.line,f.ch-c):a.state.overwrite&&!k?u=H(u.line,Math.min(J(g,u.line).text.length,u.ch+w(l).length)):Fa&&Fa.lineWise&&Fa.text.join("\n")==b&&(f=u=H(f.line,0)));t=a.curOp.updateInput;f={from:f,to:u,text:m?m[r%m.length]:l,origin:e||(k?"paste":a.state.cutIncoming?"cut":"+input")};Pb(a.doc,f);qa(a,"inputRead",a,f)}b&&!k&&Sf(a,b);Kb(a);a.curOp.updateInput=t;a.curOp.typing=!0;a.state.pasteIncoming=a.state.cutIncoming=!1}function Tf(a,b){var c=a.clipboardData&&a.clipboardData.getData("Text");
-if(c)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||Ea(b,function(){return ee(b,c,0,null,"paste")}),!0}function Sf(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;0<=d;d--){var e=c.ranges[d];if(!(100<e.head.ch||d&&c.ranges[d-1].head.line==e.head.line)){var g=a.getModeAt(e.head),k=!1;if(g.electricChars)for(var l=0;l<g.electricChars.length;l++){if(-1<b.indexOf(g.electricChars.charAt(l))){k=Dc(a,e.head.line,"smart");break}}else g.electricInput&&
-g.electricInput.test(J(a.doc,e.head.line).text.slice(0,e.head.ch))&&(k=Dc(a,e.head.line,"smart"));k&&qa(a,"electricInput",a,e.head.line)}}}function Uf(a){for(var b=[],c=[],d=0;d<a.doc.sel.ranges.length;d++){var e=a.doc.sel.ranges[d].head.line;e={anchor:H(e,0),head:H(e+1,0)};c.push(e);b.push(a.getRange(e.anchor,e.head))}return{text:b,ranges:c}}function Vf(a,b){a.setAttribute("autocorrect","off");a.setAttribute("autocapitalize","off");a.setAttribute("spellcheck",!!b)}function Wf(){var a=d("textarea",
-null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),b=d("div",[a],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");sa?a.style.width="1000px":a.setAttribute("wrap","off");Ec&&(a.style.border="1px solid black");Vf(a);return b}function ge(a,b,c,d,e){function g(d){var g=e?Jg(a.cm,m,b,c):Yd(m,b,c);if(null==g){if(d=!d)d=b.line+c,d<a.first||d>=a.first+a.size?d=!1:(b=new H(d,b.ch,b.sticky),d=m=J(a,d));if(d)b=Zd(e,a.cm,m,b.line,c);else return!1}else b=
-g;return!0}var k=b,l=c,m=J(a,b.line);if("char"==d)g();else if("column"==d)g(!0);else if("word"==d||"group"==d){var r=null;d="group"==d;for(var t=a.cm&&a.cm.getHelper(b,"wordChars"),f=!0;!(0>c)||g(!f);f=!1){var u=m.text.charAt(b.ch)||"\n";u=E(u,t)?"w":d&&"\n"==u?"n":!d||/\s/.test(u)?null:"p";!d||f||u||(u="s");if(r&&r!=u){0>c&&(c=1,g(),b.sticky="after");break}u&&(r=u);if(0<c&&!g(!f))break}}l=Wd(a,b,k,l,!0);aa(k,l)&&(l.hitSide=!0);return l}function Xf(a,b,c,d){var e=a.doc,g=b.left;if("page"==d){var k=
-Math.max(Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight)-.5*tb(a.display),3);k=(0<c?b.bottom:b.top)+c*k}else"line"==d&&(k=0<c?b.bottom+3:b.top-3);for(;;){b=Dd(a,g,k);if(!b.outside)break;if(0>c?0>=k:k>=e.height){b.hitSide=!0;break}k+=5*c}return b}function Yf(a,b){var c=xd(a,b.line);if(!c||c.hidden)return null;var d=J(a.doc,b.line);c=we(c,d,b.line);a=Ca(d,a.doc.direction);d="left";a&&(d=Ua(a,b.ch)%2?"right":"left");b=xe(c.map,b.ch,d);b.offset="right"==
-b.collapse?b.end:b.start;return b}function $g(a){for(;a;a=a.parentNode)if(/CodeMirror-gutter-wrapper/.test(a.className))return!0;return!1}function Vb(a,b){b&&(a.bad=!0);return a}function ah(a,b,c,d,e){function g(a){return function(b){return b.id==a}}function k(a){a&&(r&&(m+=t,r=!1),m+=a)}function l(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)k(c||b.textContent.replace(/\u200b/g,""));else{c=b.getAttribute("cm-marker");var f;if(c)b=a.findMarks(H(d,0),H(e+1,0),g(+c)),b.length&&(f=
-b[0].find(0))&&k(O(a.doc,f.from,f.to).join(t));else if("false"!=b.getAttribute("contenteditable")){(f=/^(pre|div|p)$/i.test(b.nodeName))&&r&&(m+=t,r=!1);for(c=0;c<b.childNodes.length;c++)l(b.childNodes[c]);f&&(r=!0)}}}else 3==b.nodeType&&k(b.nodeValue)}for(var m="",r=!1,t=a.doc.lineSeparator();;){l(b);if(b==c)break;b=b.nextSibling}return m}function od(a,b,c){if(b==a.display.lineDiv){var d=a.display.lineDiv.childNodes[c];if(!d)return Vb(a.clipPos(H(a.display.viewTo-1)),!0);b=null;c=0}else for(d=b;;d=
-d.parentNode){if(!d||d==a.display.lineDiv)return null;if(d.parentNode&&d.parentNode==a.display.lineDiv)break}for(var e=0;e<a.display.view.length;e++){var g=a.display.view[e];if(g.node==d)return bh(g,b,c)}}function bh(a,b,d){function e(b,c,d){for(var e=-1;e<(t?t.length:0);e++)for(var g=0>e?r.map:t[e],k=0;k<g.length;k+=3){var l=g[k+2];if(l==b||l==c){c=N(0>e?a.line:a.rest[e]);e=g[k]+d;if(0>d||l!=b)e=g[k+(d?1:0)];return H(c,e)}}}var g=a.text.firstChild,k=!1;if(!b||!c(g,b))return Vb(H(N(a.line),0),!0);
-if(b==g&&(k=!0,b=g.childNodes[d],d=0,!b))return d=a.rest?w(a.rest):a.line,Vb(H(N(d),d.text.length),k);var l=3==b.nodeType?b:null,m=b;l||1!=b.childNodes.length||3!=b.firstChild.nodeType||(l=b.firstChild,d&&(d=l.nodeValue.length));for(;m.parentNode!=g;)m=m.parentNode;var r=a.measure,t=r.maps;if(b=e(l,m,d))return Vb(b,k);g=m.nextSibling;for(l=l?l.nodeValue.length-d:0;g;g=g.nextSibling){if(b=e(g,g.firstChild,0))return Vb(H(b.line,b.ch-l),k);l+=g.textContent.length}for(m=m.previousSibling;m;m=m.previousSibling){if(b=
-e(m,m.firstChild,-1))return Vb(H(b.line,b.ch+d),k);d+=m.textContent.length}}var va=navigator.userAgent,Zf=navigator.platform,eb=/gecko\/\d/i.test(va),$f=/MSIE \d/.test(va),ag=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(va),Fc=/Edge\/(\d+)/.exec(va),V=$f||ag||Fc,ca=V&&($f?document.documentMode||6:+(Fc||ag)[1]),sa=!Fc&&/WebKit\//.test(va),ch=sa&&/Qt\/\d+\.\d+/.test(va),Vc=!Fc&&/Chrome\//.test(va),Ra=/Opera\//.test(va),Rf=/Apple Computer/.test(navigator.vendor),dh=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(va),
-tg=/PhantomJS/.test(va),Ec=!Fc&&/AppleWebKit/.test(va)&&/Mobile\/\w+/.test(va),Wc=/Android/.test(va),Yb=Ec||Wc||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(va),Ma=Ec||/Mac/.test(Zf),Sg=/\bCrOS\b/.test(va),eh=/win/i.test(Zf),Cb=Ra&&va.match(/Version\/(\d*\.\d*)/);Cb&&(Cb=Number(Cb[1]));Cb&&15<=Cb&&(Ra=!1,sa=!0);var Df=Ma&&(ch||Ra&&(null==Cb||12.11>Cb)),be=eb||V&&9<=ca,wb=function(b,c){var d=b.className;if(c=a(c).exec(d)){var e=d.slice(c.index+c[0].length);b.className=d.slice(0,c.index)+
-(e?c[1]+e:"")}};var ec=document.createRange?function(a,b,c,d){var e=document.createRange();e.setEnd(d||a,c);e.setStart(a,b);return e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(jh){return d}d.collapse(!0);d.moveEnd("character",c);d.moveStart("character",b);return d};var Gc=function(a){a.select()};Ec?Gc=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:V&&(Gc=function(a){try{a.select()}catch(la){}});var Bb=function(){this.id=null};
-Bb.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var ld={toString:function(){return"CodeMirror.Pass"}},Ya={scroll:!1},ce={origin:"*mouse"},Hc={origin:"+move"},Oc=[""],bg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,cg=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,
-qf=!1,fb=!1,Zb=null,dg=function(){function a(a){return 247>=a?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(a):1424<=a&&1524>=a?"R":1536<=a&&1785>=a?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(a-
-1536):1774<=a&&2220>=a?"r":8192<=a&&8203>=a?"w":8204==a?"b":"L"}function b(a,b,c){this.level=a;this.from=b;this.to=c}var c=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,d=/[stwN]/,e=/[LRr]/,g=/[Lb1n]/,k=/[1n]/;return function(l,m){var r="ltr"==m?"L":"R";if(0==l.length||"ltr"==m&&!c.test(l))return!1;for(var t=l.length,f=[],u=0;u<t;++u)f.push(a(l.charCodeAt(u)));u=0;for(var h=r;u<t;++u){var v=f[u];"m"==v?f[u]=h:h=v}u=0;for(h=r;u<t;++u)v=f[u],"1"==v&&"r"==h?f[u]="n":e.test(v)&&(h=v,"r"==v&&(f[u]="R"));
-u=1;for(h=f[0];u<t-1;++u)v=f[u],"+"==v&&"1"==h&&"1"==f[u+1]?f[u]="1":","!=v||h!=f[u+1]||"1"!=h&&"n"!=h||(f[u]=h),h=v;for(u=0;u<t;++u)if(h=f[u],","==h)f[u]="N";else if("%"==h){for(h=u+1;h<t&&"%"==f[h];++h);for(v=u&&"!"==f[u-1]||h<t&&"1"==f[h]?"1":"N";u<h;++u)f[u]=v;u=h-1}u=0;for(h=r;u<t;++u)v=f[u],"L"==h&&"1"==v?f[u]="L":e.test(v)&&(h=v);for(h=0;h<t;++h)if(d.test(f[h])){for(u=h+1;u<t&&d.test(f[u]);++u);v="L"==(h?f[h-1]:r);for(v=v==("L"==(u<t?f[u]:r))?v?"L":"R":r;h<u;++h)f[h]=v;h=u-1}r=[];var n;for(u=
-0;u<t;)if(g.test(f[u])){h=u;for(++u;u<t&&g.test(f[u]);++u);r.push(new b(0,h,u))}else{var p=u;h=r.length;for(++u;u<t&&"L"!=f[u];++u);for(v=p;v<u;)if(k.test(f[v])){p<v&&r.splice(h,0,new b(1,p,v));p=v;for(++v;v<u&&k.test(f[v]);++v);r.splice(h,0,new b(2,p,v));p=v}else++v;p<u&&r.splice(h,0,new b(1,p,u))}"ltr"==m&&(1==r[0].level&&(n=l.match(/^\s+/))&&(r[0].from=n[0].length,r.unshift(new b(0,0,n[0].length))),1==w(r).level&&(n=l.match(/\s+$/))&&(w(r).to-=n[0].length,r.push(new b(0,t-n[0].length,t))));return"rtl"==
-m?r.reverse():r}}(),Pc=[],T=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):(a=a._handlers||(a._handlers={}),a[b]=(a[b]||Pc).concat(c))},Tg=function(){if(V&&9>ca)return!1;var a=d("div");return"draggable"in a||"dragDrop"in a}(),rd,td,fe=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var g=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),k=g.indexOf("\r");-1!=k?(c.push(g.slice(0,k)),b+=
-k+1):(c.push(g),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},fh=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(la){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(ih){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},Ng=function(){var a=d("div");if("oncopy"in a)return!0;a.setAttribute("oncopy","return;");return"function"==typeof a.oncopy}(),zd=null,sd={},Gb={},Hb={},ja=function(a,b,c){this.pos=this.start=
-0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0;this.lineOracle=c};ja.prototype.eol=function(){return this.pos>=this.string.length};ja.prototype.sol=function(){return this.pos==this.lineStart};ja.prototype.peek=function(){return this.string.charAt(this.pos)||void 0};ja.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)};ja.prototype.eat=function(a){var b=this.string.charAt(this.pos);if("string"==typeof a?b==a:b&&
-(a.test?a.test(b):a(b)))return++this.pos,b};ja.prototype.eatWhile=function(a){for(var b=this.pos;this.eat(a););return this.pos>b};ja.prototype.eatSpace=function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a};ja.prototype.skipToEnd=function(){this.pos=this.string.length};ja.prototype.skipTo=function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0};ja.prototype.backUp=function(a){this.pos-=a};ja.prototype.column=function(){this.lastColumnPos<
-this.start&&(this.lastColumnValue=m(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start);return this.lastColumnValue-(this.lineStart?m(this.string,this.lineStart,this.tabSize):0)};ja.prototype.indentation=function(){return m(this.string,null,this.tabSize)-(this.lineStart?m(this.string,this.lineStart,this.tabSize):0)};ja.prototype.match=function(a,b,c){if("string"==typeof a){var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,
-a.length);if(d(e)==d(a))return!1!==b&&(this.pos+=a.length),!0}else{if((a=this.string.slice(this.pos).match(a))&&0<a.index)return null;a&&!1!==b&&(this.pos+=a[0].length);return a}};ja.prototype.current=function(){return this.string.slice(this.start,this.pos)};ja.prototype.hideFirstChars=function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}};ja.prototype.lookAhead=function(a){var b=this.lineOracle;return b&&b.lookAhead(a)};ja.prototype.baseToken=function(){var a=this.lineOracle;
-return a&&a.baseToken(this.pos)};var Tc=function(a,b){this.state=a;this.lookAhead=b},Wa=function(a,b,c,d){this.state=b;this.doc=a;this.line=c;this.maxLookAhead=d||0;this.baseTokens=null;this.baseTokenPos=1};Wa.prototype.lookAhead=function(a){var b=this.doc.getLine(this.line+a);null!=b&&a>this.maxLookAhead&&(this.maxLookAhead=a);return b};Wa.prototype.baseToken=function(a){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=a;)this.baseTokenPos+=2;var b=this.baseTokens[this.baseTokenPos+
-1];return{type:b&&b.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-a}};Wa.prototype.nextLine=function(){this.line++;0<this.maxLookAhead&&this.maxLookAhead--};Wa.fromSaved=function(a,b,c){return b instanceof Tc?new Wa(a,Oa(a.mode,b.state),c,b.lookAhead):new Wa(a,Oa(a.mode,b),c)};Wa.prototype.save=function(a){a=!1!==a?Oa(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new Tc(a,this.maxLookAhead):a};var ke=function(a,b,c){this.start=a.start;this.end=a.pos;this.string=
-a.current();this.type=b||null;this.state=c},Mb=function(a,b,c){this.text=a;Aa(this,b);this.height=c?c(this):1};Mb.prototype.lineNo=function(){return N(this)};La(Mb);var hg={},gg={},Jb=null,fc=null,ye={left:0,right:0,top:0,bottom:0},ub,Db=function(a,b,c){this.cm=c;var e=this.vert=d("div",[d("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),g=this.horiz=d("div",[d("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a(e);a(g);T(e,"scroll",function(){e.clientHeight&&b(e.scrollTop,
-"vertical")});T(g,"scroll",function(){g.clientWidth&&b(g.scrollLeft,"horizontal")});this.checkedZeroWidth=!1;V&&8>ca&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Db.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;c?(this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0",this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+(a.viewHeight-(b?d:0)))+"px"):(this.vert.style.display=
-"",this.vert.firstChild.style.height="0");b?(this.horiz.style.display="block",this.horiz.style.right=c?d+"px":"0",this.horiz.style.left=a.barLeft+"px",this.horiz.firstChild.style.width=Math.max(0,a.scrollWidth-a.clientWidth+(a.viewWidth-a.barLeft-(c?d:0)))+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0");!this.checkedZeroWidth&&0<a.clientHeight&&(0==d&&this.zeroWidthHack(),this.checkedZeroWidth=!0);return{right:c?d:0,bottom:b?d:0}};Db.prototype.setScrollLeft=function(a){this.horiz.scrollLeft!=
-a&&(this.horiz.scrollLeft=a);this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")};Db.prototype.setScrollTop=function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a);this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")};Db.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=Ma&&!dh?"12px":"18px";this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new Bb;this.disableVert=new Bb};Db.prototype.enableZeroWidthBar=
-function(a,b,c){function d(){var e=a.getBoundingClientRect();("vert"==c?document.elementFromPoint(e.right-1,(e.top+e.bottom)/2):document.elementFromPoint((e.right+e.left)/2,e.bottom-1))!=a?a.style.pointerEvents="none":b.set(1E3,d)}a.style.pointerEvents="auto";b.set(1E3,d)};Db.prototype.clear=function(){var a=this.horiz.parentNode;a.removeChild(this.horiz);a.removeChild(this.vert)};var Ic=function(){};Ic.prototype.update=function(){return{bottom:0,right:0}};Ic.prototype.setScrollLeft=function(){};
-Ic.prototype.setScrollTop=function(){};Ic.prototype.clear=function(){};var Te={"native":Db,"null":Ic},sg=0,bd=function(a,b,c){var d=a.display;this.viewport=b;this.visible=Jd(d,a.doc,b);this.editorIsHidden=!d.wrapper.offsetWidth;this.wrapperHeight=d.wrapper.clientHeight;this.wrapperWidth=d.wrapper.clientWidth;this.oldDisplayWidth=qb(a);this.force=c;this.dims=yd(a);this.events=[]};bd.prototype.signal=function(a,b){Da(a,b)&&this.events.push(arguments)};bd.prototype.finish=function(){for(var a=0;a<this.events.length;a++)da.apply(null,
-this.events[a])};var dd=0,Ia=null;V?Ia=-.53:eb?Ia=15:Vc?Ia=-.7:Rf&&(Ia=-1/3);var Ja=function(a,b){this.ranges=a;this.primIndex=b};Ja.prototype.primary=function(){return this.ranges[this.primIndex]};Ja.prototype.equals=function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(!aa(c.anchor,d.anchor)||!aa(c.head,d.head))return!1}return!0};Ja.prototype.deepCopy=function(){for(var a=
-[],b=0;b<this.ranges.length;b++)a[b]=new W(ba(this.ranges[b].anchor),ba(this.ranges[b].head));return new Ja(a,this.primIndex)};Ja.prototype.somethingSelected=function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1};Ja.prototype.contains=function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(0<=Q(b,d.from())&&0>=Q(a,d.to()))return c}return-1};var W=function(a,b){this.anchor=a;this.head=b};W.prototype.from=function(){return fa(this.anchor,
-this.head)};W.prototype.to=function(){return ka(this.anchor,this.head)};W.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};tc.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;c<d;++c){var e=this.lines[c];this.height-=e.height;var g=e;g.parent=null;Eb(g);qa(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c;this.lines=this.lines.slice(0,
-a).concat(b).concat(this.lines.slice(a));for(a=0;a<b.length;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return!0}};uc.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(a<e){var g=Math.min(b,e-a),k=d.height;d.removeInner(a,g);this.height-=k-d.height;e==g&&(this.children.splice(c--,1),d.parent=null);if(0==(b-=g))break;a=0}else a-=e}25>this.size-
-b&&(1<this.children.length||!(this.children[0]instanceof tc))&&(a=[],this.collapse(a),this.children=[new tc(a)],this.children[0].parent=this)},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length;this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],g=e.chunkSize();if(a<=g){e.insertInner(a,b,c);if(e.lines&&50<e.lines.length){for(b=a=e.lines.length%25+25;b<e.lines.length;)c=new tc(e.lines.slice(b,
-b+=25)),e.height-=c.height,this.children.splice(++d,0,c),c.parent=this;e.lines=e.lines.slice(0,a);this.maybeSpill()}break}a-=g}},maybeSpill:function(){if(!(10>=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5);b=new uc(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=r(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else c=new uc(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10<a.children.length);a.parent.maybeSpill()}},iterN:function(a,
-b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],g=e.chunkSize();if(a<g){g=Math.min(b,g-a);if(e.iterN(a,g,c))return!0;if(0==(b-=g))break;a=0}else a-=g}}};var vc=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.doc=a;this.node=b};vc.prototype.clear=function(){var a=this.doc.cm,b=this.line.widgets,c=this.line,d=N(c);if(null!=d&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(c.widgets=null);var g=hc(this);P(c,Math.max(0,c.height-g));
-a&&(Ea(a,function(){var b=-g;Ha(c)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&$c(a,b);kb(a,d,"widget")}),qa(a,"lineWidgetCleared",a,this,d))}};vc.prototype.changed=function(){var a=this,b=this.height,c=this.doc.cm,d=this.line;this.height=null;var e=hc(this)-b;e&&(P(d,d.height+e),c&&Ea(c,function(){c.curOp.forceUpdate=!0;Ha(d)<(c.curOp&&c.curOp.scrollTop||c.doc.scrollTop)&&$c(c,e);qa(c,"lineWidgetChanged",c,a,N(d))}))};La(vc);var wf=0,mb=function(a,b){this.lines=[];this.type=b;this.doc=a;this.id=
-++wf};mb.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;b&&yb(a);if(Da(this,"clear")){var c=this.find();c&&qa(this,"clear",c.from,c.to)}for(var d=c=null,e=0;e<this.lines.length;++e){var g=this.lines[e],k=Ba(g.markedSpans,this);a&&!this.collapsed?kb(a,N(g),"text"):a&&(null!=k.to&&(d=N(g)),null!=k.from&&(c=N(g)));for(var l=g,m=void 0,r=g.markedSpans,t=k,f=0;f<r.length;++f)r[f]!=t&&(m||(m=[])).push(r[f]);l.markedSpans=m;null==k.from&&this.collapsed&&!$a(this.doc,
-g)&&a&&P(g,tb(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(e=0;e<this.lines.length;++e)g=Ga(this.lines[e]),k=xa(g),k>a.display.maxLineLength&&(a.display.maxLine=g,a.display.maxLineLength=k,a.display.maxLineChanged=!0);null!=c&&a&&this.collapsed&&ya(a,c,d+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&mf(a.doc));a&&qa(a,"markerCleared",a,this,c,d);b&&zb(a);this.parent&&this.parent.clear()}};mb.prototype.find=function(a,b){null==
-a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;e<this.lines.length;++e){var g=this.lines[e],k=Ba(g.markedSpans,this);if(null!=k.from&&(c=H(b?g:N(g),k.from),-1==a))return c;if(null!=k.to&&(d=H(b?g:N(g),k.to),1==a))return d}return c&&{from:c,to:d}};mb.prototype.changed=function(){var a=this,b=this.find(-1,!0),c=this,d=this.doc.cm;b&&d&&Ea(d,function(){var e=b.line,g=N(b.line);if(g=xd(d,g))ze(g),d.curOp.selectionChanged=d.curOp.forceUpdate=!0;d.curOp.updateMaxLine=!0;$a(c.doc,e)||null==c.height||(g=
-c.height,c.height=null,(g=hc(c)-g)&&P(e,e.height+g));qa(d,"markerChanged",d,a)})};mb.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=r(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};mb.prototype.detachLine=function(a){this.lines.splice(r(this.lines,a),1);!this.lines.length&&this.doc.cm&&(a=this.doc.cm.curOp,(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this))};
-La(mb);var wc=function(a,b){this.markers=a;this.primary=b;for(b=0;b<a.length;++b)a[b].parent=this};wc.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();qa(this,"clear")}};wc.prototype.find=function(a,b){return this.primary.find(a,b)};La(wc);var gh=0,za=function(a,b,c,d,e){if(!(this instanceof za))return new za(a,b,c,d,e);null==c&&(c=0);uc.call(this,[new tc([new Mb("",null)])]);this.first=c;this.scrollTop=
-this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.modeFrontier=this.highlightFrontier=c;c=H(c,0);this.sel=db(c);this.history=new ed(null);this.id=++gh;this.modeOption=b;this.lineSep=d;this.direction="rtl"==e?"rtl":"ltr";this.extend=!1;"string"==typeof a&&(a=this.splitLines(a));Sd(this,{from:c,to:c,text:a});ra(this,db(c),Ya)};za.prototype=z(uc.prototype,{constructor:za,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,
-b){for(var c=0,d=0;d<b.length;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=M(this,this.first,this.first+this.size);return!1===a?b:b.join(a||this.lineSeparator())},setValue:pa(function(a){var b=H(this.first,0),c=this.first+this.size-1;Pb(this,{from:b,to:H(c,J(this,c).text.length),text:this.splitLines(a),origin:"setValue",full:!0},!0);this.cm&&mc(this.cm,0,0);ra(this,db(b),Ya)}),replaceRange:function(a,b,c,d){b=
-R(this,b);c=c?R(this,c):b;Qb(this,a,b,c,d)},getRange:function(a,b,c){a=O(this,R(this,a),R(this,b));return!1===c?a:a.join(c||this.lineSeparator())},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){if(U(this,a))return J(this,a)},getLineNumber:function(a){return N(a)},getLineHandleVisualStart:function(a){"number"==typeof a&&(a=J(this,a));return Ga(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+
-this.size-1},clipPos:function(a){return R(this,a)},getCursor:function(a){var b=this.sel.primary();return null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||"to"==a||!1===a?b.to():b.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:pa(function(a,b,c){a=R(this,"number"==typeof a?H(a,b||0):a);ra(this,db(a,null),c)}),setSelection:pa(function(a,b,c){var d=R(this,a);a=R(this,b||a);ra(this,db(d,a),c)}),extendSelection:pa(function(a,
-b,c){gd(this,R(this,a),b&&R(this,b),c)}),extendSelections:pa(function(a,b){hf(this,X(this,a),b)}),extendSelectionsBy:pa(function(a,b){a=y(this.sel.ranges,a);hf(this,X(this,a),b)}),setSelections:pa(function(a,b,c){if(a.length){for(var d=[],e=0;e<a.length;e++)d[e]=new W(R(this,a[e].anchor),R(this,a[e].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex));ra(this,Sa(d,b),c)}}),addSelection:pa(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new W(R(this,a),R(this,b||a)));ra(this,Sa(d,d.length-
-1),c)}),getSelection:function(a){for(var b=this.sel.ranges,c,d=0;d<b.length;d++){var e=O(this,b[d].from(),b[d].to());c=c?c.concat(e):e}return!1===a?c:c.join(a||this.lineSeparator())},getSelections:function(a){for(var b=[],c=this.sel.ranges,d=0;d<c.length;d++){var e=O(this,c[d].from(),c[d].to());!1!==a&&(e=e.join(a||this.lineSeparator()));b[d]=e}return b},replaceSelection:function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")},replaceSelections:pa(function(a,
-b,c){for(var d=[],e=this.sel,g=0;g<e.ranges.length;g++){var k=e.ranges[g];d[g]={from:k.from(),to:k.to(),text:this.splitLines(a[g]),origin:c}}if(a=b&&"end"!=b){a=[];e=c=H(this.first,0);for(g=0;g<d.length;g++){var l=d[g];k=$e(l.from,c,e);var m=$e(lb(l),c,e);c=l.to;e=m;"around"==b?(l=this.sel.ranges[g],l=0>Q(l.head,l.anchor),a[g]=new W(l?m:k,l?k:m)):a[g]=new W(k,k)}a=new Ja(a,this.sel.primIndex)}b=a;for(a=d.length-1;0<=a;a--)Pb(this,d[a]);b?jf(this,b):this.cm&&Kb(this.cm)}),undo:pa(function(){id(this,
-"undo")}),redo:pa(function(){id(this,"redo")}),undoSelection:pa(function(){id(this,"undo",!0)}),redoSelection:pa(function(){id(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new ed(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=
-this.changeGeneration(!0)},changeGeneration:function(a){a&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null);return this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:Nb(this.history.done),undone:Nb(this.history.undone)}},setHistory:function(a){var b=this.history=new ed(this.history.maxGeneration);b.done=Nb(a.done.slice(0),null,!0);b.undone=Nb(a.undone.slice(0),null,!0)},setGutterMarker:pa(function(a,
-b,c){return sc(this,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});d[b]=c;!c&&G(d)&&(a.gutterMarkers=null);return!0})}),clearGutter:pa(function(a){var b=this;this.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&sc(b,c,"gutter",function(){c.gutterMarkers[a]=null;G(c.gutterMarkers)&&(c.gutterMarkers=null);return!0})})}),lineInfo:function(a){if("number"==typeof a){if(!U(this,a))return null;var b=a;a=J(this,a);if(!a)return null}else if(b=N(a),null==b)return null;return{line:b,
-handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},addLineClass:pa(function(b,c,d){return sc(this,b,"gutter"==c?"gutter":"class",function(b){var e="text"==c?"textClass":"background"==c?"bgClass":"gutter"==c?"gutterClass":"wrapClass";if(b[e]){if(a(d).test(b[e]))return!1;b[e]+=" "+d}else b[e]=d;return!0})}),removeLineClass:pa(function(b,c,d){return sc(this,b,"gutter"==c?"gutter":"class",function(b){var e="text"==c?"textClass":
-"background"==c?"bgClass":"gutter"==c?"gutterClass":"wrapClass",g=b[e];if(g)if(null==d)b[e]=null;else{var k=g.match(a(d));if(!k)return!1;var l=k.index+k[0].length;b[e]=g.slice(0,k.index)+(k.index&&l!=g.length?" ":"")+g.slice(l)||null}else return!1;return!0})}),addLineWidget:pa(function(a,b,c){return Bg(this,a,b,c)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,c){return Rb(this,R(this,a),R(this,b),c,c&&c.type||"range")},setBookmark:function(a,b){b={replacedWith:b&&(null==b.nodeType?
-b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,shared:b&&b.shared,handleMouseEvents:b&&b.handleMouseEvents};a=R(this,a);return Rb(this,a,a,b,"bookmark")},findMarksAt:function(a){a=R(this,a);var b=[],c=J(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=R(this,a);b=R(this,b);var d=[],e=a.line;this.iter(a.line,b.line+1,function(g){if(g=g.markedSpans)for(var k=
-0;k<g.length;k++){var l=g[k];null!=l.to&&e==a.line&&a.ch>=l.to||null==l.from&&e!=a.line||null!=l.from&&e==b.line&&l.from>=b.ch||c&&!c(l.marker)||d.push(l.marker.parent||l.marker)}++e});return d},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;c<b.length;++c)null!=b[c].from&&a.push(b[c].marker)});return a},posFromIndex:function(a){var b,c=this.first,d=this.lineSeparator().length;this.iter(function(e){e=e.text.length+d;if(e>a)return b=a,!0;a-=e;++c});return R(this,
-H(c,b))},indexFromPos:function(a){a=R(this,a);var b=a.ch;if(a.line<this.first||0>a.ch)return 0;var c=this.lineSeparator().length;this.iter(this.first,a.line,function(a){b+=a.text.length+c});return b},copy:function(a){var b=new za(M(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=!1;a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory()));return b},linkedDoc:function(a){a||
-(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.to<c&&(c=a.to);b=new za(M(this,b,c),a.mode||this.modeOption,b,this.lineSep,this.direction);a.sharedHist&&(b.history=this.history);(this.linked||(this.linked=[])).push({doc:b,sharedHist:a.sharedHist});b.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}];a=xf(this);for(c=0;c<a.length;c++){var d=a[c],e=d.find(),g=b.clipPos(e.from);e=b.clipPos(e.to);Q(g,e)&&(g=Rb(b,g,e,d.primary,d.primary.type),d.markers.push(g),
-g.parent=d)}return b},unlinkDoc:function(a){a instanceof ea&&(a=a.doc);if(this.linked)for(var b=0;b<this.linked.length;++b)if(this.linked[b].doc==a){this.linked.splice(b,1);a.unlinkDoc(this);Dg(xf(this));break}if(a.history==this.history){var c=[a.id];Ab(a,function(a){return c.push(a.id)},!0);a.history=new ed(null);a.history.done=Nb(this.history.done,c);a.history.undone=Nb(this.history.undone,c)}},iterLinkedDocs:function(a){Ab(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm},
-splitLines:function(a){return this.lineSep?a.split(this.lineSep):fe(a)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:pa(function(a){"rtl"!=a&&(a="ltr");a!=this.direction&&(this.direction=a,this.iter(function(a){return a.order=null}),this.cm&&xg(this.cm))})});za.prototype.eachLine=za.prototype.iter;for(var zf=0,Qf=!1,nb={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",
-37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Jc=0;10>Jc;Jc++)nb[Jc+48]=nb[Jc+96]=String(Jc);for(var pd=65;90>=pd;pd++)nb[pd]=String.fromCharCode(pd);
-for(var Kc=1;12>=Kc;Kc++)nb[Kc+111]=nb[Kc+63235]="F"+Kc;var xc={basic:{Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},pcDefault:{"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo",
-"Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection",
-"Alt-U":"redoSelection",fallthrough:"basic"},emacsy:{"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},macDefault:{"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo",
-"Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft",
-"Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]}};xc["default"]=Ma?xc.macDefault:xc.pcDefault;var yc={selectAll:of,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Ya)},killLine:function(a){return Tb(a,function(b){if(b.empty()){var c=J(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:H(b.head.line+
-1,0)}:{from:b.head,to:H(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){return Tb(a,function(b){return{from:H(b.from().line,0),to:R(a.doc,H(b.to().line+1,0))}})},delLineLeft:function(a){return Tb(a,function(a){return{from:H(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){return Tb(a,function(b){var c=a.charCoords(b.head,"div").top+5;return{from:a.coordsChar({left:0,top:c},"div"),to:b.from()}})},delWrappedLineRight:function(a){return Tb(a,function(b){var c=
-a.charCoords(b.head,"div").top+5;c=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div");return{from:b.from(),to:c}})},undo:function(a){return a.undo()},redo:function(a){return a.redo()},undoSelection:function(a){return a.undoSelection()},redoSelection:function(a){return a.redoSelection()},goDocStart:function(a){return a.extendSelection(H(a.firstLine(),0))},goDocEnd:function(a){return a.extendSelection(H(a.lastLine()))},goLineStart:function(a){return a.extendSelectionsBy(function(b){return Ff(a,
-b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){return a.extendSelectionsBy(function(b){return Gf(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){return a.extendSelectionsBy(function(b){b=b.head.line;var c=J(a.doc,b);var d=c;for(var e;e=wa(d,!1);)d=e.find(1,!0).line;d!=c&&(b=N(d));return Zd(!0,a,c,b,-1)},{origin:"+move",bias:-1})},goLineRight:function(a){return a.extendSelectionsBy(function(b){b=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+
-100,top:b},"div")},Hc)},goLineLeft:function(a){return a.extendSelectionsBy(function(b){b=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:b},"div")},Hc)},goLineLeftSmart:function(a){return a.extendSelectionsBy(function(b){var c=a.cursorCoords(b.head,"div").top+5;c=a.coordsChar({left:0,top:c},"div");return c.ch<a.getLine(c.line).search(/\S/)?Gf(a,b.head):c},Hc)},goLineUp:function(a){return a.moveV(-1,"line")},goLineDown:function(a){return a.moveV(1,"line")},goPageUp:function(a){return a.moveV(-1,
-"page")},goPageDown:function(a){return a.moveV(1,"page")},goCharLeft:function(a){return a.moveH(-1,"char")},goCharRight:function(a){return a.moveH(1,"char")},goColumnLeft:function(a){return a.moveH(-1,"column")},goColumnRight:function(a){return a.moveH(1,"column")},goWordLeft:function(a){return a.moveH(-1,"word")},goGroupRight:function(a){return a.moveH(1,"group")},goGroupLeft:function(a){return a.moveH(-1,"group")},goWordRight:function(a){return a.moveH(1,"word")},delCharBefore:function(a){return a.deleteH(-1,
-"char")},delCharAfter:function(a){return a.deleteH(1,"char")},delWordBefore:function(a){return a.deleteH(-1,"word")},delWordAfter:function(a){return a.deleteH(1,"word")},delGroupBefore:function(a){return a.deleteH(-1,"group")},delGroupAfter:function(a){return a.deleteH(1,"group")},indentAuto:function(a){return a.indentSelection("smart")},indentMore:function(a){return a.indentSelection("add")},indentLess:function(a){return a.indentSelection("subtract")},insertTab:function(a){return a.replaceSelection("\t")},
-insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;e<c.length;e++){var g=c[e].from();g=m(a.getLine(g.line),g.ch,d);b.push(v(d-g%d))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){return Ea(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++)if(b[d].empty()){var e=b[d].head,g=J(a.doc,e.line).text;if(g)if(e.ch==g.length&&(e=new H(e.line,e.ch-1)),0<e.ch)e=
-new H(e.line,e.ch+1),a.replaceRange(g.charAt(e.ch-1)+g.charAt(e.ch-2),H(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var k=J(a.doc,e.line-1).text;k&&(e=new H(e.line,1),a.replaceRange(g.charAt(0)+a.doc.lineSeparator()+k.charAt(k.length-1),H(e.line-1,k.length-1),e,"+transpose"))}c.push(new W(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){return Ea(a,function(){for(var b=a.listSelections(),c=b.length-1;0<=c;c--)a.replaceRange(a.doc.lineSeparator(),b[c].anchor,b[c].head,"+input");
-b=a.listSelections();for(c=0;c<b.length;c++)a.indentLine(b[c].from().line,null,!0);Kb(a)})},openLine:function(a){return a.replaceSelection("\n","start")},toggleOverwrite:function(a){return a.toggleOverwrite()}},Lg=new Bb,$d=null,ae=function(a,b,c){this.time=a;this.pos=b;this.button=c};ae.prototype.compare=function(a,b,c){return this.time+400>a&&0==Q(b,this.pos)&&c==this.button};var Bc,Ac,Ub={toString:function(){return"CodeMirror.Init"}},Pf={},nd={};ea.defaults=Pf;ea.optionHandlers=nd;var de=[];ea.defineInitHook=
-function(a){return de.push(a)};var Fa=null,Y=function(a){this.cm=a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new Bb;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};Y.prototype.init=function(a){function b(a){if(!ia(e,a)){if(e.somethingSelected())Fa={lineWise:!1,text:e.getSelections()},"cut"==a.type&&e.replaceSelection("",null,"cut");else if(e.options.lineWiseCopyCut){var b=Uf(e);Fa={lineWise:!0,text:b.text};"cut"==a.type&&
-e.operation(function(){e.setSelections(b.ranges,0,Ya);e.replaceSelection("",null,"cut")})}else return;if(a.clipboardData){a.clipboardData.clearData();var c=Fa.text.join("\n");a.clipboardData.setData("Text",c);if(a.clipboardData.getData("Text")==c){a.preventDefault();return}}var k=Wf();a=k.firstChild;e.display.lineSpace.insertBefore(k,e.display.lineSpace.firstChild);a.value=Fa.text.join("\n");var l=document.activeElement;Gc(a);setTimeout(function(){e.display.lineSpace.removeChild(k);l.focus();l==g&&
-d.showPrimarySelection()},50)}}var c=this,d=this,e=d.cm,g=d.div=a.lineDiv;Vf(g,e.options.spellcheck);T(g,"paste",function(a){ia(e,a)||Tf(a,e)||11>=ca&&setTimeout(oa(e,function(){return c.updateFromDOM()}),20)});T(g,"compositionstart",function(a){c.composing={data:a.data,done:!1}});T(g,"compositionupdate",function(a){c.composing||(c.composing={data:a.data,done:!1})});T(g,"compositionend",function(a){c.composing&&(a.data!=c.composing.data&&c.readFromDOMSoon(),c.composing.done=!0)});T(g,"touchstart",
-function(){return d.forceCompositionEnd()});T(g,"input",function(){c.composing||c.readFromDOMSoon()});T(g,"copy",b);T(g,"cut",b)};Y.prototype.prepareSelection=function(){var a=Ie(this.cm,!1);a.focus=this.cm.state.focused;return a};Y.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};Y.prototype.showPrimarySelection=function(){var a=window.getSelection(),b=this.cm,c=b.doc.sel.primary(),d=c.from();c=c.to();
-if(b.display.viewTo==b.display.viewFrom||d.line>=b.display.viewTo||c.line<b.display.viewFrom)a.removeAllRanges();else{var e=od(b,a.anchorNode,a.anchorOffset),g=od(b,a.focusNode,a.focusOffset);if(!e||e.bad||!g||g.bad||0!=Q(fa(e,g),d)||0!=Q(ka(e,g),c))if(e=b.display.view,d=d.line>=b.display.viewFrom&&Yf(b,d)||{node:e[0].measure.map[2],offset:0},c=c.line<b.display.viewTo&&Yf(b,c),c||(c=e[e.length-1].measure,c=c.maps?c.maps[c.maps.length-1]:c.map,c={node:c[c.length-1],offset:c[c.length-2]-c[c.length-
-3]}),d&&c){e=a.rangeCount&&a.getRangeAt(0);try{var k=ec(d.node,d.offset,c.offset,c.node)}catch(kh){}k&&(!eb&&b.state.focused?(a.collapse(d.node,d.offset),k.collapsed||(a.removeAllRanges(),a.addRange(k))):(a.removeAllRanges(),a.addRange(k)),e&&null==a.anchorNode?a.addRange(e):eb&&this.startGracePeriod());this.rememberSelection()}else a.removeAllRanges()}};Y.prototype.startGracePeriod=function(){var a=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout(function(){a.gracePeriod=!1;a.selectionChanged()&&
-a.cm.operation(function(){return a.cm.curOp.selectionChanged=!0})},20)};Y.prototype.showMultipleSelections=function(a){h(this.cm.display.cursorDiv,a.cursors);h(this.cm.display.selectionDiv,a.selection)};Y.prototype.rememberSelection=function(){var a=window.getSelection();this.lastAnchorNode=a.anchorNode;this.lastAnchorOffset=a.anchorOffset;this.lastFocusNode=a.focusNode;this.lastFocusOffset=a.focusOffset};Y.prototype.selectionInEditor=function(){var a=window.getSelection();if(!a.rangeCount)return!1;
-a=a.getRangeAt(0).commonAncestorContainer;return c(this.div,a)};Y.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())};Y.prototype.blur=function(){this.div.blur()};Y.prototype.getField=function(){return this.div};Y.prototype.supportsTouch=function(){return!0};Y.prototype.receivedFocus=function(){function a(){b.cm.state.focused&&(b.pollSelection(),b.polling.set(b.cm.options.pollInterval,a))}var b=
-this;this.selectionInEditor()?this.pollSelection():Ea(this.cm,function(){return b.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,a)};Y.prototype.selectionChanged=function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset};Y.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var a=window.getSelection(),
-b=this.cm;if(Wc&&Vc&&this.cm.options.gutters.length&&$g(a.anchorNode))this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();else if(!this.composing){this.rememberSelection();var c=od(b,a.anchorNode,a.anchorOffset),d=od(b,a.focusNode,a.focusOffset);c&&d&&Ea(b,function(){ra(b.doc,db(c,d),Ya);if(c.bad||d.bad)b.curOp.selectionChanged=!0})}}};Y.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=
-null);var a=this.cm,b=a.display,c=a.doc.sel.primary(),d=c.from(),e=c.to();0==d.ch&&d.line>a.firstLine()&&(d=H(d.line-1,J(a.doc,d.line-1).length));e.ch==J(a.doc,e.line).text.length&&e.line<a.lastLine()&&(e=H(e.line+1,0));if(d.line<b.viewFrom||e.line>b.viewTo-1)return!1;var g;d.line==b.viewFrom||0==(g=rb(a,d.line))?(c=N(b.view[0].line),g=b.view[0].node):(c=N(b.view[g].line),g=b.view[g-1].node.nextSibling);var k=rb(a,e.line);k==b.view.length-1?(e=b.viewTo-1,b=b.lineDiv.lastChild):(e=N(b.view[k+1].line)-
-1,b=b.view[k+1].node.previousSibling);if(!g)return!1;b=a.doc.splitLines(ah(a,g,b,c,e));for(g=O(a.doc,H(c,0),H(e,J(a.doc,e).text.length));1<b.length&&1<g.length;)if(w(b)==w(g))b.pop(),g.pop(),e--;else if(b[0]==g[0])b.shift(),g.shift(),c++;else break;var l=0;k=0;for(var m=b[0],r=g[0],t=Math.min(m.length,r.length);l<t&&m.charCodeAt(l)==r.charCodeAt(l);)++l;m=w(b);r=w(g);for(t=Math.min(m.length-(1==b.length?l:0),r.length-(1==g.length?l:0));k<t&&m.charCodeAt(m.length-k-1)==r.charCodeAt(r.length-k-1);)++k;
-if(1==b.length&&1==g.length&&c==d.line)for(;l&&l>d.ch&&m.charCodeAt(m.length-k-1)==r.charCodeAt(r.length-k-1);)l--,k++;b[b.length-1]=m.slice(0,m.length-k).replace(/^\u200b+/,"");b[0]=b[0].slice(l).replace(/\u200b+$/,"");d=H(c,l);c=H(e,g.length?w(g).length-k:0);if(1<b.length||b[0]||Q(d,c))return Qb(a.doc,b,d,c,"+input"),!0};Y.prototype.ensurePolled=function(){this.forceCompositionEnd()};Y.prototype.reset=function(){this.forceCompositionEnd()};Y.prototype.forceCompositionEnd=function(){this.composing&&
-(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())};Y.prototype.readFromDOMSoon=function(){var a=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){a.readDOMTimeout=null;if(a.composing)if(a.composing.done)a.composing=null;else return;a.updateFromDOM()},80))};Y.prototype.updateFromDOM=function(){var a=this;!this.cm.isReadOnly()&&this.pollContent()||Ea(this.cm,function(){return ya(a.cm)})};Y.prototype.setUneditable=function(a){a.contentEditable=
-"false"};Y.prototype.onKeyPress=function(a){0!=a.charCode&&(a.preventDefault(),this.cm.isReadOnly()||oa(this.cm,ee)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0))};Y.prototype.readOnlyChanged=function(a){this.div.contentEditable=String("nocursor"!=a)};Y.prototype.onContextMenu=function(){};Y.prototype.resetPosition=function(){};Y.prototype.needsContentAttribute=!0;var ma=function(a){this.cm=a;this.prevInput="";this.pollingFast=!1;this.polling=new Bb;this.hasSelection=!1;this.composing=
-null};ma.prototype.init=function(a){function b(a){if(!ia(e,a)){if(e.somethingSelected())Fa={lineWise:!1,text:e.getSelections()};else if(e.options.lineWiseCopyCut){var b=Uf(e);Fa={lineWise:!0,text:b.text};"cut"==a.type?e.setSelections(b.ranges,null,Ya):(d.prevInput="",k.value=b.text.join("\n"),Gc(k))}else return;"cut"==a.type&&(e.state.cutIncoming=!0)}}var c=this,d=this,e=this.cm,g=this.wrapper=Wf(),k=this.textarea=g.firstChild;a.wrapper.insertBefore(g,a.wrapper.firstChild);Ec&&(k.style.width="0px");
-T(k,"input",function(){V&&9<=ca&&c.hasSelection&&(c.hasSelection=null);d.poll()});T(k,"paste",function(a){ia(e,a)||Tf(a,e)||(e.state.pasteIncoming=!0,d.fastPoll())});T(k,"cut",b);T(k,"copy",b);T(a.scroller,"paste",function(b){cb(a,b)||ia(e,b)||(e.state.pasteIncoming=!0,d.focus())});T(a.lineSpace,"selectstart",function(b){cb(a,b)||na(b)});T(k,"compositionstart",function(){var a=e.getCursor("from");d.composing&&d.composing.range.clear();d.composing={start:a,range:e.markText(a,e.getCursor("to"),{className:"CodeMirror-composing"})}});
-T(k,"compositionend",function(){d.composing&&(d.poll(),d.composing.range.clear(),d.composing=null)})};ma.prototype.prepareSelection=function(){var a=this.cm,b=a.display,c=a.doc,d=Ie(a);if(a.options.moveInputWithCursor){a=Qa(a,c.sel.primary().head,"div");c=b.wrapper.getBoundingClientRect();var e=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+e.top-c.top));d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,a.left+e.left-c.left))}return d};ma.prototype.showSelection=
-function(a){var b=this.cm.display;h(b.cursorDiv,a.cursors);h(b.selectionDiv,a.selection);null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")};ma.prototype.reset=function(a){if(!this.contextMenuPending&&!this.composing){var b=this.cm;b.somethingSelected()?(this.prevInput="",a=b.getSelection(),this.textarea.value=a,b.state.focused&&Gc(this.textarea),V&&9<=ca&&(this.hasSelection=a)):a||(this.prevInput=this.textarea.value="",V&&9<=ca&&(this.hasSelection=null))}};
-ma.prototype.getField=function(){return this.textarea};ma.prototype.supportsTouch=function(){return!1};ma.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Yb||e()!=this.textarea))try{this.textarea.focus()}catch(I){}};ma.prototype.blur=function(){this.textarea.blur()};ma.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};ma.prototype.receivedFocus=function(){this.slowPoll()};ma.prototype.slowPoll=function(){var a=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,
-function(){a.poll();a.cm.state.focused&&a.slowPoll()})};ma.prototype.fastPoll=function(){function a(){c.poll()||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0;c.polling.set(20,a)};ma.prototype.poll=function(){var a=this,b=this.cm,c=this.textarea,d=this.prevInput;if(this.contextMenuPending||!b.state.focused||fh(c)&&!d&&!this.composing||b.isReadOnly()||b.options.disableInput||b.state.keySeq)return!1;var e=c.value;if(e==d&&!b.somethingSelected())return!1;
-if(V&&9<=ca&&this.hasSelection===e||Ma&&/[\uf700-\uf7ff]/.test(e))return b.display.input.reset(),!1;if(b.doc.sel==b.display.selForContextMenu){var g=e.charCodeAt(0);8203!=g||d||(d="\u200b");if(8666==g)return this.reset(),this.cm.execCommand("undo")}var k=0;for(g=Math.min(d.length,e.length);k<g&&d.charCodeAt(k)==e.charCodeAt(k);)++k;Ea(b,function(){ee(b,e.slice(k),d.length-k,null,a.composing?"*compose":null);1E3<e.length||-1<e.indexOf("\n")?c.value=a.prevInput="":a.prevInput=e;a.composing&&(a.composing.range.clear(),
-a.composing.range=b.markText(a.composing.start,b.getCursor("to"),{className:"CodeMirror-composing"}))});return!0};ma.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)};ma.prototype.onKeyPress=function(){V&&9<=ca&&(this.hasSelection=null);this.fastPoll()};ma.prototype.onContextMenu=function(a){function b(){if(null!=k.selectionStart){var a=e.somethingSelected(),b="\u200b"+(a?k.value:"");k.value="\u21da";k.value=b;d.prevInput=a?"":"\u200b";k.selectionStart=1;k.selectionEnd=
-b.length;g.selForContextMenu=e.doc.sel}}function c(){d.contextMenuPending=!1;d.wrapper.style.cssText=t;k.style.cssText=r;V&&9>ca&&g.scrollbars.setScrollTop(g.scroller.scrollTop=m);if(null!=k.selectionStart){(!V||V&&9>ca)&&b();var a=0,c=function(){g.selForContextMenu==e.doc.sel&&0==k.selectionStart&&0<k.selectionEnd&&"\u200b"==d.prevInput?oa(e,of)(e):10>a++?g.detectingSelectAll=setTimeout(c,500):(g.selForContextMenu=null,g.input.reset())};g.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,g=
-e.display,k=d.textarea,l=vb(e,a),m=g.scroller.scrollTop;if(l&&!Ra){e.options.resetSelectionOnContextMenu&&-1==e.doc.sel.contains(l)&&oa(e,ra)(e.doc,db(l),Ya);var r=k.style.cssText,t=d.wrapper.style.cssText;d.wrapper.style.cssText="position: absolute";l=d.wrapper.getBoundingClientRect();k.style.cssText="position: absolute; width: 30px; height: 30px;\n      top: "+(a.clientY-l.top-5)+"px; left: "+(a.clientX-l.left-5)+"px;\n      z-index: 1000; background: "+(V?"rgba(255, 255, 255, .05)":"transparent")+
-";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(sa)var f=window.scrollY;g.input.focus();sa&&window.scrollTo(null,f);g.input.reset();e.somethingSelected()||(k.value=d.prevInput=" ");d.contextMenuPending=!0;g.selForContextMenu=e.doc.sel;clearTimeout(g.detectingSelectAll);V&&9<=ca&&b();if(be){pb(a);var u=function(){ha(window,"mouseup",u);setTimeout(c,20)};T(window,"mouseup",u)}else setTimeout(c,50)}};ma.prototype.readOnlyChanged=
-function(a){a||this.reset();this.textarea.disabled="nocursor"==a};ma.prototype.setUneditable=function(){};ma.prototype.needsContentAttribute=!1;(function(a){function b(b,d,e,g){a.defaults[b]=d;e&&(c[b]=g?function(a,b,c){c!=Ub&&e(a,b,c)}:e)}var c=a.optionHandlers;a.defineOption=b;a.Init=Ub;b("value","",function(a,b){return a.setValue(b)},!0);b("mode",null,function(a,b){a.doc.modeOption=b;Rd(a)},!0);b("indentUnit",2,Rd,!0);b("indentWithTabs",!1);b("smartIndent",!0);b("tabSize",4,function(a){qc(a);jc(a);
-ya(a)},!0);b("lineSeparator",null,function(a,b){if(a.doc.lineSep=b){var c=[],d=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var g=a.text.indexOf(b,e);if(-1==g)break;e=g+b.length;c.push(H(d,g))}d++});for(var e=c.length-1;0<=e;e--)Qb(a.doc,b,c[e],H(c[e].line,c[e].ch+b.length))}});b("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,c){a.state.specialChars=new RegExp(b.source+(b.test("\t")?"":"|\t"),"g");c!=Ub&&a.refresh()});b("specialCharPlaceholder",
-kg,function(a){return a.refresh()},!0);b("electricChars",!0);b("inputStyle",Yb?"contenteditable":"textarea",function(){throw Error("inputStyle can not (yet) be changed in a running editor");},!0);b("spellcheck",!1,function(a,b){return a.getInputField().spellcheck=b},!0);b("rtlMoveVisually",!eh);b("wholeLineUpdateBefore",!0);b("theme","default",function(a){Of(a);Cc(a)},!0);b("keyMap","default",function(a,b,c){b=jd(b);(c=c!=Ub&&jd(c))&&c.detach&&c.detach(a,b);b.attach&&b.attach(a,c||null)});b("extraKeys",
-null);b("configureMouse",null);b("lineWrapping",!1,Yg,!0);b("gutters",[],function(a){Pd(a.options);Cc(a)},!0);b("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?Fd(a.display)+"px":"0";a.refresh()},!0);b("coverGutterNextToScrollbar",!1,function(a){return Lb(a)},!0);b("scrollbarStyle","native",function(a){Se(a);Lb(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop);a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0);b("lineNumbers",!1,function(a){Pd(a.options);Cc(a)},!0);b("firstLineNumber",
-1,Cc,!0);b("lineNumberFormatter",function(a){return a},Cc,!0);b("showCursorWhenSelecting",!1,kc,!0);b("resetSelectionOnContextMenu",!0);b("lineWiseCopyCut",!0);b("pasteLinesPerSelection",!0);b("readOnly",!1,function(a,b){"nocursor"==b&&(lc(a),a.display.input.blur());a.display.input.readOnlyChanged(b)});b("disableInput",!1,function(a,b){b||a.display.input.reset()},!0);b("dragDrop",!0,Xg);b("allowDropFileTypes",null);b("cursorBlinkRate",530);b("cursorScrollMargin",0);b("cursorHeight",1,kc,!0);b("singleCursorHeightPerLine",
-!0,kc,!0);b("workTime",100);b("workDelay",100);b("flattenSpans",!0,qc,!0);b("addModeClass",!1,qc,!0);b("pollInterval",100);b("undoDepth",200,function(a,b){return a.doc.history.undoDepth=b});b("historyEventDelay",1250);b("viewportMargin",10,function(a){return a.refresh()},!0);b("maxHighlightLength",1E4,qc,!0);b("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()});b("tabindex",null,function(a,b){return a.display.input.getField().tabIndex=b||""});b("autofocus",null);b("direction",
-"ltr",function(a,b){return a.doc.setDirection(b)},!0)})(ea);(function(a){var b=a.optionHandlers,c=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus();this.display.input.focus()},setOption:function(a,c){var d=this.options,e=d[a];if(d[a]!=c||"mode"==a)d[a]=c,b.hasOwnProperty(a)&&oa(this,b[a])(this,c,e),da(this,"optionChange",this,a)},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](jd(a))},
-removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||b[c].name==a)return b.splice(c,1),!0},addOverlay:ua(function(b,c){var d=b.token?b:a.getMode(this.options,b);if(d.startState)throw Error("Overlays may not be stateful.");x(this.state.overlays,{mode:d,modeSpec:b,opaque:c&&c.opaque,priority:c&&c.priority||0},function(a){return a.priority});this.state.modeGen++;ya(this)}),removeOverlay:ua(function(a){for(var b=this.state.overlays,c=0;c<b.length;++c){var d=b[c].modeSpec;
-if(d==a||"string"==typeof a&&d.name==a){b.splice(c,1);this.state.modeGen++;ya(this);break}}}),indentLine:ua(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract");U(this.doc,a)&&Dc(this,a,b,c)}),indentSelection:ua(function(a){for(var b=this.doc.sel.ranges,c=-1,d=0;d<b.length;d++){var e=b[d];if(e.empty())e.head.line>c&&(Dc(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&Kb(this));else{var g=e.from();e=e.to();var k=
-Math.max(c,g.line);c=Math.min(this.lastLine(),e.line-(e.ch?0:1))+1;for(e=k;e<c;++e)Dc(this,e,a);e=this.doc.sel.ranges;0==g.ch&&b.length==e.length&&0<e[d].from().ch&&Vd(this.doc,d,new W(g,e[d].to()),Ya)}}}),getTokenAt:function(a,b){return je(this,a,b)},getLineTokens:function(a,b){return je(this,H(a),b,!0)},getTokenTypeAt:function(a){a=R(this.doc,a);var b=ib(this,J(this.doc,a.line)),c=0,d=(b.length-1)/2;a=a.ch;if(0==a)b=b[2];else for(;;){var e=c+d>>1;if((e?b[2*e-1]:0)>=a)d=e;else if(b[2*e+1]<a)c=e+
-1;else{b=b[2*e+2];break}}c=b?b.indexOf("overlay "):-1;return 0>c?b:0==c?null:b.slice(0,c-1)},getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var d=[];if(!c.hasOwnProperty(b))return d;var e=c[b];a=this.getModeAt(a);if("string"==typeof a[b])e[a[b]]&&d.push(e[a[b]]);else if(a[b])for(var g=0;g<a[b].length;g++){var k=e[a[b][g]];k&&d.push(k)}else a.helperType&&e[a.helperType]?
-d.push(e[a.helperType]):e[a.name]&&d.push(e[a.name]);for(b=0;b<e._global.length;b++)g=e._global[b],g.pred(a,this)&&-1==r(d,g.val)&&d.push(g.val);return d},getStateAfter:function(a,b){var c=this.doc;a=Math.max(c.first,Math.min(null==a?c.first+c.size-1:a,c.first+c.size-1));return Va(this,a+1,b).state},cursorCoords:function(a,b){var c=this.doc.sel.primary();a=null==a?c.head:"object"==typeof a?R(this.doc,a):a?c.from():c.to();return Qa(this,a,b||"page")},charCoords:function(a,b){return Bd(this,R(this.doc,
-a),b||"page")},coordsChar:function(a,b){a=De(this,a,b||"page");return Dd(this,a.left,a.top)},lineAtHeight:function(a,b){a=De(this,{top:a,left:0},b||"page").top;return S(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b,c){var d=!1;if("number"==typeof a){var e=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>e&&(a=e,d=!0);a=J(this.doc,a)}return Xc(this,a,{top:0,left:0},b||"page",c||d).top+(d?this.doc.height-Ha(a):0)},defaultTextHeight:function(){return tb(this.display)},
-defaultCharWidth:function(){return ic(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var g=this.display;a=Qa(this,R(this.doc,a));var k=a.bottom,l=a.left;b.style.position="absolute";b.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(b);g.sizer.appendChild(b);if("over"==d)k=a.top;else if("above"==d||"near"==d){var m=Math.max(g.wrapper.clientHeight,this.doc.height),r=Math.max(g.sizer.clientWidth,g.lineSpace.clientWidth);
-("above"==d||a.bottom+b.offsetHeight>m)&&a.top>b.offsetHeight?k=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=m&&(k=a.bottom);l+b.offsetWidth>r&&(l=r-b.offsetWidth)}b.style.top=k+"px";b.style.left=b.style.right="";"right"==e?(l=g.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?l=0:"middle"==e&&(l=(g.sizer.clientWidth-b.offsetWidth)/2),b.style.left=l+"px");c&&(a=Ld(this,{left:l,top:k,right:l+b.offsetWidth,bottom:k+b.offsetHeight}),null!=a.scrollTop&&nc(this,a.scrollTop),null!=a.scrollLeft&&
-xb(this,a.scrollLeft))},triggerOnKeyDown:ua(If),triggerOnKeyPress:ua(Kf),triggerOnKeyUp:Jf,triggerOnMouseDown:ua(Lf),execCommand:function(a){if(yc.hasOwnProperty(a))return yc[a].call(null,this)},triggerElectric:ua(function(a){Sf(this,a)}),findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);a=R(this.doc,a);for(var g=0;g<b&&(a=ge(this.doc,a,e,c,d),!a.hitSide);++g);return a},moveH:ua(function(a,b){var c=this;this.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?ge(c.doc,
-d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},Hc)}),deleteH:ua(function(a,b){var c=this.doc;this.doc.sel.somethingSelected()?c.replaceSelection("",null,"+delete"):Tb(this,function(d){var e=ge(c,d.head,a,b,!1);return 0>a?{from:e,to:d.head}:{from:d.head,to:e}})}),findPosV:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);var g=R(this.doc,a);for(a=0;a<b&&(g=Qa(this,g,"div"),null==d?d=g.left:g.left=d,g=Xf(this,g,e,c),!g.hitSide);++a);return g},moveV:ua(function(a,b){var c=this,d=this.doc,e=[],g=
-!this.display.shift&&!d.extend&&d.sel.somethingSelected();d.extendSelectionsBy(function(k){if(g)return 0>a?k.from():k.to();var l=Qa(c,k.head,"div");null!=k.goalColumn&&(l.left=k.goalColumn);e.push(l.left);var m=Xf(c,l,a,b);"page"==b&&k==d.sel.primary()&&$c(c,Bd(c,m,"div").top-l.top);return m},Hc);if(e.length)for(var k=0;k<d.sel.ranges.length;k++)d.sel.ranges[k].goalColumn=e[k]}),findWordAt:function(a){var b=J(this.doc,a.line).text,c=a.ch,d=a.ch;if(b){var e=this.getHelper(a,"wordChars");"before"!=
-a.sticky&&d!=b.length||!c?++d:--c;var g=b.charAt(c);for(g=E(g,e)?function(a){return E(a,e)}:/\s/.test(g)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!E(a)};0<c&&g(b.charAt(c-1));)--c;for(;d<b.length&&g(b.charAt(d));)++d}return new W(H(a.line,c),H(a.line,d))},toggleOverwrite:function(a){if(null==a||a!=this.state.overwrite)(this.state.overwrite=!this.state.overwrite)?g(this.display.cursorDiv,"CodeMirror-overwrite"):wb(this.display.cursorDiv,"CodeMirror-overwrite"),da(this,"overwriteToggle",
-this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==e()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ua(function(a,b){mc(this,a,b)}),getScrollInfo:function(){var a=this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-Xa(this)-this.display.barHeight,width:a.scrollWidth-Xa(this)-this.display.barWidth,clientHeight:wd(this),clientWidth:qb(this)}},scrollIntoView:ua(function(a,b){null==a?(a={from:this.doc.sel.primary().head,
-to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:H(a,0),to:null}:null==a.from&&(a={from:a,to:null});a.to||(a.to=a.from);a.margin=b||0;null!=a.from.line?(ad(this),this.curOp.scrollToPos=a):Pe(this,a.from,a.to,a.margin)}),setSize:ua(function(a,b){var c=this,d=function(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a};null!=a&&(this.display.wrapper.style.width=d(a));null!=b&&(this.display.wrapper.style.height=d(b));this.options.lineWrapping&&Ae(this);var e=
-this.display.viewFrom;this.doc.iter(e,this.display.viewTo,function(a){if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){kb(c,e,"widget");break}++e});this.curOp.forceUpdate=!0;da(this,"refresh",this)}),operation:function(a){return Ea(this,a)},startOperation:function(){return yb(this)},endOperation:function(){return zb(this)},refresh:ua(function(){var a=this.display.cachedTextHeight;ya(this);this.curOp.forceUpdate=!0;jc(this);mc(this,this.doc.scrollLeft,this.doc.scrollTop);
-Kd(this);(null==a||.5<Math.abs(a-tb(this.display)))&&Gd(this);da(this,"refresh",this)}),swapDoc:ua(function(a){var b=this.doc;b.cm=null;bf(this,a);jc(this);this.display.input.reset();mc(this,a.scrollLeft,a.scrollTop);this.curOp.forceScroll=!0;qa(this,"swapDoc",this,b);return b}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};
-La(a);a.registerHelper=function(b,d,e){c.hasOwnProperty(b)||(c[b]=a[b]={_global:[]});c[b][d]=e};a.registerGlobalHelper=function(b,d,e,g){a.registerHelper(b,d,g);c[b]._global.push({pred:e,val:g})}})(ea);var hh="iter insert remove copy getEditor constructor".split(" "),Lc;for(Lc in za.prototype)za.prototype.hasOwnProperty(Lc)&&0>r(hh,Lc)&&(ea.prototype[Lc]=function(a){return function(){return a.apply(this.doc,arguments)}}(za.prototype[Lc]));La(za);ea.inputStyles={textarea:ma,contenteditable:Y};ea.defineMode=
-function(a){ea.defaults.mode||"null"==a||(ea.defaults.mode=a);Rc.apply(this,arguments)};ea.defineMIME=function(a,b){Gb[a]=b};ea.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}});ea.defineMIME("text/plain","null");ea.defineExtension=function(a,b){ea.prototype[a]=b};ea.defineDocExtension=function(a,b){za.prototype[a]=b};ea.fromTextArea=function(a,b){function c(){a.value=m.getValue()}b=b?t(b):{};b.value=a.value;!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex);!b.placeholder&&
-a.placeholder&&(b.placeholder=a.placeholder);if(null==b.autofocus){var d=e();b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}if(a.form&&(T(a.form,"submit",c),!b.leaveSubmitMethodAlone)){var g=a.form;var k=g.submit;try{var l=g.submit=function(){c();g.submit=k;g.submit();g.submit=l}}catch(he){}}b.finishInit=function(b){b.save=c;b.getTextArea=function(){return a};b.toTextArea=function(){b.toTextArea=isNaN;c();a.parentNode.removeChild(b.getWrapperElement());a.style.display="";a.form&&
-(ha(a.form,"submit",c),"function"==typeof a.form.submit&&(a.form.submit=k))}};a.style.display="none";var m=ea(function(b){return a.parentNode.insertBefore(b,a.nextSibling)},b);return m};(function(a){a.off=ha;a.on=T;a.wheelEventPixels=wg;a.Doc=za;a.splitLines=fe;a.countColumn=m;a.findColumn=u;a.isWordChar=D;a.Pass=ld;a.signal=da;a.Line=Mb;a.changeEnd=lb;a.scrollbarModel=Te;a.Pos=H;a.cmpPos=Q;a.modes=sd;a.mimeModes=Gb;a.resolveMode=bb;a.getMode=Na;a.modeExtensions=Hb;a.extendMode=ta;a.copyState=Oa;
-a.startState=bc;a.innerMode=Ib;a.commands=yc;a.keyMap=xc;a.keyName=Ef;a.isModifierKey=Bf;a.lookupKey=Sb;a.normalizeKeyMap=Ig;a.StringStream=ja;a.SharedTextMarker=wc;a.TextMarker=mb;a.LineWidget=vc;a.e_preventDefault=na;a.e_stopPropagation=Qc;a.e_stop=pb;a.addClass=g;a.contains=c;a.rmClass=wb;a.keyNames=nb})(ea);ea.version="5.31.0";return ea})},function(h,f,a){var q=a(214);f.multicast=function(a,d){var b="function"===typeof a?a:function(){return a};if("function"===typeof d)return this.lift(new p(b,
-d));d=Object.create(this,q.connectableObservableDescriptor);d.source=this;d.subjectFactory=b;return d};var p=function(){function a(a,b){this.subjectFactory=a;this.selector=b}a.prototype.call=function(a,b){var c=this.selector,d=this.subjectFactory();a=c(d).subscribe(a);a.add(b.subscribe(d));return a};return a}();f.MulticastOperator=p},function(h,f,a){a.d(f,"b",function(){return q});var q;(function(a){a[a.UINT8=0]="UINT8";a[a.UINT16=1]="UINT16";a[a.UINT32=2]="UINT32";a[a.UINT64=3]="UINT64";a[a.FLOAT32=
-4]="FLOAT32"})(q||(q={}));h=[];f.a=h;h[q.UINT8]=1;h[q.UINT16]=2;h[q.UINT32]=4;h[q.UINT64]=8;h[q.FLOAT32]=4},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return c});f.c=function(a,b){e.set(a,b)};
-f.b=function(a){return e.get(a)};h=a(1);var p=a(140),n=a(21),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),b=new Float32Array(4),c=function(a){function c(a){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var b=(c.__proto__||Object.getPrototypeOf(c)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-b=!b||"object"!==typeof b&&"function"!==typeof b?this:b;b.gl=a;b.countingBuffer=b.registerDisposer(Object(p.d)(b.gl));return b}q(c,a);d(c,[{key:"setPartIndex",value:function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];d="\nvoid setPartIndex("+c.map(function(a,b){return"float partIndex"+b}).join()+") {\n  uint32_t pickID; pickID.value = uPickID;\n  uint32_t pickBaseOffset = getPickBaseOffset();\n"+c.map(function(a,b){return"uint32_t pickOffset"+b+" = add(pickBaseOffset, partIndex"+
-b+");"}).join("\n")+"\n";0===c.length&&(d+="\n  uint32_t pickOffset0 = pickBaseOffset;\n");d+="\n  vPickID = add(pickID, pickOffset0).value;\n  uint32_t selectedIndex; selectedIndex.value = uSelectedIndex;\nif (equals(selectedIndex, pickBaseOffset)"+c.map(function(a,b){return" || equals(selectedIndex, pickOffset"+b+")"}).join("")+") {\n    vColor = uColorSelected;\n  } else {\n    vColor = uColor;\n  }\n}\n";a.addVertexCode(n.d);a.addVertexCode(n.b);a.addVertexCode(d);return"setPartIndex("+c.join()+
-")"}},{key:"getCrossSectionFadeFactor",value:function(){return this.targetIsSliceView?"(clamp(1.0 - 2.0 * abs(0.5 - gl_FragCoord.z), 0.0, 1.0))":"(1.0)"}},{key:"defineShader",value:function(a){a.addUniform("highp vec4","uColor");a.addUniform("highp vec4","uColorSelected");a.addUniform("highp vec4","uSelectedIndex");a.addVarying("highp vec4","vColor");a.addUniform("highp mat4","uProjection");a.addUniform("highp vec4","uPickID");a.addVarying("highp vec4","vPickID");a.require(p.b);1===this.pickIdsPerInstance?
-a.addVertexCode("\nuint32_t getPickBaseOffset() { return getPrimitiveIndex(); }\n"):(a.addVertexCode(n.j),a.addVertexCode("\nuint32_t getPickBaseOffset() {\n  return multiply(getPrimitiveIndex(), "+this.pickIdsPerInstance.toFixed(1)+");\n}\n"));a.addFragmentCode("\nvoid emitAnnotation(vec4 color) {\n  emit(color, vPickID);\n}\n")}},{key:"enable",value:function(a,c,d){a.bind();var e=this.gl,g=c.renderContext,k=c.annotationLayer;this.countingBuffer.ensure(c.count).bind(a,1);e.uniformMatrix4fv(a.uniform("uProjection"),
-!1,c.projectionMatrix);g.emitPickID&&e.uniform4fv(a.uniform("uPickID"),Object(n.r)(b,c.basePickId));if(g.emitColor){g=k.state.color.value;b[0]=g[0];b[1]=g[1];b[2]=g[2];b[3]=1;e.uniform4fv(a.uniform("uColor"),b);for(g=0;3>g;++g)b[g]=.75+.25*b[g];e.uniform4fv(a.uniform("uColorSelected"),b);e.uniform4fv(a.uniform("uSelectedIndex"),Object(n.r)(b,c.selectedIndex))}d();Object(p.c)(this.gl,a,!0)}}]);return c}(h.a),e=new Map},function(h,f,a){function q(a,b,c,e,g,l){a=void 0===a?-1:a;b=void 0===b?-1:b;c=void 0===
-c?1:c;e=void 0===e?1:e;g=void 0===g?1:g;l=void 0===l?1:l;return Object(p.d)(new Float32Array([a,b,a,e,c,e,c,b]),2,g,l)}f.a=function(a,b,c,e,g,l,k){return Object(n.b)(a,WebGL2RenderingContext.ARRAY_BUFFER,q,void 0===b?-1:b,void 0===c?-1:c,void 0===e?1:e,void 0===g?1:g,void 0===l?1:l,void 0===k?1:k).value};var p=a(43),n=a(20)},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?
-a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function d(a){for(var b=t.length,c=t[b-1],d=0;d<b;++d){var e=t[d];if(a>=e.lengthInNanometers){c=
-e;break}}return c}function b(a){for(var b=Object.assign({},v),d={},e=$jscomp.makeIterator("textHeightInPixels barTopMarginInPixels barHeightInPixels paddingInPixels scaleFactor maxWidthInPixels maxWidthFraction leftPixelOffset bottomPixelOffset".split(" ")),g=e.next();!g.done;d={k:d.k},g=e.next())d.k=g.value,Object(c.v)(a,d.k,function(a){return function(d){void 0!==d&&(b[a.k]=Object(c.p)(d))}}(d));Object(c.v)(a,"fontName",function(a){void 0!==a&&(b.fontName=Object(c.A)(a))});return b}f.d=d;f.e=function(a){for(var b=
-t.length,c=t[b-1],d=0;d<b;++d){var e=t[d];if(a>=Math.pow(e.lengthInNanometers,3)){c=e;break}}return c};a.d(f,"a",function(){return m});a.d(f,"b",function(){return r});a.d(f,"c",function(){return w});h=a(9);f=a(1);var c=a(4),e=a(77),g=function x(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return x(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},l=function(){function a(a,
-b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),k=[1.5,2,3,5,7.5,10],t=[{unit:"km",lengthInNanometers:1E12},{unit:"m",lengthInNanometers:1E9},{unit:"mm",lengthInNanometers:1E6},{unit:"\u00b5m",lengthInNanometers:1E3},{unit:"nm",lengthInNanometers:1},{unit:"pm",lengthInNanometers:.001}],m=function(){function a(){n(this,a);this.allowedSignificands=
-k;this.prevTargetLengthInPixels=this.prevNanometersPerPixel=this.nanometersPerPixel=this.targetLengthInPixels=0}l(a,[{key:"update",value:function(){var a=this.nanometersPerPixel,b=this.targetLengthInPixels;if(this.prevNanometersPerPixel===a&&this.prevTargetLengthInPixels===b)return!1;this.prevNanometersPerPixel=a;this.prevTargetLengthInPixels=b;var c=b*a;b=Math.pow(10,Math.floor(Math.log(c)/Math.LN10));c/=b;for(var e=1,g=$jscomp.makeIterator(this.allowedSignificands),k=g.next();!k.done;k=g.next())if(k=
-k.value,Math.abs(k-c)<Math.abs(e-c))e=k;else break;b*=e;c=d(b);this.lengthInPixels=Math.round(b/a);this.physicalUnit=c.unit;this.physicalLength=b/c.lengthInNanometers;return!0}}]);return a}(),r=function(a){function b(a,c){c=void 0===c?new m:c;n(this,b);var d=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.gl=a;d.dimensions=c;d.texture=null;d.width=0;d.height=0;d.priorOptions=void 0;return d}p(b,a);l(b,[{key:"update",value:function(a){var b=this.dimensions,c=this.texture;if(b.update()||
-null===c||a!==this.priorOptions){null===c&&(c=this.texture=this.gl.createTexture());var d=this.gl,g=a;g=void 0===g?u:g;var k=document.createElement("canvas"),l=k.getContext("2d"),m=g.textHeightInPixels*g.scaleFactor,r="bold "+m+"px "+g.fontName;l.font=r;l.fillStyle="white";var t=b.physicalLength+" "+b.physicalUnit,f=l.measureText(t),h=g.barHeightInPixels*g.scaleFactor,v=g.barTopMarginInPixels*g.scaleFactor;g=g.paddingInPixels*g.scaleFactor;m=h+v+m+2*g;f=Math.max(b.lengthInPixels,f.width)+2*g;k.width=
-f;k.height=m;l.font=r;l.textAlign="center";l.fillStyle="rgba(0, 0, 0, 0.3)";l.fillRect(0,0,f,m);l.fillStyle="white";l.fillText(t,f/2,m-g-h-v);l.fillRect(g,m-g-h,b.lengthInPixels,h);Object(e.c)(d,c,k);this.priorOptions=a;this.width=f;this.height=m}}},{key:"disposed",value:function(){this.gl.deleteTexture(this.texture);this.texture=null;g(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}}]);return b}(f.a),u={scaleFactor:1,textHeightInPixels:15,barHeightInPixels:8,
-barTopMarginInPixels:5,fontName:"sans-serif",paddingInPixels:2},v=Object.assign({},u,{maxWidthInPixels:100,maxWidthFraction:.25,leftPixelOffset:10,bottomPixelOffset:10}),w=function(a){function c(){n(this,c);return q(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,v,b))}p(c,a);return c}(h.c)},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==
-typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}a.d(f,"b",function(){return w});a.d(f,"a",function(){return y});a.d(f,"c",function(){return z});var d=a(30);h=a(24);var b=
-a(265);f=a(59);var c=a(78),e=a(64),g=a(2),l=a(23),k=a(20),t=a(25),m=a(21);a=a(15);var r=function G(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return G(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},u=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,
-d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),v=this&&this.__decorate||function(a,b,c,d){var e=arguments.length,g=3>e?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,k;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)g=Reflect.decorate(a,b,c,d);else for(var l=a.length-1;0<=l;l--)if(k=a[l])g=(3>e?k(g):3<e?k(b,c,g):k(b,c))||g;return 3<e&&g&&Object.defineProperty(b,c,g),g},w=function(){function a(){n(this,a);this.tempLightVec=new Float32Array(4);this.tempPickID=
-new Float32Array(4)}u(a,[{key:"defineShader",value:function(a){a.addAttribute("highp vec3","aVertexPosition");a.addAttribute("highp vec3","aVertexNormal");a.addVarying("highp vec4","vColor");a.addUniform("highp vec4","uLightDirection");a.addUniform("highp vec4","uColor");a.addUniform("highp mat4","uModelMatrix");a.addUniform("highp mat4","uProjection");a.addUniform("highp vec4","uPickID");a.setVertexMain("\ngl_Position = uProjection * (uModelMatrix * vec4(aVertexPosition, 1.0));\nvec3 normal = (uModelMatrix * vec4(aVertexNormal, 0.0)).xyz;\nfloat lightingFactor = abs(dot(normal, uLightDirection.xyz)) + uLightDirection.w;\nvColor = vec4(lightingFactor * uColor.rgb, uColor.a);\n");
-a.setFragmentMain("emit(vColor, uPickID);")}},{key:"beginLayer",value:function(a,b,c){var d=c.dataToDevice,e=c.lightDirection,k=c.ambientLighting;c=c.directionalLighting;a.uniformMatrix4fv(b.uniform("uProjection"),!1,d);d=this.tempLightVec;g.s.scale(d,e,c);d[3]=k;a.uniform4fv(b.uniform("uLightDirection"),d)}},{key:"setColor",value:function(a,b,c){a.uniform4fv(b.uniform("uColor"),c)}},{key:"setPickID",value:function(a,b,c){a.uniform4fv(b.uniform("uPickID"),Object(m.r)(this.tempPickID,c))}},{key:"beginObject",
-value:function(a,b,c){a.uniformMatrix4fv(b.uniform("uModelMatrix"),!1,c)}},{key:"getShader",value:function(a,b){var c=this;return a.memoize.get("mesh/MeshShaderManager:"+Object(l.a)(b),function(){var d=new t.a(a);d.require(b);c.defineShader(d);return d.build()})}},{key:"drawFragment",value:function(a,b,c){c.vertexBuffer.bindToVertexAttrib(b.attribute("aVertexPosition"),3);c.normalBuffer.bindToVertexAttrib(b.attribute("aVertexNormal"),3);c.indexBuffer.bind();a.drawElements(a.TRIANGLES,c.numIndices,
-a.UNSIGNED_INT,0)}},{key:"endLayer",value:function(a,b){a.disableVertexAttribArray(b.attribute("aVertexPosition"));a.disableVertexAttribArray(b.attribute("aVertexNormal"))}}]);return a}(),y=function(a){function g(a,c,d){n(this,g);var k=q(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));k.chunkManager=a;k.source=c;k.displayState=d;k.meshShaderManager=new w;k.shaders=new Map;Object(e.f)(d,k);a=k.sharedObject=k.registerDisposer(new e.b(a,d));a.RPC_TYPE_ID=b.b;a.initializeCounterpartWithChunkManager({source:c.addCounterpartRef()});
-k.setReady(!0);a.visibility.add(k.visibility);return k}p(g,a);u(g,[{key:"getShader",value:function(a){var b=this.shaders,c=b.get(a);void 0===c&&(c=this.registerDisposer(this.meshShaderManager.getShader(this.gl,a)),b.set(a,c));return c}},{key:"draw",value:function(a){var b=this;if(a.emitColor||!a.alreadyEmittedPickID){var c=this.gl,g=this.displayState,k=this.meshShaderManager,l=Math.min(1,g.objectAlpha.value);if(!(0>=l)){var m=this.getShader(a.emitter);m.bind();k.beginLayer(c,m,a);var r=a.pickIDs,
-t=this.displayState.objectToDataTransform.transform;Object(e.d)(g,this.source.fragmentSource.objectChunks,function(f,u,h){a.emitColor&&k.setColor(c,m,Object(e.e)(g,f,l));a.emitPickID&&k.setPickID(c,m,r.registerUint64(b,u));k.beginObject(c,m,t);f=$jscomp.makeIterator(h);for(u=f.next();!u.done;u=f.next())u=u.value,u.state===d.d.GPU_MEMORY&&k.drawFragment(c,m,u)});k.endLayer(c,m)}}}},{key:"isReady",value:function(){var a=this.displayState,b=this.source,e=!0,g=b.fragmentSource.chunks;Object(c.a)(a,function(k){k=
-Object(c.b)(k,a.clipBounds.value);var l=b.chunks.get(k);if(void 0===l)e=!1;else{l=$jscomp.makeIterator(l.fragmentIds);for(var m=l.next();!m.done;m=l.next())if(m=g.get(k+"/"+m.value),void 0===m||m.state!==d.d.GPU_MEMORY){e=!1;break}}});return e}},{key:"isTransparent",get:function(){return 1>this.displayState.objectAlpha.value}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}]);return g}(f.a),x=function(a){function b(a,c){n(this,b);a=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,
-a));a.fragmentIds=c.fragmentIds;return a}p(b,a);return b}(h.b),A=function(a){function b(a,c){n(this,b);a=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));a.objectKey=c.objectKey;a.vertexPositions=c.vertexPositions;var d=a.indices=c.indices;a.numIndices=d.length;a.vertexNormals=c.vertexNormals;return a}p(b,a);u(b,[{key:"copyToGPU",value:function(a){r(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"copyToGPU",this).call(this,a);this.vertexBuffer=k.a.fromData(a,this.vertexPositions,
-a.ARRAY_BUFFER,a.STATIC_DRAW);this.indexBuffer=k.a.fromData(a,this.indices,a.ELEMENT_ARRAY_BUFFER,a.STATIC_DRAW);this.normalBuffer=k.a.fromData(a,this.vertexNormals,a.ARRAY_BUFFER,a.STATIC_DRAW)}},{key:"freeGPUMemory",value:function(a){r(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"freeGPUMemory",this).call(this,a);this.vertexBuffer.dispose();this.indexBuffer.dispose();this.normalBuffer.dispose()}}]);return b}(h.b),z=function(a){function b(){n(this,b);var a=q(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,
-arguments));a.fragmentSource=a.registerDisposer(new D(a.chunkManager,a));return a}p(b,a);u(b,[{key:"initializeCounterpart",value:function(a,c){this.fragmentSource.initializeCounterpart(this.chunkManager.rpc,{});c.fragmentSource=this.fragmentSource.addCounterpartRef();r(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initializeCounterpart",this).call(this,a,c)}},{key:"getChunk",value:function(a){return new x(this,a)}}]);return b}(h.e),D=function(a){function b(a,c){n(this,b);a=q(this,(b.__proto__||
-Object.getPrototypeOf(b)).call(this,a));a.meshSource=c;a.objectChunks=new Map;return a}p(b,a);u(b,[{key:"addChunk",value:function(a,c){r(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"addChunk",this).call(this,a,c);a=this.objectChunks;var d=c.objectKey,e=a.get(d);void 0===e&&(e=new Set,a.set(d,e));e.add(c)}},{key:"deleteChunk",value:function(a){var c=this.chunks.get(a);r(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"deleteChunk",this).call(this,a);a=this.objectChunks;var d=
-c.objectKey,e=a.get(d);e.delete(c);0===e.size&&a.delete(d)}},{key:"getChunk",value:function(a){return new A(this,a)}}]);return b}(h.e);D=v([Object(a.g)(b.a)],D)},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function p(){return new n.f(void 0)}
-f.c=p;f.b=function(a){return new n.c(a,d.A)};a.d(f,"a",function(){return g});var n=a(9);h=a(1);var d=a(4),b=a(25),c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),e=function k(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==
-a)return k(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},g=function(a){function d(a,b,c,e){e=void 0===e?p():e;if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var g=(d.__proto__||Object.getPrototypeOf(d)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");g=!g||"object"!==typeof g&&"function"!==typeof g?this:g;g.gl=a;g.defineShader=b;g.getShaderKey=c;g.shaderError=e;g.shaderUpdated=
-!0;g.shader=void 0;e.value=void 0;return g}q(d,a);c(d,[{key:"invalidateShader",value:function(){this.shaderUpdated=!0}},{key:"get",value:function(){if(!this.shaderUpdated)return this.shader;this.shaderUpdated=!1;try{var a=this.getShader();this.disposeShader();this.shader=a;this.shaderError.value=null}catch(r){this.shaderError.value=r}return this.shader}},{key:"getShader",value:function(){var a=this,b=this.getShaderKey();return this.gl.memoize.get(b,function(){return a.buildShader()})}},{key:"buildShader",
-value:function(){var a=new b.a(this.gl);this.defineShader(a);return a.build()}},{key:"disposed",value:function(){e(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this);this.disposeShader()}},{key:"disposeShader",value:function(){this.shader&&(this.shader.dispose(),this.shader=void 0)}}]);return d}(h.a)},function(h,f,a){f.a=function(a){return new q.c(void 0===a?.5:a,p.q)};var q=a(9),p=a(4)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
-}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a,b,c,d){var e=
-!1,g;a.registerDisposer(b);var k=l.UNLINKED,m=function(){var e=c.value;if(e!==k)switch(e){case l.UNLINKED:g=void 0;break;case l.LINKED:g=void 0;d.assign(a,b);break;case l.RELATIVE:g=d.difference(a,b)}k=e;a.changed.dispatch()};a.registerDisposer(a.changed.add(function(){if(!e)switch(c.value){case l.LINKED:d.assign(b,a);break;case l.RELATIVE:d.subtract(b,a,g)}}));a.registerDisposer(b.changed.add(function(){e=!0;switch(c.value){case l.UNLINKED:if(d.isValid(a))break;case l.LINKED:d.assign(a,b);break;
-case l.RELATIVE:d.add(a,b,g)}e=!1}));a.registerDisposer(c.changed.add(m));m();return a}a.d(f,"d",function(){return l});a.d(f,"h",function(){return t});a.d(f,"b",function(){return v});a.d(f,"f",function(){return w});a.d(f,"a",function(){return y});a.d(f,"g",function(){return x});a.d(f,"c",function(){return z});a.d(f,"e",function(){return D});h=a(1);var b=a(2),c=a(4),e=a(7);a=a(306);var g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=
-!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),l;(function(a){a[a.LINKED=0]="LINKED";a[a.RELATIVE=1]="RELATIVE";a[a.UNLINKED=2]="UNLINKED"})(l||(l={}));var k=function(a){function b(a){a=void 0===a?l.LINKED:a;q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,l,a))}n(b,a);return b}(a.a),t=function(a){function d(a){q(this,d);var c=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.changed=
-new e.a;var g=!0;null==a&&(a=b.s.create(),g=!1);c.size=a;c.valid=g;return c}n(d,a);g(d,[{key:"reset",value:function(){this.valid=!1;this.changed.dispatch()}},{key:"setValid",value:function(){this.valid||(this.valid=!0,this.changed.dispatch())}},{key:"toJSON",value:function(){if(this.valid)return Array.prototype.slice.call(this.size)}},{key:"restoreState",value:function(a){try{Object(c.b)(this.size,a),this.valid=!0,this.changed.dispatch()}catch(B){this.valid=!1,this.changed.dispatch()}}},{key:"toString",
-value:function(){return this.valid?this.size.toString():null}},{key:"voxelFromSpatial",value:function(a,c){return b.s.divide(a,c,this.size)}},{key:"spatialFromVoxel",value:function(a,c){return b.s.multiply(a,c,this.size)}}]);return d}(h.a),m=b.s.create(),r=b.n.create(),u=function(a){function d(a,c){q(this,d);var g=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));g.voxelCoordinates=null;g.changed=new e.a;null==a&&(a=new t);g.voxelSize=a;var k=!0;null==c&&(c=b.s.create(),k=!1);g.spatialCoordinates=
-c;g.spatialCoordinatesValid=k;g.registerDisposer(a);g.registerDisposer(a.changed.add(function(){g.handleVoxelSizeChanged()}));return g}n(d,a);g(d,[{key:"reset",value:function(){this.spatialCoordinatesValid=!1;this.voxelCoordinates=null;this.voxelSize.reset();this.changed.dispatch()}},{key:"getVoxelCoordinates",value:function(a){var c=this.voxelCoordinates;if(c)b.s.copy(a,c);else if(this.valid)this.voxelSize.voxelFromSpatial(a,this.spatialCoordinates);else return!1;return!0}},{key:"setVoxelCoordinates",
-value:function(a){var c=this.voxelSize;c.valid?(c.spatialFromVoxel(this.spatialCoordinates,a),this.markSpatialCoordinatesChanged()):(c=this.voxelCoordinates)?b.s.copy(c,a):this.voxelCoordinates=b.s.clone(a);this.changed.dispatch()}},{key:"markSpatialCoordinatesChanged",value:function(){this.spatialCoordinatesValid=!0;this.voxelCoordinates=null;this.changed.dispatch()}},{key:"handleVoxelSizeChanged",value:function(){null==this.voxelCoordinates||this.spatialCoordinatesValid||(this.voxelSize.spatialFromVoxel(this.spatialCoordinates,
-this.voxelCoordinates),this.spatialCoordinatesValid=!0);this.voxelCoordinates=null;this.changed.dispatch()}},{key:"toJSON",value:function(){var a=!0,b=this.voxelSize.toJSON(),c={};void 0!==b&&(a=!1,c.voxelSize=b);this.voxelCoordinatesValid?(this.getVoxelCoordinates(m),c.voxelCoordinates=Array.prototype.slice.call(m),a=!1):this.spatialCoordinatesValid&&(c.spatialCoordinates=Array.prototype.slice.call(this.spatialCoordinates),a=!1);if(!a)return c}},{key:"restoreState",value:function(a){var d=this;Object(c.t)(a);
-Object(c.v)(a,"voxelSize",function(a){void 0!==a&&d.voxelSize.restoreState(a)});this.spatialCoordinatesValid=!1;Object(c.v)(a,"voxelCoordinates",function(a){void 0!==a&&d.setVoxelCoordinates(Object(c.b)(b.s.create(),a))});Object(c.v)(a,"spatialCoordinates",function(a){void 0!==a&&(Object(c.b)(d.spatialCoordinates,a),d.markSpatialCoordinatesChanged())})}},{key:"snapToVoxel",value:function(){if(this.valid){for(var a=this.spatialCoordinates,b=this.voxelSize.size,c=0;3>c;++c){var d=b[c];a[c]=Math.round(a[c]/
-d)*d}this.changed.dispatch()}else if(a=this.voxelCoordinates,null!=a){for(b=0;3>b;++b)a[b]=Math.round(a[b]);this.changed.dispatch()}}},{key:"assign",value:function(a){this.spatialCoordinatesValid=a.spatialCoordinatesValid;b.s.copy(this.spatialCoordinates,a.spatialCoordinates);this.voxelCoordinates=(a=a.voxelCoordinates)&&b.s.clone(a);this.changed.dispatch()}},{key:"valid",get:function(){return this.spatialCoordinatesValid&&this.voxelSize.valid}},{key:"voxelCoordinatesValid",get:function(){return this.valid||
-null!=this.voxelCoordinates}}],[{key:"getOffset",value:function(a,c){if(a.spatialCoordinatesValid&&c.spatialCoordinatesValid)return{spatialOffset:b.s.subtract(b.s.create(),a.spatialCoordinates,c.spatialCoordinates)};if(a.voxelCoordinates&&c.voxelCoordinates){if(a.voxelSize!==c.voxelSize)throw Error("Voxel offsets are only meaningful with identical voxelSize.");return{voxelOffset:b.s.subtract(b.s.create(),a.voxelCoordinates,c.voxelCoordinates)}}return{}}},{key:"addOffset",value:function(a,c,d,e){e=
-void 0===e?1:e;var g=d.spatialOffset;d=d.voxelOffset;void 0!==g&&c.spatialCoordinatesValid?(b.s.scaleAndAdd(a.spatialCoordinates,c.spatialCoordinates,g,e),a.markSpatialCoordinatesChanged()):void 0!==d&&c.getVoxelCoordinates(m)&&a.setVoxelCoordinates(b.s.scaleAndAdd(m,m,d,e))}}]);return d}(h.a);a=function(){function a(b,c){c=void 0===c?new k:c;q(this,a);this.peer=b;this.link=c}g(a,[{key:"toJSON",value:function(){var a=this.link;if(a.value!==l.LINKED)return{link:a.toJSON(),value:this.getValueJson()}}},
-{key:"getValueJson",value:function(){return this.value.toJSON()}},{key:"reset",value:function(){this.link.value=l.LINKED}},{key:"restoreState",value:function(a){var b=this;void 0===a||0===Object.keys(a).length?this.link.value=l.LINKED:(Object(c.t)(a),this.link.value=l.UNLINKED,Object(c.v)(a,"value",function(a){void 0!==a&&b.value.restoreState(a)}),Object(c.v)(a,"link",function(a){return b.link.restoreState(a)}))}},{key:"copyToPeer",value:function(){this.link.value!==l.LINKED&&(this.link.value=l.UNLINKED,
-this.peer.assign(this.value),this.link.value=l.LINKED)}},{key:"changed",get:function(){return this.value.changed}}]);return a}();var v=function(a){function b(){q(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.value=d(new u(a.peer.voxelSize.addRef()),a.peer,a.link,{assign:function(a,b){return a.assign(b)},isValid:function(a){return a.spatialCoordinatesValid||a.voxelCoordinatesValid},difference:u.getOffset,add:u.addOffset,subtract:function(a,b,c){u.addOffset(a,
-b,c,-1)}});return a}n(b,a);g(b,[{key:"getValueJson",value:function(){var a=this.value.toJSON()||{};delete a.voxelSize;return a}}]);return b}(a),w=function(a){function d(a){q(this,d);var c=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.changed=new e.a;null==a&&(a=b.n.create());c.orientation=a;return c}n(d,a);g(d,[{key:"toJSON",value:function(){var a=this.orientation;b.n.normalize(this.orientation,this.orientation);if(0!==a[0]||0!==a[1]||0!==a[2]||1!==a[3])return Array.prototype.slice.call(this.orientation)}},
-{key:"restoreState",value:function(a){try{Object(c.b)(this.orientation,a),b.n.normalize(this.orientation,this.orientation)}catch(B){b.n.identity(this.orientation)}this.changed.dispatch()}},{key:"reset",value:function(){b.n.identity(this.orientation);this.changed.dispatch()}},{key:"snap",value:function(){var a=b.i.create();b.i.fromQuat(a,this.orientation);for(var c=[!1,!1,!1],d=0;3>d;++d){for(var e=0,g=0,k=0;3>k;++k){var l=a[3*d+k];a[3*d+k]=0;!c[k]&&Math.abs(l)>Math.abs(e)&&(e=l,g=k)}a[3*d+g]=Math.sign(e);
-c[g]=!0}b.n.fromMat3(this.orientation,a);this.changed.dispatch()}},{key:"assign",value:function(a){b.n.copy(this.orientation,a.orientation);this.changed.dispatch()}}],[{key:"makeRelative",value:function(a,c){var e=new d(b.n.multiply(b.n.create(),a.orientation,c)),g=!1;e.registerDisposer(a.changed.add(function(){g||(k=!0,b.n.multiply(e.orientation,a.orientation,c),e.changed.dispatch(),k=!1)}));var k=!1,l=b.n.invert(b.n.create(),c);e.registerDisposer(e.changed.add(function(){k||(g=!0,b.n.multiply(a.orientation,
-e.orientation,l),a.changed.dispatch(),g=!1)}));return e}}]);return d}(h.a),y=function(a){function c(){q(this,c);var a=p(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments));a.value=d(new w,a.peer,a.link,{assign:function(a,b){return a.assign(b)},isValid:function(){return!0},difference:function(a,c){var d=b.n.create();return b.n.multiply(d,b.n.invert(d,c.orientation),a.orientation)},add:function(a,c,d){b.n.multiply(a.orientation,c.orientation,d);a.changed.dispatch()},subtract:function(a,
-c,d){b.n.multiply(a.orientation,c.orientation,b.n.invert(r,d));a.changed.dispatch()}});return a}n(c,a);return c}(a),x=function(a){function d(a,b){q(this,d);var c=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.changed=new e.a;null==a&&(a=new u);c.position=a;null==b&&(b=new w);c.orientation=b;c.registerDisposer(c.position);c.registerDisposer(c.orientation);c.registerDisposer(c.position.changed.add(c.changed.dispatch));c.registerDisposer(c.orientation.changed.add(c.changed.dispatch));return c}
-n(d,a);g(d,[{key:"reset",value:function(){this.position.reset();this.orientation.reset()}},{key:"toMat4",value:function(a){b.k.fromRotationTranslation(a,this.orientation.orientation,this.position.spatialCoordinates)}},{key:"toJSON",value:function(){var a=this.position.toJSON(),b=this.orientation.toJSON();if(void 0!==a||void 0!==b)return{position:a,orientation:b}}},{key:"restoreState",value:function(a){var b=this;Object(c.t)(a);Object(c.v)(a,"position",function(a){void 0!==a&&b.position.restoreState(a)});
-Object(c.v)(a,"orientation",function(a){void 0!==a&&b.orientation.restoreState(a)})}},{key:"snap",value:function(){this.orientation.snap();this.position.snapToVoxel();this.changed.dispatch()}},{key:"translateAbsolute",value:function(a){b.s.add(this.position.spatialCoordinates,this.position.spatialCoordinates,a);this.position.changed.dispatch()}},{key:"translateRelative",value:function(a){this.valid&&(b.s.transformQuat(m,a,this.orientation.orientation),b.s.add(this.position.spatialCoordinates,this.position.spatialCoordinates,
-m),this.position.changed.dispatch())}},{key:"translateVoxelsRelative",value:function(a){if(this.valid){var c=b.s.create();b.s.transformQuat(c,a,this.orientation.orientation);b.s.multiply(c,c,this.position.voxelSize.size);b.s.add(this.position.spatialCoordinates,this.position.spatialCoordinates,c);this.position.changed.dispatch()}}},{key:"rotateRelative",value:function(a,c){var d=b.n.create();b.n.setAxisAngle(d,a,c);a=this.orientation.orientation;b.n.multiply(a,a,d);this.orientation.changed.dispatch()}},
-{key:"rotateAbsolute",value:function(a,c,d){var e=b.n.create();b.n.setAxisAngle(e,a,c);a=this.orientation.orientation;if(void 0!==d){c=this.position.spatialCoordinates;var g=b.s.subtract(m,d,c),k=b.n.invert(r,a);b.s.transformQuat(g,g,k);b.n.multiply(a,e,a);b.s.transformQuat(c,g,a);b.s.subtract(c,d,c);this.position.changed.dispatch()}else b.n.multiply(a,e,a);this.orientation.changed.dispatch()}},{key:"valid",get:function(){return this.position.valid}}]);return d}(h.a),A=function(a){function b(a,c){a=
-void 0===a?Number.NaN:a;c=void 0===c?a:c;q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.value_=a;d.defaultValue=c;d.changed=new e.a;return d}n(b,a);g(b,[{key:"toJSON",value:function(){var a=this.value_,b=this.defaultValue;if(!(Number.isNaN(a)&&Number.isNaN(b)||a===b))return a}},{key:"restoreState",value:function(a){"number"===typeof a&&Number.isFinite(a)&&0<a?this.value=a:this.value=this.defaultValue}},{key:"reset",value:function(){this.value=this.defaultValue}},{key:"zoomBy",
-value:function(a){var b=this.value_;Number.isNaN(b)||(this.value=b*a)}},{key:"assign",value:function(a){this.value=a.value}},{key:"value",get:function(){return this.value_},set:function(a){a!==this.value_&&(this.value_=a,this.changed.dispatch())}},{key:"valid",get:function(){return!Number.isNaN(this.value)}}]);return b}(h.a),z=function(a){function b(){q(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.value=function(){var b=new A;return d(b,a.peer,a.link,{assign:function(a,
-b){return a.assign(b)},isValid:function(a){return a.valid},difference:function(a,b){return a.value/b.value},add:function(a,b,c){a.value=b.value*c},subtract:function(a,b,c){a.value=b.value/c}})}();return a}n(b,a);return b}(a),D=function(a){function d(a,b){a=void 0===a?new x:a;b=void 0===b?Number.NaN:b;q(this,d);var c=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.pose=a;c.changed=new e.a;c.zoomFactor="number"===typeof b?new A(b):b;c.registerDisposer(c.zoomFactor);c.registerDisposer(a);
-c.registerDisposer(c.pose.changed.add(function(){c.changed.dispatch()}));c.registerDisposer(c.zoomFactor.changed.add(function(){c.changed.dispatch()}));c.registerDisposer(c.voxelSize.changed.add(function(){c.handleVoxelSizeChanged()}));c.handleVoxelSizeChanged();return c}n(d,a);g(d,[{key:"reset",value:function(){this.pose.reset();this.zoomFactor.reset()}},{key:"setZoomFactorFromVoxelSize",value:function(){this.voxelSize.valid&&(this.zoomFactor.value=Math.min.apply(null,this.voxelSize.size))}},{key:"handleVoxelSizeChanged",
-value:function(){this.zoomFactor.valid||this.setZoomFactorFromVoxelSize()}},{key:"toMat4",value:function(a){this.pose.toMat4(a);var c=this.zoomFactor.value;b.k.scale(a,a,b.s.fromValues(c,c,c))}},{key:"toJSON",value:function(){var a=this.pose.toJSON(),b=this.zoomFactor.toJSON();if(void 0!==a||void 0!==b)return{pose:a,zoomFactor:b}}},{key:"restoreState",value:function(a){var b=this;try{Object(c.t)(a),Object(c.v)(a,"pose",function(a){void 0!==a&&b.pose.restoreState(a)}),Object(c.v)(a,"zoomFactor",function(a){void 0!==
-a&&b.zoomFactor.restoreState(a)}),this.handleVoxelSizeChanged(),this.changed.dispatch()}catch(F){this.reset()}}},{key:"zoomBy",value:function(a){this.zoomFactor.zoomBy(a)}},{key:"voxelSize",get:function(){return this.pose.position.voxelSize}},{key:"position",get:function(){return this.pose.position}},{key:"valid",get:function(){return this.pose.valid}}]);return d}(h.a)},function(h,f,a){a.d(f,"a",function(){return b});f.b=function(a,b,d){d(a.transform,b.transform);return b.changed.add(function(){d(a.transform,
-b.transform);a.changed.dispatch()})};var q=a(2),p=a(4),n=a(7),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),b=function(){function a(b){b=void 0===b?q.k.create():b;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.transform=b;this.changed=new n.a}d(a,[{key:"reset",value:function(){q.k.copy(this.transform,
-q.d);this.changed.dispatch()}},{key:"toJSON",value:function(){if(!q.k.equals(q.d,this.transform)){var a=this.transform;return[[a[0],a[4],a[8],a[12]],[a[1],a[5],a[9],a[13]],[a[2],a[6],a[10],a[14]],[a[3],a[7],a[11],a[15]]]}}},{key:"restoreState",value:function(a){if(null==a)this.reset();else if(Array.isArray(a))if(4===a.length)try{for(var b=0;4>b;++b)Object(p.b)(this.transform.subarray(4*b,4*(b+1)),a[b]);q.k.transpose(this.transform,this.transform)}catch(t){this.reset()}else if(16===a.length)try{Object(p.b)(this.transform,
-a),q.k.transpose(this.transform,this.transform)}catch(t){this.reset()}else this.reset();else if("object"===typeof a){b=q.n.create();var c=q.s.create(),d=q.s.fromValues(1,1,1);try{Object(p.b)(b,a.rotation),q.n.normalize(b,b)}catch(t){q.n.identity(b)}try{Object(p.b)(c,a.translation)}catch(t){q.s.copy(c,q.h)}try{Object(p.b)(d,a.scale)}catch(t){q.s.copy(d,q.g)}q.k.fromRotationTranslationScale(this.transform,b,c,d);this.changed.dispatch()}else this.reset()}},{key:"clone",value:function(){return new a(q.k.clone(this.transform))}}]);
-return a}()},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return n});h=a(18);var p=function(){function a(a,c){for(var b=0;b<c.length;b++){var d=c[b];d.enumerable=d.enumerable||!1;d.configurable=
-!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),n=function(a){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}q(b,a);p(b,[{key:"draw",value:function(a){}},
-{key:"isReady",value:function(){return!0}}]);return b}(h.j)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a){a.addOutputBuffer("vec4","v4f_fragColor",null);a.addFragmentCode("\nvoid emit(vec4 color, vec4 pickId) {\n  v4f_fragColor = color;\n}\n")}function b(a){a.addOutputBuffer("vec4","v4f_fragColor",null);a.addFragmentCode("\nvoid emit(vec4 color, vec4 pickId) {\n  v4f_fragColor = pickId;\n}\n")}a.d(f,"b",function(){return y});a.d(f,"a",function(){return A});
-var c=a(144),e=a(18),g=a(145);h=a(146);var l=a(44),k=a(22),t=a(2),m=a(80),r=a(99),u=a(53),v=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),w;(function(a){a[a.COLOR=0]="COLOR";a[a.PICK=1]="PICK";a[a.NUM_TEXTURES=2]="NUM_TEXTURES"})(w||(w={}));var y=function(a){function b(){q(this,b);return p(this,(b.__proto__||
-Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);v(b,[{key:"draw",value:function(a){}},{key:"isReady",value:function(){return!0}}]);return b}(e.j),x=t.u.create(),A=function(a){function f(a,b,h,v){q(this,f);var n=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,a,b,v));n.sliceView=h;n.axesLineHelper=n.registerDisposer(c.a.get(n.gl));n.sliceViewRenderHelper=n.registerDisposer(l.d.get(n.gl,d));n.colorFactor=t.u.fromValues(1,1,1,1);n.pickIDs=new g.a;n.visibleLayerTracker=Object(e.l)(n.viewer.layerManager,
-y,n.viewer.visibleLayerRoles,n);n.offscreenFramebuffer=n.registerDisposer(new r.b(n.gl,{colorBuffers:Object(r.e)(n.gl,w.NUM_TEXTURES)}));n.offscreenCopyHelper=n.registerDisposer(r.c.get(n.gl));n.scaleBarCopyHelper=n.registerDisposer(r.c.get(n.gl));n.scaleBarTexture=n.registerDisposer(new u.b(n.gl));Object(k.c)(b,"translate-via-mouse-drag",function(a){n.viewer.mouseState.updateUnconditionally()&&Object(m.a)(a.detail,function(a,b,c){a=n.viewer.navigationState.position;var d=a.spatialCoordinates;t.s.set(d,
-b,c,0);t.s.transformMat4(d,d,n.sliceView.viewportToData);a.changed.dispatch()})});Object(k.c)(b,"rotate-via-mouse-drag",function(a){var b=n.viewer.mouseState;if(b.updateUnconditionally()){var c=t.s.clone(b.position);Object(m.a)(a.detail,function(a,b,d){a=n.sliceView.viewportAxes;n.viewer.navigationState.pose.rotateAbsolute(a[1],b/4*Math.PI/180,c);n.viewer.navigationState.pose.rotateAbsolute(a[0],d/4*Math.PI/180,c)})}});n.registerDisposer(h);n.registerDisposer(v.crossSectionBackgroundColor.changed.add(function(){return n.scheduleRedraw()}));
-n.registerDisposer(h.visibility.add(n.visibility));n.registerDisposer(h.viewChanged.add(function(){n.visible&&a.scheduleRedraw()}));n.registerDisposer(v.showAxisLines.changed.add(function(){n.visible&&n.scheduleRedraw()}));n.registerDisposer(v.showScaleBar.changed.add(function(){n.visible&&n.context.scheduleRedraw()}));n.registerDisposer(v.scaleBarOptions.changed.add(function(){n.visible&&n.context.scheduleRedraw()}));return n}n(f,a);v(f,[{key:"isReady",value:function(){if(!this.visible||!this.sliceView.isReady())return!1;
-var a=this.visibleLayerTracker.getVisibleLayers();a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next())if(!b.value.isReady())return!1;return!0}},{key:"draw",value:function(){var a=this.sliceView;this.onResize();a.updateRendering();if(a.hasValidViewport){var c=this.gl,e=a.width,g=a.height,k=a.dataToDevice;this.offscreenFramebuffer.bind(e,g);c.disable(WebGL2RenderingContext.SCISSOR_TEST);this.gl.clearColor(0,0,0,0);c.clear(WebGL2RenderingContext.COLOR_BUFFER_BIT);var l=t.k.create(),m=this.viewer.crossSectionBackgroundColor.value;
-x[0]=m[0];x[1]=m[1];x[2]=m[2];x[3]=1;this.offscreenFramebuffer.bindSingle(w.COLOR);this.sliceViewRenderHelper.draw(a.offscreenFramebuffer.colorBuffers[0].texture,t.d,this.colorFactor,x,0,0,1,1);m=this.visibleLayerTracker.getVisibleLayers();var r=this.pickIDs;r.clear();r={dataToDevice:a.dataToDevice,pickIDs:r,emitter:d,emitColor:!0,emitPickID:!1,viewportWidth:e,viewportHeight:g,sliceView:a};c.enable(WebGL2RenderingContext.BLEND);c.blendFunc(WebGL2RenderingContext.SRC_ALPHA,WebGL2RenderingContext.ONE_MINUS_SRC_ALPHA);
-for(var f=$jscomp.makeIterator(m),u=f.next();!u.done;u=f.next())u.value.draw(r);c.disable(WebGL2RenderingContext.BLEND);this.offscreenFramebuffer.bindSingle(w.PICK);r.emitColor=!1;r.emitPickID=!0;r.emitter=b;m=$jscomp.makeIterator(m);for(u=m.next();!u.done;u=m.next())u.value.draw(r);if(this.viewer.showAxisLines.value||this.viewer.showScaleBar.value){if(this.viewer.showAxisLines.value){t.k.copy(l,k);for(k=0;3>k;++k)l[12+k]=0;for(k=0;4>k;++k)l[2+4*k]=0;g=Math.min(e,g)/4*1.5;k=a.pixelSize;for(m=0;12>
-m;++m)l[m]=l[m]*g*k}this.offscreenFramebuffer.bindSingle(w.COLOR);this.viewer.showAxisLines.value&&this.axesLineHelper.draw(l);this.viewer.showScaleBar.value&&(c.enable(WebGL2RenderingContext.BLEND),c.blendFunc(WebGL2RenderingContext.SRC_ALPHA,WebGL2RenderingContext.ONE_MINUS_SRC_ALPHA),l=this.viewer.scaleBarOptions.value,g=this.scaleBarTexture,k=g.dimensions,k.targetLengthInPixels=Math.min(l.maxWidthFraction*e,l.maxWidthInPixels*l.scaleFactor),k.nanometersPerPixel=a.pixelSize,g.update(l),c.viewport(l.leftPixelOffset*
-l.scaleFactor,l.bottomPixelOffset*l.scaleFactor,g.width,g.height),this.scaleBarCopyHelper.draw(g.texture),c.disable(WebGL2RenderingContext.BLEND))}this.offscreenFramebuffer.unbind();this.setGLViewport();this.offscreenCopyHelper.draw(this.offscreenFramebuffer.colorBuffers[w.COLOR].texture)}}},{key:"onResize",value:function(){this.sliceView.setViewportSizeDebounced(this.element.clientWidth,this.element.clientHeight)}},{key:"updateMouseState",value:function(a){a.pickedRenderLayer=null;var b=this.sliceView;
-if(!b.hasValidViewport)return!1;var c=b.width,d=b.height,e=this.offscreenFramebuffer;if(!e.hasSize(c,d))return!1;var g=a.position,k=this.mouseX,l=this.mouseY;t.s.set(g,k-c/2,l-d/2,0);t.s.transformMat4(g,g,b.viewportToData);this.pickIDs.setMouseState(a,e.readPixelAsUint32(w.PICK,k,d-l));return!0}},{key:"zoomByMouse",value:function(a){var b=this.navigationState;if(b.valid){var c=this.sliceView,d=c.height,e=this.mouseX,g=this.mouseY;e-=c.width/2;g-=d/2;d=this.navigationState.zoomFactor.value;b.zoomBy(a);
-a=b.zoomFactor.value;var k=b.position.spatialCoordinates;t.s.scaleAndAdd(k,k,c.viewportAxes[0],e*(d-a));t.s.scaleAndAdd(k,k,c.viewportAxes[1],g*(d-a));b.position.changed.dispatch()}}},{key:"navigationState",get:function(){return this.sliceView.navigationState}}]);return f}(h.a)},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,
-writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"b",function(){return c});h=a(1);var p=a(22);a.d(f,"a",function(){return p.a});a.d(f,"c",function(){return p.c});var n=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),d=new Set("f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 escape pause".split(" ")),
-b=new Set("color date datetime datetime-local email month number password search tel text time url week".split(" ")),c=function(a){function c(a,b){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var d=(c.__proto__||Object.getPrototypeOf(c)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");d=!d||"object"!==typeof d&&"function"!==typeof d?this:d;d.target=a;d.eventMap=b;d.modifierShortcutsAreGlobal=!0;d.allShortcutsAreGlobal=
-!1;d.allowSpaceKeyOnButtons=!1;d.registerEventListener(a,"keydown",d.handleKeyDown.bind(d),!1);return d}q(c,a);n(c,[{key:"shouldIgnoreEvent",value:function(a,c){var e=c.target,g=e.tagName;if(e===this.target)return!1;var k="TEXTAREA"===g||"INPUT"===g||"BUTTON"===g||"SELECT"===g,l=!k&&(e.isContentEditable||e.ownerDocument&&"on"===e.ownerDocument.designMode);return!k&&!l||this.allShortcutsAreGlobal||d.has(a)?!1:l||this.modifierShortcutsAreGlobal&&(c.altKey||c.ctrlKey||c.metaKey)?!0:"INPUT"===g&&b.has(e.type)?
-"enter"!==a:"INPUT"===g||"BUTTON"===g?this.allowSpaceKeyOnButtons?!1:"space"===a:!0}},{key:"handleKeyDown",value:function(a){var b=a.code.toLowerCase();this.shouldIgnoreEvent(b,a)||Object(p.b)(b,a,this.eventMap)}}]);return c}(h.a)},function(h,f,a){f.a=function(a,f){f.offset+=a;return f};f.b=function(a,f){var h=[];f=$jscomp.makeIterator(f);for(var d=f.next();!d.done;d=f.next())d=d.value,d.startsWith(a)&&h.push({value:d});return h};f.c=function(a,f,h,d){var b=[];f=$jscomp.makeIterator(f);for(var c=
-f.next();!c.done;c=f.next()){c=c.value;var e=h(c);e.startsWith(a)&&b.push({value:e,description:d(c)})}return b}},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return e});f.b=function(a,d,e){e=void 0===
-e?"GET":e;var g=new XMLHttpRequest;if(Array.isArray(a)){var k=a.length;k=1===k?0:Math.abs(Object(n.a)(d))%k;a=a[k]+d}else a+=d;g[c]=e;g[b]=a;g.open(e,a);return g};f.d=function(a,b,c){c=void 0===c?p.e:c;a.responseType=b;return new Promise(function(b,d){var g=function(){a.abort()};c.add(g);a.onloadend=function(){var k=this.status;c.remove(g);200<=k&&300>k?b(this.response):d(e.fromXhr(a))};a.send()})};f.c=function(a){var b=a.match(/^([^:\/]+):\/\/([^\/]+)(\/.*)?$/);if(null===b)throw Error("Invalid URL: "+
-JSON.stringify(a));return"gs"===b[1]?[["https://storage.googleapis.com/"+b[2]],b[3]]:[[a],""]};var p=a(32),n=a(263),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();$jscomp.initSymbol();var b=Symbol("url");$jscomp.initSymbol();var c=Symbol("method"),e=function(a){function e(a,b,c,d){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");
-var g=a+" "+JSON.stringify(b)+" resulted in HTTP error "+c;d&&(g+=": "+d);g+=".";var k=(e.__proto__||Object.getPrototypeOf(e)).call(this,g);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");k=!k||"object"!==typeof k&&"function"!==typeof k?this:k;k.name="HttpError";k.message=g;k.method=a;k.url=b;k.code=c;k.statusMessage=d;return k}q(e,a);d(e,null,[{key:"fromXhr",value:function(a){return new e(a[c],a[b],a.status,a.statusText)}}]);return e}(Error)},function(h,
-f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a,b){if(!(a instanceof
-b))throw new TypeError("Cannot call a class as a function");}function d(a,b){var c=b.redrawNeeded.dispatch;b.registerDisposer(a.segmentColorHash.changed.add(c));b.registerDisposer(a.visibleSegments.changed.add(c));b.registerDisposer(a.highlightedSegments.changed.add(c));b.registerDisposer(a.segmentEquivalences.changed.add(c));b.registerDisposer(a.segmentSelectionState.changed.add(c))}a.d(f,"c",function(){return m});a.d(f,"a",function(){return r});f.g=d;f.f=function(a,b){d(a,b);b.registerDisposer(a.objectAlpha.changed.add(b.redrawNeeded.dispatch));
-b.registerDisposer(a.objectToDataTransform.changed.add(b.redrawNeeded.dispatch))};f.e=function(a,b,d){d=void 0===d?1:d;var e=u;e[3]=d;a.segmentColorHash.compute(e,b);if(a.segmentSelectionState.isSelected(b))for(var g=0;3>g;++g)e[g]=.5*e[g]+.5;g=new Float32Array(3);Object(c.b)(g,e[0],e[1],e[2]);g[1]*=a.saturation.value;var k=new Float32Array(3);Object(c.a)(k,g[0],g[1],g[2]);e[0]=k[0];e[1]=k[1];e[2]=k[2];a.highlightedSegments.has(b)&&(e[0]=.2,e[1]=.2,e[2]=2,e[3]=1);e[0]*=d;e[1]*=d;e[2]*=d;return e};
-f.d=function(a,c,d){Object(b.a)(a,function(e,g){var k=Object(b.b)(e,a.clipBounds.value);k=c.get(k);void 0!==k&&d(g,e,k)})};a.d(f,"b",function(){return v});var b=a(78),c=a(149);h=a(1);f=a(2);var e=a(7),g=a(14),l=a(29);a=a(15);var k=function y(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return y(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},t=function(){function a(a,
-b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),m=function(){function a(b,c){n(this,a);this.key=b;this.value=c}t(a,[{key:"toString",value:function(){return this.key+"\u2192"+this.value}}]);return a}(),r=function(a){function b(){n(this,b);var a=q(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.selectedSegment=
-new g.a;a.hasSelectedSegment=!1;a.changed=new e.a;return a}p(b,a);t(b,[{key:"set",value:function(a){if(null==a)this.hasSelectedSegment&&(this.hasSelectedSegment=!1,this.changed.dispatch());else{var b=this.selectedSegment;this.hasSelectedSegment&&a.low===b.low&&a.high===b.high||(b.low=a.low,b.high=a.high,this.hasSelectedSegment=!0,this.changed.dispatch())}}},{key:"isSelected",value:function(a){return this.hasSelectedSegment&&g.a.equal(a,this.selectedSegment)}},{key:"bindTo",value:function(a,b){var c=
-this,d=new g.a;this.registerDisposer(a.changed.add(function(){var e=a.get(b);"number"===typeof e?(d.low=e,d.high=0,e=d):e instanceof m&&(e=e.value);c.set(e)}))}}]);return b}(h.a),u=f.u.create(),v=function(a){function b(a,c){n(this,b);var d=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.chunkManager=a;d.displayState=c;return d}p(b,a);t(b,[{key:"initializeCounterpartWithChunkManager",value:function(a){var c=this.displayState;a.chunkManager=this.chunkManager.rpcId;a.visibleSegments=c.visibleSegments.rpcId;
-a.segmentEquivalences=c.segmentEquivalences.rpcId;a.clipBounds=c.clipBounds.rpcId;k(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initializeCounterpart",this).call(this,this.chunkManager.rpc,a)}}]);return b}(Object(l.c)(a.b))},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==
-typeof b?a:b}function n(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 d(a){return new B.a({fragmentMain:a.displayState.fragmentMain,shaderError:a.displayState.shaderError,fragmentMainStartLine:t.a})}Object.defineProperty(f,"__esModule",
-{value:!0});a.d(f,"SegmentationUserLayer",function(){return M});h=a(18);f=a(27);var b=a(54),c=a(47),e=a(113),g=a(64),l=a(298),k=a(75),t=a(104),m=a(26),r=a(175),u=a(56),v=a(35),w=a(9),y=a(300),x=a(163),A=a(4),z=a(7),D=a(14),E=a(55),G=a(81),C=a(301),B=a(112),F=a(40),L=a(168),J=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,
-d);return b}}(),O=function U(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return U(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a(45);a(303);var M=function(a){function c(a,b){q(this,c);var d=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,a,b));d.manager=a;d.displayState={segmentColorHash:e.a.getDefault(),segmentSelectionState:new g.a,selectedAlpha:Object(u.a)(.5),
-saturation:Object(u.a)(1),notSelectedAlpha:Object(u.a)(0),objectAlpha:Object(u.a)(1),clipBounds:k.a.make(d.manager.worker,void 0),hideSegmentZero:new v.b(!0,!0),visibleSegments:y.a.makeWithCounterpart(d.manager.worker),highlightedSegments:y.a.makeWithCounterpart(d.manager.worker),segmentEquivalences:l.a.makeWithCounterpart(d.manager.worker),objectToDataTransform:d.transform,fragmentMain:Object(t.f)(),shaderError:Object(E.c)()};d.objectLayerStateChanged=new z.a;d.displayState.visibleSegments.changed.add(function(){return d.specificationChanged.dispatch()});
-d.displayState.segmentEquivalences.changed.add(function(){return d.specificationChanged.dispatch()});d.displayState.segmentSelectionState.bindTo(a.layerSelectedValues,d);d.displayState.selectedAlpha.changed.add(function(){return d.specificationChanged.dispatch()});d.displayState.notSelectedAlpha.changed.add(function(){return d.specificationChanged.dispatch()});d.displayState.objectAlpha.changed.add(function(){return d.specificationChanged.dispatch()});d.displayState.hideSegmentZero.changed.add(function(){return d.specificationChanged.dispatch()});
-d.displayState.fragmentMain.changed.add(function(){return d.specificationChanged.dispatch()});d.tabs.add("rendering",{label:"Rendering",order:-100,getter:function(){return new P(d)}});d.tabs.default="rendering";return d}n(c,a);J(c,[{key:"restoreState",value:function(a){var d=this;O(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"restoreState",this).call(this,a);this.displayState.selectedAlpha.restoreState(a.selectedAlpha);this.displayState.saturation.restoreState(a.saturation);this.displayState.notSelectedAlpha.restoreState(a.notSelectedAlpha);
-this.displayState.objectAlpha.restoreState(a.objectAlpha);this.displayState.hideSegmentZero.restoreState(a.hideSegmentZero);this.displayState.fragmentMain.restoreState(a.skeletonShader);Object(A.v)(a,"equivalences",function(a){d.displayState.segmentEquivalences.restoreState(a)});var e=function(b,c){Object(A.v)(a,b,function(a){if(void 0!==a){var b=d.displayState.segmentEquivalences;Object(A.a)(a,function(a){a=D.a.parseString(String(a),10);c.add(b.get(a))})}})};e("segments",this.displayState.visibleSegments);
-e("highlights",this.displayState.highlightedSegments);Object(A.v)(a,"clipBounds",function(a){if(void 0!==a){var b,c;Object(A.v)(a,"center",function(a){return b=Object(A.k)(a)});Object(A.v)(a,"size",function(a){return c=Object(A.k)(a)});b&&c&&(d.displayState.clipBounds.value={center:b,size:c})}});this.displayState.highlightedSegments.changed.add(function(){d.specificationChanged.dispatch()});e=this.multiscaleSource;var g=this.meshPath=null===a.mesh?null:Object(A.y)(a.mesh),k=this.skeletonsPath=Object(A.v)(a,
-"skeletons",A.y),l=0;null!=g&&(++l,this.manager.dataSourceProvider.getMeshSource(this.manager.chunkManager,g).then(function(a){d.wasDisposed||(d.addMesh(a),0===--l&&(d.isReady=!0))}));void 0!==k&&(++l,this.manager.dataSourceProvider.getSkeletonSource(this.manager.chunkManager,k).then(function(a){d.wasDisposed||(d.addSkeletonSource(a),0===--l&&(d.isReady=!0))}));void 0!==e&&(++l,e.then(function(a){d.wasDisposed||(d.addRenderLayer(new r.a(a,d.displayState)),void 0===g&&void 0===k&&(++l,Promise.resolve(a.getMeshSource()).then(function(a){d.wasDisposed?
-null!==a&&a.dispose():(0===--l&&(d.isReady=!0),a instanceof b.c?(d.addMesh(a),d.objectLayerStateChanged.dispatch()):a instanceof t.d&&(d.addSkeletonSource(a),d.objectLayerStateChanged.dispatch()))})),0===--l&&(d.isReady=!0))}))}},{key:"addMesh",value:function(a){this.meshLayer=new b.a(this.manager.chunkManager,a,this.displayState);this.addRenderLayer(this.meshLayer)}},{key:"addSkeletonSource",value:function(a){this.skeletonLayer=a=new t.c(this.manager.chunkManager,a,this.manager.voxelSize,this.displayState);
-this.addRenderLayer(new t.b(a.addRef()));this.addRenderLayer(new t.e(a))}},{key:"toJSON",value:function(){var a=O(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"toJSON",this).call(this);a.type="segmentation";a.mesh=this.meshPath;a.skeletons=this.skeletonsPath;a.selectedAlpha=this.displayState.selectedAlpha.toJSON();a.notSelectedAlpha=this.displayState.notSelectedAlpha.toJSON();a.saturation=this.displayState.saturation.toJSON();a.objectAlpha=this.displayState.objectAlpha.toJSON();a.hideSegmentZero=
-this.displayState.hideSegmentZero.toJSON();var b=this.displayState.visibleSegments;0<b.size&&(a.segments=b.toJSON());b=this.displayState.highlightedSegments;0<b.size&&(a.highlights=b.toJSON());b=this.displayState.segmentEquivalences;0<b.size&&(a.equivalences=b.toJSON());b=this.displayState.clipBounds;b.value&&(a.clipBounds={center:Array.from(b.value.center),size:Array.from(b.value.size)});a.skeletonShader=this.displayState.fragmentMain.toJSON();return a}},{key:"transformPickedValue",value:function(a){if(null==
-a)return a;var b=this.displayState.segmentEquivalences;if(0===b.size)return a;"number"===typeof a&&(a=new D.a(a,0));b=b.get(a);return D.a.equal(b,a)?a:new g.c(a,b)}},{key:"handleAction",value:function(a){switch(a){case "recolor":this.displayState.segmentColorHash.randomize();break;case "clear-segments":this.displayState.visibleSegments.clear();break;case "select":a=this.displayState.segmentSelectionState;if(a.hasSelectedSegment){a=a.selectedSegment;var b=this.displayState.visibleSegments;b.has(a)?
-b.delete(a):b.add(a)}break;case "highlight":a=this.displayState.segmentSelectionState,a.hasSelectedSegment&&(a=a.selectedSegment,b=this.displayState.highlightedSegments,b.has(a)?b.delete(a):b.add(a))}}},{key:"volumeOptions",get:function(){return{volumeType:m.c.SEGMENTATION}}}]);return c}(Object(x.a)(h.i)),P=function(a){function b(a){q(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.layer=a;c.visibleSegmentWidget=c.registerDisposer(new C.a(c.layer.displayState));c.addSegmentWidget=
-c.registerDisposer(new L.a);c.selectedAlphaWidget=c.registerDisposer(new G.a(c.layer.displayState.selectedAlpha));c.notSelectedAlphaWidget=c.registerDisposer(new G.a(c.layer.displayState.notSelectedAlpha));c.saturationWidget=c.registerDisposer(new G.a(c.layer.displayState.saturation));c.objectAlphaWidget=c.registerDisposer(new G.a(c.layer.displayState.objectAlpha));var e=c.element;e.classList.add("segmentation-dropdown");var g=c.notSelectedAlphaWidget,k=c.saturationWidget,l=c.objectAlphaWidget;c.selectedAlphaWidget.promptElement.textContent=
-"Opacity (on)";g.promptElement.textContent="Opacity (off)";k.promptElement.textContent="Saturation";l.promptElement.textContent="Opacity (3d)";void 0!==c.layer.volumePath&&(e.appendChild(c.selectedAlphaWidget.element),e.appendChild(c.notSelectedAlphaWidget.element),e.appendChild(c.saturationWidget.element));c.registerDisposer(new v.a(c.registerDisposer(new w.a(function(){return c.layer.meshPath||c.layer.meshLayer||c.layer.skeletonsPath||c.layer.skeletonLayer?!0:!1},c.layer.objectLayerStateChanged)),
-c.objectAlphaWidget.element));e.appendChild(c.objectAlphaWidget.element);a=c.registerDisposer(new v.c(a.displayState.hideSegmentZero));a.element.className="neuroglancer-segmentation-dropdown-hide-segment-zero neuroglancer-noselect";g=document.createElement("label");g.className="neuroglancer-segmentation-dropdown-hide-segment-zero neuroglancer-noselect";g.appendChild(document.createTextNode("Hide segment ID 0"));g.appendChild(a.element);e.appendChild(g);c.addSegmentWidget.element.classList.add("add-segment");
-c.addSegmentWidget.element.title="Add one or more segment IDs";e.appendChild(c.registerDisposer(c.addSegmentWidget).element);c.registerDisposer(c.addSegmentWidget.valuesEntered.add(function(a){a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next())c.layer.displayState.visibleSegments.add(b.value)}));e.appendChild(c.registerDisposer(c.visibleSegmentWidget).element);a=function(){if(void 0===c.codeWidget&&null!==c.layer.skeletonsPath&&void 0!==c.layer.skeletonLayer){var a=document.createElement("div");
-a.className="neuroglancer-segmentation-dropdown-skeleton-shader-header";var b=document.createElement("div");b.style.flex="1";b.textContent="Skeleton shader:";var g=document.createElement("a"),k=document.createElement("button");k.type="button";k.textContent="?";k.className="help-link";g.appendChild(k);g.title="Documentation on skeleton rendering";g.target="_blank";g.href="https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/image_layer_rendering.md";k=document.createElement("button");
-k.innerHTML="&square;";k.className="maximize-button";k.title="Show larger editor view";c.registerEventListener(k,"click",function(){new N(c.layer)});a.appendChild(b);a.appendChild(k);a.appendChild(g);e.appendChild(a);a=c.codeWidget=c.registerDisposer(d(c.layer));e.appendChild(a.element);a.textEditor.refresh()}};c.registerDisposer(c.layer.objectLayerStateChanged.add(a));a();c.visibility.changed.add(function(){c.visible&&void 0!==c.codeWidget&&c.codeWidget.textEditor.refresh()});return c}n(b,a);return b}(F.b),
-N=function(a){function b(a){q(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.layer=a;c.codeWidget=c.registerDisposer(d(c.layer));c.content.classList.add("neuroglancer-segmentation-layer-skeleton-shader-overlay");c.content.appendChild(c.codeWidget.element);c.codeWidget.textEditor.refresh();return c}n(b,a);return b}(c.a);Object(f.e)("segmentation",M);Object(f.f)(m.c.SEGMENTATION,M)},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}a.d(f,"b",function(){return m});a.d(f,
-"a",function(){return y});var d=a(114),b=a(14),c=function A(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return A(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,
-c);d&&a(b,d);return b}}();f.c=3;var g=0,l=0,k=0,t=0;h=function(){function a(b){b=void 0===b?a.generateHashFunctions(3):b;n(this,a);this.loadFactor=.9;this.size=0;this.growFactor=1.2;this.maxHeight=8192;this.emptyHigh=this.emptyLow=4294967295;this.maxAttempts=this.maxRehashAttempts=5;this.maxWidth=4096/this.entryStride;this.generation=0;this.mungedEmptyKey=-1;this.hashFunctions=b;this.allocate(4,1)}e(a,[{key:"updateHashFunctions",value:function(b){this.hashFunctions=a.generateHashFunctions(b);this.mungedEmptyKey=
--1}},{key:"tableWithMungedEmptyKey",value:function(a){for(var b=this.hashFunctions.length,c=Array(b),d=0;d<b;++d)c[d]=this.getHash(d,this.emptyLow,this.emptyHigh);d=this.mungedEmptyKey;if(-1===d)a:for(;;){d=16777216*Math.random()>>>0;for(var e=0;e<b;++e)for(var g=this.getHash(e,d,d),k=0;k<b;++k)if(c[k]===g)continue a;this.mungedEmptyKey=d;break}e=this.table;g=this.emptyLow;k=this.emptyHigh;for(var l=0;l<b;++l){var m=c[l];e[m]===g&&e[m+1]===k&&(e[m]=d,e[m+1]=d)}try{a(e)}finally{for(a=0;a<b;++a)l=c[a],
-e[l]===d&&e[l+1]===d&&(e[l]=g,e[l+1]=k)}}},{key:"getHash",value:function(a,b,c){a=this.hashFunctions[a];var d=this.width,e=this.height;d=a[0].compute(b,c)%d;b=a[1].compute(b,c)%e;return this.entryStride*(b*this.width+d)}},{key:"keys",value:function(a){function c(c,n){for(;;)switch(d){case 0:a=void 0===a?new b.a:a,h=v,u=h.emptyLow,f=h.emptyHigh,t=h.entryStride,r=v,m=r.table,l=0,k=m.length;case 1:if(!(l<k)){d=3;break}g=m[l];e=m[l+1];if(g===u&&e===f){d=4;break}a.low=g;a.high=e;d=5;return{value:a,done:!1};
-case 5:if(void 0===n){d=6;break}d=-1;throw n;case 6:case 4:case 2:l+=t;d=1;break;case 3:d=-1;default:return{value:void 0,done:!0}}}var d=0,e,g,k,l,m,r,t,f,u,h,v=this,n={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();n[Symbol.iterator]=function(){return this};return n}},{key:"indexOfPair",value:function(a,b){var c=this.table,d=this.emptyHigh;if(a===this.emptyLow&&b===d)return-1;d=0;for(var e=
-this.hashFunctions.length;d<e;++d){var g=this.getHash(d,a,b);if(c[g]===a&&c[g+1]===b)return g}return-1}},{key:"indexOf",value:function(a){return this.indexOfPair(a.low,a.high)}},{key:"chooseAnotherEmptyKey",value:function(){for(var a=this.emptyLow,b=this.emptyHigh,c=this.table,d=this.entryStride,e,g;e=4294967296*Math.random()>>>0,g=4294967296*Math.random()>>>0,e===a&&g===b||this.hasPair(e,g););this.emptyLow=e;this.emptyHigh=g;for(var k=0,l=c.length;k<l;k+=d)c[k]===a&&c[k+1]===b&&(c[k]=e,c[k+1]=g)}},
-{key:"has",value:function(a){return-1!==this.indexOf(a)}},{key:"hasPair",value:function(a,b){return-1!==this.indexOfPair(a,b)}},{key:"delete",value:function(a){a=this.indexOf(a);if(-1!==a){var b=this.table;b[a]=this.emptyLow;b[a+1]=this.emptyHigh;++this.generation;this.size--;return!0}return!1}},{key:"clearTable",value:function(){for(var a=this.table,b=this.entryStride,c=this.emptyLow,d=this.emptyHigh,e=a.length,g=0;g<e;g+=b)a[g]=c,a[g+1]=d}},{key:"clear",value:function(){if(0===this.size)return!1;
-this.size=0;++this.generation;this.clearTable();return!0}},{key:"swapPending",value:function(a,b){var c=g,d=l;this.storePending(a,b);a[b]=c;a[b+1]=d}},{key:"storePending",value:function(a,b){g=a[b];l=a[b+1]}},{key:"backupPending",value:function(){k=g;t=l}},{key:"restorePending",value:function(){g=k;l=t}},{key:"tryToInsert",value:function(){for(var a=0,b=this.emptyLow,c=this.emptyHigh,d=this.maxAttempts,e=this.table,k=this.hashFunctions.length,m=Math.floor(Math.random()*k);;){var r=this.getHash(m,
-g,l);this.swapPending(e,r);if(g===b&&l===c)return!0;if(++a===d)break;m=(m+Math.floor(Math.random()*(k-1))+1)%k}return!1}},{key:"allocate",value:function(a,b){var c=a*b;this.width=a;this.height=b;this.table=new Uint32Array(c*this.entryStride);this.maxAttempts=c;this.clearTable();this.capacity=c*this.loadFactor;this.mungedEmptyKey=-1}},{key:"rehash",value:function(a,b,c){this.allocate(b,c);this.updateHashFunctions(this.hashFunctions.length);b=this.emptyLow;c=this.emptyHigh;for(var d=this.entryStride,
-e=0,g=a.length;e<g;e+=d){var k=a[e+1];if(a[e]!==b||k!==c)if(this.storePending(a,e),!this.tryToInsert())return!1}return!0}},{key:"grow",value:function(a){for(var b=this.table,c=this.width,d=this.height,e=this.maxWidth,g=this.maxHeight;;){var k=c*d;c=Math.min(e,Math.ceil(a/this.height));c*d<a&&(d=Math.min(g,Math.ceil(a/c)));var l=c*d;if(l<a&&l===k)throw Error("Maximum table size exceeded");for(k=0;k<this.maxRehashAttempts;++k)if(this.rehash(b,c,d))return;a=Math.ceil(this.growFactor*a)}}},{key:"insertInternal",
-value:function(){++this.generation;g===this.emptyLow&&l===this.emptyHigh&&this.chooseAnotherEmptyKey();++this.size>this.capacity&&(this.backupPending(),this.grow(Math.ceil(this.growFactor*this.width*this.height)),this.restorePending());for(;!this.tryToInsert();)this.backupPending(),this.grow(this.width*this.height),this.restorePending()}}],[{key:"generateHashFunctions",value:function(a){a=void 0===a?3:a;for(var b=[],c=0;c<a;++c){var e=[d.a.generate(),d.a.generate()];b.push(e)}return b}}]);return a}();
-var m=function(a){function b(){n(this,b);return q(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}p(b,a);$jscomp.initSymbol();$jscomp.initSymbolIterator();e(b,[{key:"add",value:function(a){var b=a.low;a=a.high;if(this.hasPair(b,a))return!1;g=b;l=a;this.insertInternal();return!0}},{key:Symbol.iterator,value:function(){return this.keys()}}]);return b}(h);m.prototype.entryStride=2;var r=0,u=0,v=0,w=0,y=function(a){function d(){n(this,d);return q(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,
-arguments))}p(d,a);$jscomp.initSymbol();$jscomp.initSymbolIterator();e(d,[{key:"set",value:function(a,b){var c=a.low;a=a.high;if(this.hasPair(c,a))return!1;g=c;l=a;r=b.low;u=b.high;this.insertInternal();return!0}},{key:"get",value:function(a,b){a=this.indexOf(a);if(-1===a)return!1;var c=this.table;b.low=c[a+2];b.high=c[a+3];return!0}},{key:"swapPending",value:function(a,b){var e=r,g=u;c(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"swapPending",this).call(this,a,b);a[b+2]=e;a[b+3]=g}},
-{key:"storePending",value:function(a,b){c(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"storePending",this).call(this,a,b);r=a[b+2];u=a[b+3]}},{key:"backupPending",value:function(){c(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"backupPending",this).call(this);v=r;w=u}},{key:"restorePending",value:function(){c(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"restorePending",this).call(this);r=v;u=w}},{key:Symbol.iterator,value:function(){return this.entries()}},
-{key:"entries",value:function(a){function c(c,q){for(;;)switch(d){case 0:a=void 0===a?[new b.a,new b.a]:a,w=p,n=w.emptyLow,v=w.emptyHigh,h=w.entryStride,u=p,f=u.table,t=$jscomp.makeIterator(a),r=t.next().value,m=t.next().value,l=0,k=f.length;case 1:if(!(l<k)){d=3;break}g=f[l];e=f[l+1];if(g===n&&e===v){d=4;break}r.low=g;r.high=e;m.low=f[l+2];m.high=f[l+3];d=5;return{value:a,done:!1};case 5:if(void 0===q){d=6;break}d=-1;throw q;case 6:case 4:case 2:l+=h;d=1;break;case 3:d=-1;default:return{value:void 0,
-done:!0}}}var d=0,e,g,k,l,m,r,t,f,u,h,v,n,w,p=this,q={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();q[Symbol.iterator]=function(){return this};return q}}]);return d}(h);y.prototype.entryStride=4},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a){var b=k.get(a),c=a.changed.count;if(void 0!==b&&b.generation===c)return b;if(a instanceof l){var e=a.baseJSON();for(var g=
-$jscomp.makeIterator(a.children),t=g.next();!t.done;t=g.next()){var f=$jscomp.makeIterator(t.value);t=f.next().value;f=f.next().value;e[t]=d(f).value}}else e=a.toJSON();void 0===b?(b={generation:c,value:e},k.set(a,b)):(b.generation=c,b.value=e);return b}a.d(f,"a",function(){return l});f.b=d;h=a(1);var b=a(4),c=a(7),e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,
-c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=function m(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return m(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},l=function(a){function d(){q(this,d);var a=p(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.children=new Map;a.changed=new c.a;return a}n(d,a);e(d,[{key:"add",value:function(a,b){var c=
-this;if(this.children.has(a))throw Error("Key "+JSON.stringify(a)+" already registered.");this.children.set(a,b);b.changed.add(this.changed.dispatch);this.changed.dispatch();return function(){c.remove(a)}}},{key:"remove",value:function(a){var b=this.children;if(b.has(a))throw Error("Key "+JSON.stringify(a)+" not registered.");b=b.get(a);this.children.delete(a);b.changed.remove(this.changed.dispatch);this.changed.dispatch()}},{key:"disposed",value:function(){for(var a=this.changed,b=$jscomp.makeIterator(this.children.values()),
-c=b.next();!c.done;c=b.next())c.value.changed.remove(a.dispatch);this.children=void 0;g(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}},{key:"toJSON",value:function(){for(var a=this.baseJSON(),b=$jscomp.makeIterator(this.children),c=b.next();!c.done;c=b.next()){var d=$jscomp.makeIterator(c.value);c=d.next().value;d=d.next().value;a[c]=d.toJSON()}return a}},{key:"baseJSON",value:function(){return{}}},{key:"reset",value:function(){for(var a=$jscomp.makeIterator(this.children.values()),
-b=a.next();!b.done;b=a.next())b.value.reset()}},{key:"restoreState",value:function(a){Object(b.t)(a);for(var c=$jscomp.makeIterator(this.children),d=c.next();!d.done;d=c.next()){var e=$jscomp.makeIterator(d.value);d=e.next().value;e=e.next().value;try{if(a.hasOwnProperty(d)){var g=a[d];void 0!==g&&e.restoreState(g)}}catch(A){throw Error("Error restoring property "+JSON.stringify(d)+": "+A.message);}}}}]);return d}(h.a);(function(a){function c(){q(this,c);var a=p(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,
-arguments));a.lastState={};return a}n(c,a);e(c,[{key:"restoreState",value:function(a){Object(b.t)(a);this.lastState=a;g(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"restoreState",this).call(this,a)}},{key:"reset",value:function(){this.lastState={};g(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"reset",this).call(this)}},{key:"baseJSON",value:function(){for(var a=Object.assign(g(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"baseJSON",this).call(this),this.lastState),
-b=$jscomp.makeIterator(this.children.keys()),d=b.next();!d.done;d=b.next())delete a[d.value];return a}},{key:"toJSON",value:function(){var a=g(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"toJSON",this).call(this);return this.lastState=a}},{key:"add",value:function(a,b){var d=g(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"add",this).call(this,a,b);a=this.lastState[a];void 0!==a&&(b.reset(),b.restoreState(a));return d}}]);return c})(l);var k=new WeakMap},function(h,f,a){function q(a){var f=
-a.Symbol;if("function"===typeof f)return f.iterator||(f.iterator=f("iterator polyfill")),f.iterator;if((f=a.Set)&&"function"===typeof(new f)["@@iterator"])return"@@iterator";if(a=a.Map){f=Object.getOwnPropertyNames(a.prototype);for(var d=0;d<f.length;++d){var b=f[d];if("entries"!==b&&"size"!==b&&a.prototype[b]===a.prototype.entries)return b}}return"@@iterator"}h=a(16);f.symbolIteratorPonyfill=q;f.iterator=q(h.root);f.$$iterator=f.iterator},function(h,f,a){var q=a(0);h=function(){function a(a,d,b){this.kind=
-a;this.value=d;this.error=b;this.hasValue="N"===a}a.prototype.observe=function(a){switch(this.kind){case "N":return a.next&&a.next(this.value);case "E":return a.error&&a.error(this.error);case "C":return a.complete&&a.complete()}};a.prototype.do=function(a,d,b){switch(this.kind){case "N":return a&&a(this.value);case "E":return d&&d(this.error);case "C":return b&&b()}};a.prototype.accept=function(a,d,b){return a&&"function"===typeof a.next?this.observe(a):this.do(a,d,b)};a.prototype.toObservable=function(){switch(this.kind){case "N":return q.Observable.of(this.value);
-case "E":return q.Observable.throw(this.error);case "C":return q.Observable.empty()}throw Error("unexpected notification kind value");};a.createNext=function(f){return"undefined"!==typeof f?new a("N",f):a.undefinedValueNotification};a.createError=function(f){return new a("E",void 0,f)};a.createComplete=function(){return a.completeNotification};a.completeNotification=new a("C");a.undefinedValueNotification=new a("N",void 0);return a}();f.Notification=h},function(h,f,a){var q=this&&this.__extends||
-function(a,d){function b(){this.constructor=a}for(var c in d)d.hasOwnProperty(c)&&(a[c]=d[c]);a.prototype=null===d?Object.create(d):(b.prototype=d.prototype,new b)},p=a(16);h=function(a){function d(b,c){a.call(this,b,c);this.scheduler=b;this.work=c;this.pending=!1}q(d,a);d.prototype.schedule=function(a,c){void 0===c&&(c=0);if(this.closed)return this;this.state=a;this.pending=!0;a=this.id;var b=this.scheduler;null!=a&&(this.id=this.recycleAsyncId(b,a,c));this.delay=c;this.id=this.id||this.requestAsyncId(b,
-this.id,c);return this};d.prototype.requestAsyncId=function(a,c,d){void 0===d&&(d=0);return p.root.setInterval(a.flush.bind(a,this),d)};d.prototype.recycleAsyncId=function(a,c,d){void 0===d&&(d=0);return null!==d&&this.delay===d&&!1===this.pending?c:(p.root.clearInterval(c),void 0)};d.prototype.execute=function(a,c){if(this.closed)return Error("executing a cancelled action");this.pending=!1;if(a=this._execute(a,c))return a;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,
-this.id,null))};d.prototype._execute=function(a,c){c=!1;var b=void 0;try{this.work(a)}catch(g){c=!0,b=!!g&&g||Error(g)}if(c)return this.unsubscribe(),b};d.prototype._unsubscribe=function(){var a=this.id,c=this.scheduler,d=c.actions,g=d.indexOf(this);this.state=this.work=null;this.pending=!1;this.scheduler=null;-1!==g&&d.splice(g,1);null!=a&&(this.id=this.recycleAsyncId(c,a,null));this.delay=null};return d}(a(406).Action);f.AsyncAction=h},function(h,f,a){var q=this&&this.__extends||function(a,f){function d(){this.constructor=
-a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(){a.apply(this,arguments);this.actions=[];this.active=!1;this.scheduled=void 0}q(f,a);f.prototype.flush=function(a){var b=this.actions;if(this.active)b.push(a);else{var c;this.active=!0;do if(c=a.execute(a.state,a.delay))break;while(a=b.shift());this.active=!1;if(c){for(;a=b.shift();)a.unsubscribe();throw c;}}};return f}(a(407).Scheduler);f.AsyncScheduler=
-h},function(h,f,a){var q=this&&this.__extends||function(a,f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(){var d=a.call(this,"argument out of range");this.name=d.name="ArgumentOutOfRangeError";this.stack=d.stack;this.message=d.message}q(f,a);return f}(Error);f.ArgumentOutOfRangeError=h},function(h,f,a){var q=a(234);a.d(f,"b",function(){return q.a});var p=a(97);a.d(f,
-"c",function(){return p.b});var n=a(248);a.d(f,"a",function(){return n.a});a.d(f,"d",function(){return n.b});a.d(f,"e",function(){return n.c})},function(h,f){f=function(){return this}();try{f=f||Function("return this")()||(0,eval)("this")}catch(a){"object"===typeof window&&(f=window)}h.exports=f},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,
-enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return b});var p=a(9);h=a(15);var n=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),d=function g(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,
-b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return g(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};f=this&&this.__decorate||function(a,b,c,d){var g=arguments.length,k=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,l;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)k=Reflect.decorate(a,b,c,d);else for(var t=a.length-1;0<=t;t--)if(l=a[t])k=(3>g?l(k):3<g?l(b,c,k):l(b,c))||k;return 3<g&&k&&Object.defineProperty(b,c,k),k};
-var b=c=function(a){function b(a,c){c=void 0===c?{}:c;if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var d=(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");d=!d||"object"!==typeof d&&"function"!==typeof d?this:d;d.updatingValue_=!1;void 0!==a&&(d.base=new p.f(c.value),d.setupChangedHandler());return d}q(b,a);n(b,[{key:"initializeCounterpart",value:function(a,c){c=
-void 0===c?{}:c;c.value=this.value;d(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initializeCounterpart",this).call(this,a,c)}},{key:"setupChangedHandler",value:function(){var a=this;this.registerDisposer(this.base.changed.add(function(){if(a.updatingValue_)a.updatingValue_=!1;else{var b=a.rpc;null!==b&&b.invoke("SharedWatchableValue.changed",{id:a.rpcId,value:a.value})}}))}},{key:"value",get:function(){return this.base.value},set:function(a){this.base.value=a}},{key:"changed",get:function(){return this.base.changed}}],
-[{key:"makeFromExisting",value:function(a,b){var d=new c;d.base=b;d.setupChangedHandler();d.initializeCounterpart(a);return d}},{key:"make",value:function(a,b){return c.makeFromExisting(a,new p.f(b))}}]);return b}(h.c);b=c=f([Object(h.f)("SharedWatchableValue")],b);Object(h.e)("SharedWatchableValue.changed",function(a){var b=this.get(a.id);b.updatingValue_=!0;b.base.value=a.value;b.updatingValue_=!1});var c},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return g});var n=a(58);h=a(18);var d=a(39),b=a(2),c=a(15),e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=
-b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=function(a){function g(a,e,k){k=void 0===k?{}:k;if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var l=q(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));l.chunkManager=a;l.sources=e;l.rpcId=null;l.transformedSourcesGeneration=-1;a=k;var m=void 0===a.transform?new n.a:a.transform;
-l.transform=m;a=Object(d.m)(l)[0][0];k=a.source.spec;a=l.voxelSize=a.chunkLayout.localSpatialVectorToGlobal(b.s.create(),k.voxelSize);for(k=0;3>k;++k)a[k]=Math.abs(a[k]);a=l.registerDisposer(new c.b);var r=l.chunkManager.rpc;a.RPC_TYPE_ID=d.d;e=e.map(function(a){return a.map(function(a){return a.rpcId})});a.initializeCounterpart(r,{sources:e,transform:m.transform});l.rpcId=a.rpcId;l.registerDisposer(m.changed.add(function(){r.invoke(d.e,{id:l.rpcId,value:m.transform})}));l.setReady(!0);return l}p(g,
-a);e(g,[{key:"setGLBlendMode",value:function(a,b){0<b&&(a.enable(a.BLEND),a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA))}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}]);return g}(h.f)},function(h,f,a){function q(a){a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE)}f.b=q;f.a=
-function(a,f,d,b,c,e,g){c=void 0===c?a.RGBA8:c;e=void 0===e?a.RGBA:e;g=void 0===g?a.UNSIGNED_BYTE:g;a.activeTexture(a.TEXTURE0+a.tempTextureUnit);a.bindTexture(a.TEXTURE_2D,f);q(a);a.texImage2D(a.TEXTURE_2D,0,c,d,b,0,e,g,null);a.bindTexture(a.TEXTURE_2D,null)};f.c=function(a,f,d){a.activeTexture(a.TEXTURE0+a.tempTextureUnit);a.bindTexture(a.TEXTURE_2D,f);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D,
-a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,!0);a.pixelStorei(a.UNPACK_ALIGNMENT,4);a.texImage2D(a.TEXTURE_2D,0,a.RGBA8,a.RGBA,a.UNSIGNED_BYTE,d);a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,!1);a.bindTexture(a.TEXTURE_2D,null)}},function(h,f,a){f.b=function(a,f){return a.low+","+a.high+(f?"_"+f.center.toString()+"_"+f.size.toString():"")};f.a=function(a,f){var h=a.segmentEquivalences;a=$jscomp.makeIterator(a.visibleSegments);
-for(var d=a.next();!d.done;d=a.next())if(d=d.value,h.disjointSets.isMinElement(d))for(var b=$jscomp.makeIterator(h.setElements(d)),c=b.next();!c.done;c=b.next())f(c.value,d)}},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=
-Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}a.d(f,"a",function(){return k});h=a(10);var d=a.n(h);h=a(1);var b=a(256),c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,
-d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),e=function m(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return m(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},g=new function r(){n(this,r);b.a.initializeHead(this)},l=d()(function(){var a=document.activeElement;if(null===a||a===document.body)a=b.a.front(g),null!==a&&a.element.focus()});window.addEventListener("focus",
-function(){l()},!0);window.addEventListener("blur",function(){l()},!0);var k=function(a){function k(a){n(this,k);var c=q(this,(k.__proto__||Object.getPrototypeOf(k)).call(this));c.element=a;c.prev0=null;c.next0=null;c.lastFocusedElement=null;c.scheduleUpdateFocus=c.registerCancellable(d()(function(){var a=document.activeElement,b=c.element;b.contains(a)||((a===c.lastFocusedElement||a.contains(b))&&c.element.focus(),c.lastFocusedElement=null)},0));a.tabIndex=-1;c.registerEventListener(a,"mouseenter",
-function(){c.lastFocusedElement=document.activeElement;c.scheduleUpdateFocus()});c.registerEventListener(a,"mouseleave",function(){c.scheduleUpdateFocus.cancel()});b.a.insertBefore(g,c);c.registerEventListener(a,"focus",function(){b.a.pop(c);b.a.insertAfter(g,c)});l();return c}p(k,a);c(k,[{key:"disposed",value:function(){b.a.pop(this);e(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"disposed",this).call(this)}}]);return k}(h.a)},function(h,f,a){f.a=function(a,f){var h=a.view.document,
-d=a.screenX,b=a.screenY,c=function(a){var c=d-a.screenX,e=b-a.screenY;d=a.screenX;b=a.screenY;f(a,c,e)},e=a.button,g=function(a){a.button===e&&(h.removeEventListener("mousemove",c,!0),h.removeEventListener("mouseup",g,!1))};h.addEventListener("mousemove",c,!0);h.addEventListener("mouseup",g,!1)}},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==
-typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return c});h=a(1);var n=a(8),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,
-d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),b=function g(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return g(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a(287);var c=function(a){function c(a,b){var d=void 0===b?{}:b;b=void 0===d.min?0:d.min;var g=void 0===d.max?1:d.max;d=void 0===d.step?.01:d.step;if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");
-var k=q(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));k.value=a;k.element=document.createElement("label");k.promptElement=document.createElement("span");k.inputElement=document.createElement("input");var l=k.element,f=k.promptElement,t=k.inputElement;l.className="range-slider";f.className="range-prompt";t.type="range";t.min=""+b;t.max=""+g;t.step=""+d;t.valueAsNumber=k.value.value;l.appendChild(f);l.appendChild(t);var h=function(){k.value.value=k.inputElement.valueAsNumber};k.registerEventListener(t,
-"change",h);k.registerEventListener(t,"input",h);k.registerEventListener(t,"wheel",function(a){a=a.deltaY;0<a?(k.inputElement.stepUp(),h()):0>a&&(k.inputElement.stepDown(),h())});a.changed.add(function(){k.inputElement.valueAsNumber=k.value.value});return k}p(c,a);d(c,[{key:"disposed",value:function(){Object(n.b)(this.element);b(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(h.a)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
-}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a){a.addOutputBuffer("vec4",
-"v4f_fragData"+C.COLOR,C.COLOR);a.addOutputBuffer("vec4","v4f_fragData"+C.Z,C.Z);a.addOutputBuffer("vec4","v4f_fragData"+C.PICK,C.PICK);a.addFragmentCode(B)}function b(a){a.addOutputBuffer("vec4","v4f_fragData0",0);a.addOutputBuffer("vec4","v4f_fragData1",1);a.addFragmentCode(F)}function c(a){a.addOutputBuffer("vec4","v4f_fragColor",null);a.setFragmentMain("\nvec4 v0 = getValue0();\nvec4 v1 = getValue1();\nvec4 accum = vec4(v0.rgb, v1.r);\nfloat revealage = v0.a;\n\nv4f_fragColor = vec4(accum.rgb / accum.a, revealage);\n")}
-a.d(f,"a",function(){return C});f.c=d;f.d=b;a.d(f,"b",function(){return N});var e=a(144),g=a(18),l=a(145),k=a(310),t=a(59);h=a(146);var m=a(44),r=a(35),u=a(22),v=a(2),w=a(80),y=a(179);f=a(29);var x=a(99),A=a(21),z=a(53),D=a(15),E=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),G=function U(a,b,c){null===a&&
-(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return U(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a(45);a(311);var C;(function(a){a[a.COLOR=0]="COLOR";a[a.Z=1]="Z";a[a.PICK=2]="PICK";a[a.NUM_TEXTURES=3]="NUM_TEXTURES"})(C||(C={}));var B=[A.k,"\nvoid emit(vec4 color, vec4 pickId) {\n  v4f_fragData"+C.COLOR+" = color;\n  v4f_fragData"+C.Z+" = packFloat01ToFixedPoint(1.0 - gl_FragCoord.z);\n  v4f_fragData"+
-C.PICK+" = pickId;\n}\n"],F=["\nfloat computeOITWeight(float alpha) {\n  float a = min(1.0, alpha) * 8.0 + 0.01;\n  float b = -gl_FragCoord.z * 0.95 + 1.0;\n  return a * a * a * b * b * b;\n}\n","\nvoid emit(vec4 color, vec4 pickId) {\n  float weight = computeOITWeight(color.a);\n  vec4 accum = color * weight;\n  v4f_fragData0 = vec4(accum.rgb, color.a);\n  v4f_fragData1 = vec4(accum.a, 0.0, 0.0, 0.0);\n}\n"],L=v.s.create(),J=v.s.create(),O=v.u.create(),M=v.k.create(),P=function(a){function b(){q(this,
-b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);return b}(Object(f.c)(D.b)),N=function(a){function f(a,b,h){q(this,f);var n=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,a,b,h));n.sliceViews=function(){var a=new Map;return n.registerDisposer(new y.a(function(b,c){b=c.visibility.add(n.visibility);a.set(c,b);n.scheduleRedraw()},function(b,c){b=a.get(c);a.delete(c);b();c.dispose();n.scheduleRedraw()}))}();n.projectionMat=v.k.create();n.inverseProjectionMat=
-v.k.create();n.modelViewMat=v.k.create();n.width=0;n.height=0;n.pickIDs=new l.a;n.axesLineHelper=n.registerDisposer(e.a.get(n.gl));n.sliceViewRenderHelper=n.registerDisposer(m.d.get(n.gl,d));n.offscreenFramebuffer=n.registerDisposer(new x.b(n.gl,{colorBuffers:Object(x.e)(n.gl,C.NUM_TEXTURES),depthBuffer:new x.a(n.gl)}));n.offscreenCopyHelper=n.registerDisposer(x.c.get(n.gl));n.transparencyCopyHelper=n.registerDisposer(x.c.get(n.gl,c,2));n.scaleBarCopyHelper=n.registerDisposer(x.c.get(n.gl));n.scaleBarTexture=
-n.registerDisposer(new z.b(n.gl));n.nanometersPerPixel=1;n.registerDisposer(n.navigationState.changed.add(function(){n.viewportChanged()}));a=n.sharedObject=n.registerDisposer(new P);a.RPC_TYPE_ID=k.c;a.initializeCounterpart(h.rpc,{});a.visibility.add(n.visibility);n.visibleLayerTracker=Object(g.l)(n.viewer.layerManager,t.a,n.viewer.visibleLayerRoles,n,function(a){var b=a.backend;if(b)return b.rpc.invoke(k.a,{layer:b.rpcId,view:n.sharedObject.rpcId}),function(){b.rpc.invoke(k.b,{layer:b.rpcId,view:n.sharedObject.rpcId})}});
-Object(u.c)(b,"translate-via-mouse-drag",function(a){Object(w.a)(a.detail,function(a,b,c){a=n.width;var d=n.height,e=n.viewer.navigationState.position,g=e.spatialCoordinates;v.s.transformMat4(L,g,n.projectionMat);L[0]=2*b/a;L[1]=-2*c/d;v.s.transformMat4(g,L,n.inverseProjectionMat);e.changed.dispatch()})});Object(u.c)(b,"rotate-via-mouse-drag",function(a){Object(w.a)(a.detail,function(a,b,c){n.navigationState.pose.rotateRelative(v.e[1],-b/4*Math.PI/180);n.navigationState.pose.rotateRelative(v.e[0],
-c/4*Math.PI/180);n.viewer.navigationState.changed.dispatch()})});h.showSliceViewsCheckbox&&(b=n.registerDisposer(new r.c(h.showSliceViews)),b.element.className="perspective-panel-show-slice-views neuroglancer-noselect",a=document.createElement("label"),a.className="perspective-panel-show-slice-views neuroglancer-noselect",a.appendChild(document.createTextNode("Slices")),a.appendChild(b.element),n.element.appendChild(a));n.registerDisposer(h.orthographicProjection.changed.add(function(){return n.scheduleRedraw()}));
-n.registerDisposer(h.showScaleBar.changed.add(function(){return n.scheduleRedraw()}));n.registerDisposer(h.scaleBarOptions.changed.add(function(){return n.scheduleRedraw()}));n.registerDisposer(h.showSliceViews.changed.add(function(){return n.scheduleRedraw()}));n.registerDisposer(h.showAxisLines.changed.add(function(){return n.scheduleRedraw()}));n.registerDisposer(h.crossSectionBackgroundColor.changed.add(function(){return n.scheduleRedraw()}));return n}n(f,a);E(f,[{key:"isReady",value:function(){if(!this.visible)return!1;
-for(var a=$jscomp.makeIterator(this.sliceViews),b=a.next();!b.done;b=a.next()){b=$jscomp.makeIterator(b.value);var c=b.next().value;if((b.next().value||this.viewer.showSliceViews.value)&&!c.isReady())return!1}a=this.visibleLayerTracker.getVisibleLayers();a=$jscomp.makeIterator(a);for(b=a.next();!b.done;b=a.next())if(!b.value.isReady())return!1;return!0}},{key:"updateProjectionMatrix",value:function(){var a=this.projectionMat,b=this.width/this.height,c=Math.PI/4;this.viewer.orthographicProjection.value?
-(c=100/(1/Math.tan(c/2)),v.k.ortho(a,-b*c,b*c,-c,c,10,5E3),this.nanometersPerPixel=1/(2*a[0])*this.navigationState.zoomFactor.value,this.nanometersPerPixel=2*b*c/this.width*this.navigationState.zoomFactor.value):v.k.perspective(a,c,b,10,5E3);b=this.modelViewMat;this.navigationState.toMat4(b);v.s.set(L,1,-1,-1);v.k.scale(b,b,L);c=v.s.set(L,0,0,100);v.k.translate(b,b,c);v.k.invert(M,b);v.k.multiply(a,a,M);v.k.invert(this.inverseProjectionMat,a)}},{key:"viewportChanged",value:function(){this.context.scheduleRedraw()}},
-{key:"onResize",value:function(){var a=this.element,b=a.clientHeight;if(a.clientWidth!==this.width||b!==this.height)this.width=this.element.clientWidth,this.height=this.element.clientHeight,this.viewportChanged()}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.sliceViews.keys()),b=a.next();!b.done;b=a.next())b.value.dispose();this.sliceViews.clear();G(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}},{key:"updateMouseState",value:function(a){a.pickedRenderLayer=
-null;if(!this.navigationState.valid)return!1;var b=a.position,c=this.offscreenFramebuffer,d=this.width,e=this.height;if(!c.hasSize(d,e))return!1;var g=this.mouseX,k=e-this.mouseY,l=c.readPixel(C.Z,g,k);l=1-Object(A.s)(l);if(1===l)return!1;b[0]=2*g/d-1;b[1]=2*k/e-1;b[2]=2*l-1;v.s.transformMat4(b,b,this.inverseProjectionMat);this.pickIDs.setMouseState(a,c.readPixelAsUint32(C.PICK,g,k));return!0}},{key:"draw",value:function(){if(this.navigationState.valid){this.onResize();var a=this.width,c=this.height;
-if(0!==a&&0!==c){for(var e=this.viewer.showSliceViews.value,g=$jscomp.makeIterator(this.sliceViews),k=g.next();!k.done;k=g.next()){k=$jscomp.makeIterator(k.value);var l=k.next().value;(k.next().value||e)&&l.updateRendering()}e=this.gl;this.offscreenFramebuffer.bind(a,c);e.disable(e.SCISSOR_TEST);this.gl.clearColor(0,0,0,0);e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);e.enable(e.DEPTH_TEST);g=this.projectionMat;this.updateProjectionMatrix();k=v.s.create();Object(v.p)(k,v.e[2],this.modelViewMat);
-v.s.normalize(k,k);l=this.pickIDs;l.clear();g={dataToDevice:g,lightDirection:k,ambientLighting:.2,directionalLighting:.8,pickIDs:l,emitter:d,emitColor:!0,emitPickID:!0,alreadyEmittedPickID:!1,viewportWidth:a,viewportHeight:c};k=this.visibleLayerTracker.getVisibleLayers();var m=!1,r=!1,f=$jscomp.makeIterator(k);for(l=f.next();!l.done;l=f.next())l=l.value,l.isTransparent?m=!0:l.isAnnotation?r=!0:l.draw(g);this.drawSliceViews(g);if(r){e.enable(WebGL2RenderingContext.BLEND);e.depthFunc(WebGL2RenderingContext.LEQUAL);
-e.blendFunc(WebGL2RenderingContext.SRC_ALPHA,WebGL2RenderingContext.ONE_MINUS_SRC_ALPHA);e.drawBuffers([e.COLOR_ATTACHMENT0,e.NONE,e.NONE]);g.emitPickID=!1;r=$jscomp.makeIterator(k);for(l=r.next();!l.done;l=r.next())l=l.value,l.isAnnotation&&l.draw(g);e.depthFunc(WebGL2RenderingContext.LESS);e.disable(WebGL2RenderingContext.BLEND);e.drawBuffers([e.COLOR_ATTACHMENT0,e.COLOR_ATTACHMENT1,e.COLOR_ATTACHMENT2]);g.emitPickID=!0}this.viewer.showAxisLines.value&&this.drawAxisLines();if(m){e.depthMask(!1);
-e.enable(WebGL2RenderingContext.BLEND);m=this.transparentConfiguration;m.bind(a,c);this.gl.clearColor(0,0,0,1);e.clear(WebGL2RenderingContext.COLOR_BUFFER_BIT);g.emitter=b;e.blendFuncSeparate(WebGL2RenderingContext.ONE,WebGL2RenderingContext.ONE,WebGL2RenderingContext.ZERO,WebGL2RenderingContext.ONE_MINUS_SRC_ALPHA);g.emitPickID=!1;r=$jscomp.makeIterator(k);for(l=r.next();!l.done;l=r.next())l=l.value,l.isTransparent&&l.draw(g);e.disable(WebGL2RenderingContext.DEPTH_TEST);this.offscreenFramebuffer.bindSingle(C.COLOR);
-e.blendFunc(WebGL2RenderingContext.ONE_MINUS_SRC_ALPHA,WebGL2RenderingContext.SRC_ALPHA);this.transparencyCopyHelper.draw(m.colorBuffers[0].texture,m.colorBuffers[1].texture);e.depthMask(!0);e.disable(WebGL2RenderingContext.BLEND);e.enable(WebGL2RenderingContext.DEPTH_TEST);this.offscreenFramebuffer.bind(a,c)}e.drawBuffers([e.NONE,e.COLOR_ATTACHMENT1,e.COLOR_ATTACHMENT2]);g.emitter=d;g.emitPickID=!0;g.emitColor=!1;e.enable(WebGL2RenderingContext.POLYGON_OFFSET_FILL);e.polygonOffset(-1,-1);c=$jscomp.makeIterator(k);
-for(l=c.next();!l.done;l=c.next())k=l.value,g.alreadyEmittedPickID=!k.isTransparent&&!k.isAnnotation,k.draw(g);e.disable(WebGL2RenderingContext.POLYGON_OFFSET_FILL);this.viewer.showScaleBar.value&&this.viewer.orthographicProjection.value&&(e.drawBuffers([e.COLOR_ATTACHMENT0]),e.disable(WebGL2RenderingContext.DEPTH_TEST),e.enable(WebGL2RenderingContext.BLEND),e.blendFunc(WebGL2RenderingContext.SRC_ALPHA,WebGL2RenderingContext.ONE_MINUS_SRC_ALPHA),c=this.scaleBarTexture,g=this.viewer.scaleBarOptions.value,
-k=c.dimensions,k.targetLengthInPixels=Math.min(g.maxWidthFraction*a,g.maxWidthInPixels*g.scaleFactor),k.nanometersPerPixel=this.nanometersPerPixel,c.update(g),e.viewport(g.leftPixelOffset*g.scaleFactor,g.bottomPixelOffset*g.scaleFactor,c.width,c.height),this.scaleBarCopyHelper.draw(c.texture),e.disable(WebGL2RenderingContext.BLEND));this.offscreenFramebuffer.unbind();this.setGLViewport();this.offscreenCopyHelper.draw(this.offscreenFramebuffer.colorBuffers[C.COLOR].texture)}}}},{key:"drawSliceViews",
-value:function(a){var b=this.sliceViewRenderHelper,c=a.lightDirection,d=a.ambientLighting,e=a.directionalLighting;a=a.dataToDevice;for(var g=this.viewer.showSliceViews.value,k=$jscomp.makeIterator(this.sliceViews),l=k.next();!l.done;l=k.next()){var m=$jscomp.makeIterator(l.value);l=m.next().value;if((m.next().value||g)&&0!==l.width&&0!==l.height&&l.hasValidViewport){m=Math.abs(v.s.dot(c,l.viewportAxes[2]));m=d+m*e;var r=M;v.k.identity(r);r[0]=l.width/2;r[5]=-l.height/2;v.k.multiply(r,l.viewportToData,
-r);v.k.multiply(r,a,r);var f=O,t=this.viewer.crossSectionBackgroundColor.value;f[0]=t[0];f[1]=t[1];f[2]=t[2];f[3]=1;b.draw(l.offscreenFramebuffer.colorBuffers[0].texture,r,v.u.fromValues(m,m,m,1),O,0,0,1,1)}}}},{key:"drawAxisLines",value:function(){var a=this.viewer.navigationState.position.spatialCoordinates;v.s.transformMat4(L,a,this.projectionMat);L[0]=.5;v.s.transformMat4(J,L,this.inverseProjectionMat);var b=v.s.distance(J,a);L[0]=0;L[1]=.5;v.s.transformMat4(J,L,this.inverseProjectionMat);var c=
-v.s.distance(J,a);a=this.gl;v.k.identity(M);b=Math.min(b,c);M[0]=b;M[5]=b;M[10]=b;b=this.navigationState.position.spatialCoordinates;M[12]=b[0];M[13]=b[1];M[14]=b[2];M[15]=1;v.k.multiply(M,this.projectionMat,M);a.drawBuffers([a.COLOR_ATTACHMENT0]);this.axesLineHelper.draw(M,!1)}},{key:"zoomByMouse",value:function(a){this.navigationState.zoomBy(a)}},{key:"navigationState",get:function(){return this.viewer.navigationState}},{key:"transparentConfiguration",get:function(){var a=this.transparentConfiguration_;
-void 0===a&&(a=this.transparentConfiguration_=this.registerDisposer(new x.b(this.gl,{colorBuffers:Object(x.e)(this.gl,2,this.gl.RGBA32F,this.gl.RGBA,this.gl.FLOAT),depthBuffer:this.offscreenFramebuffer.depthBuffer.addRef()})));return a}}]);return f}(h.a)},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function d(a,b){b=void 0===b?a.navigationState:new w.e(new w.g(a.navigationState.pose.position,w.f.makeRelative(a.navigationState.pose.orientation,b)),a.navigationState.zoomFactor);return new x.a(a.chunkManager,a.layerManager,
-b)}function b(a){return new Map([["xy",d(a,P.get("xy"))],["xz",d(a,P.get("xz"))],["yz",d(a,P.get("yz"))]])}function c(a){return{crossSectionBackgroundColor:a.crossSectionBackgroundColor,mouseState:a.mouseState,layerManager:a.layerManager,showAxisLines:a.showAxisLines,visibleLayerRoles:a.visibleLayerRoles,selectedLayer:a.selectedLayer,visibility:a.visibility,scaleBarOptions:a.scaleBarOptions}}function e(a){var b=a.viewer;return Object.assign({},c(b),{navigationState:b.perspectiveNavigationState,inputEventMap:b.inputEventBindings.perspectiveView,
-orthographicProjection:a.specification.orthographicProjection,showScaleBar:b.showScaleBar,rpc:b.chunkManager.rpc})}function g(a){return Object.assign({},c(a),{navigationState:a.navigationState,inputEventMap:a.inputEventBindings.sliceView})}function l(a,b,c){for(var d={},e=0;2>e;d={relatedLayout:d.relatedLayout},++e)d.relatedLayout=c[Math.min(c.length-1,e)],a.registerDisposer(Object(G.c)(b.element,0===e?"toggle-layout":"toggle-layout-alternative",function(b){return function(c){a.container.name=b.relatedLayout;
-c.stopPropagation()}}(d)))}function k(a,b){var c=new x.a(a.chunkManager,a.layerManager,b.navigationState.addRef());a=function(){c.setViewportSizeDebounced(b.width.value,b.height.value)};c.registerDisposer(b.width.changed.add(a));c.registerDisposer(b.height.changed.add(a));a();return c}function t(a,b,c){var d=new Map,e=new Set;c=$jscomp.makeIterator(c.values());for(var g=c.next();!g.done;g=c.next())if(g=g.value,e.add(g),!d.has(g)){var l=k(a,g);b.sliceViews.set(l,!0);d.set(g,l)}a=$jscomp.makeIterator(d);
-for(d=a.next();!d.done;d=a.next())c=$jscomp.makeIterator(d.value),d=c.next().value,c=c.next().value,e.has(d)||b.sliceViews.delete(c)}function m(a){var b=H.get(a);if(void 0===b)throw Error("Invalid layout name: "+JSON.stringify(a)+".");return b}function r(a){m(a);return a}a.d(f,"b",function(){return M});f.d=c;a.d(f,"a",function(){return ka});h=a(10);var u=a.n(h),v=a(184),w=a(57),y=a(82),x=a(44),A=a(60),z=a(35),D=a(9);h=a(1);var E=a(8),G=a(22),C=a(2),B=a(4),F=a(7),L=a(179),J=function(){function a(a,
-b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),O=function R(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return R(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a(84);var M=function X(){n(this,X);this.perspectiveView=
-new G.a;this.sliceView=new G.a},P=new Map([["xy",void 0],["xz",C.n.rotateX(C.n.create(),C.n.create(),Math.PI/2)],["yz",C.n.rotateY(C.n.create(),C.n.create(),Math.PI/2)]]),N=function(a){function c(a,d,k,m){n(this,c);var r=q(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));r.container=a;r.rootElement=d;r.viewer=k;var f=b(k),u=k.display,h=Object.assign({},e(a),{showSliceViews:k.showPerspectiveSliceViews,showSliceViewsCheckbox:!0}),w=Object.assign({},g(k),{showScaleBar:k.showScaleBar}),p=Object.assign({},
-g(k),{showScaleBar:new z.b(!1,!1)}),x=function(a,b,c){b=r.registerDisposer(new A.a(u,b,f.get(a),c));l(r,b,[a,a+"-3d"]);return b};a=[v.b(1,v.a("column",[v.b(1,v.a("row",[v.b(1,function(a){x("xy",a,w)}),v.b(1,function(a){x("xz",a,p)})])),v.b(1,v.a("row",[v.b(1,function(a){a=r.registerDisposer(new y.b(u,a,h));for(var b=$jscomp.makeIterator(f.values()),c=b.next();!c.done;c=b.next())a.sliceViews.set(c.value.addRef(),!1);t(k,a,m);l(r,a,["3d"])}),v.b(1,function(a){x("yz",a,p)})]))]))];v.a("row",a)(d);u.onResize();
-return r}p(c,a);J(c,[{key:"disposed",value:function(){Object(E.a)(this.rootElement);O(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(h.a),S=function(a){function b(a,c,k,m,r,f){n(this,b);var u=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));u.container=a;u.rootElement=c;u.viewer=k;u.direction=m;var h=d(k,P.get(r)),w=k.display,p=Object.assign({},e(a),{showSliceViews:k.showPerspectiveSliceViews,showSliceViewsCheckbox:!0}),x=Object.assign({},
-g(k),{showScaleBar:k.showScaleBar});v.b(1,v.a(m,[v.b(1,function(a){a=u.registerDisposer(new A.a(w,a,h,x));l(u,a,[r,"4panel"])}),v.b(1,function(a){a=u.registerDisposer(new y.b(w,a,p));a.sliceViews.set(h.addRef(),!1);t(k,a,f);l(u,a,["3d","4panel"])})]))(c);w.onResize();return u}p(b,a);J(b,[{key:"disposed",value:function(){Object(E.a)(this.rootElement);O(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}}]);return b}(h.a),U=function(a){function b(a,c,e,k){n(this,b);
-var m=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));m.container=a;m.rootElement=c;m.viewer=e;var r=d(e,P.get(k)),f=Object.assign({},g(e),{showScaleBar:e.showScaleBar});v.a("row",[v.b(1,function(a){a=m.registerDisposer(new A.a(e.display,a,r,f));l(m,a,["4panel",k+"-3d"])})])(c);e.display.onResize();return m}p(b,a);J(b,[{key:"disposed",value:function(){Object(E.a)(this.rootElement);O(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}}]);return b}(h.a),
-Z=function(a){function b(a,c,d,g){n(this,b);var k=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));k.container=a;k.rootElement=c;k.viewer=d;var m=Object.assign({},e(a),{showSliceViews:new z.b(!1,!1)});v.a("row",[v.b(1,function(a){a=k.registerDisposer(new y.b(d.display,a,m));t(d,a,g);l(k,a,["4panel"])})])(c);d.display.onResize();return k}p(b,a);J(b,[{key:"disposed",value:function(){Object(E.a)(this.rootElement);O(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}}]);
-return b}(h.a),H=new Map([["4panel",{factory:function(a,b,c,d){return new N(a,b,c,d)}}],["3d",{factory:function(a,b,c,d){return new Z(a,b,c,d)}}]]);f.c=H;f={};a=$jscomp.makeIterator(P.keys());for(C=a.next();!C.done;f={axes:f.axes},C=a.next())f.axes=C.value,H.set(f.axes,{factory:function(a){return function(b,c,d){return new U(b,c,d,a.axes)}}(f)}),H.set(f.axes+"-3d",{factory:function(a){return function(b,c,d,e){return new S(b,c,d,"row",a.axes,e)}}(f)});var Q=function(a){function b(a){n(this,b);var c=
-q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.width=new D.c(1E3,B.z);c.height=new D.c(1E3,B.z);c.changed=new F.a;c.position=new w.b(a.position.addRef());c.position.changed.add(c.changed.dispatch);c.orientation=new w.a(a.pose.orientation.addRef());c.orientation.changed.add(c.changed.dispatch);c.width.changed.add(c.changed.dispatch);c.height.changed.add(c.changed.dispatch);c.zoom=new w.c(a.zoomFactor.addRef());c.zoom.changed.add(c.changed.dispatch);c.navigationState=c.registerDisposer(new w.e(new w.g(c.position.value,
-c.orientation.value),c.zoom.value));return c}p(b,a);J(b,[{key:"restoreState",value:function(a){var b=this;Object(B.t)(a);Object(B.v)(a,"width",function(a){return void 0!==a&&b.width.restoreState(a)});Object(B.v)(a,"height",function(a){return void 0!==a&&b.height.restoreState(a)});Object(B.v)(a,"position",function(a){return void 0!==a&&b.position.restoreState(a)});Object(B.v)(a,"orientation",function(a){return void 0!==a&&b.orientation.restoreState(a)});Object(B.v)(a,"zoom",function(a){return void 0!==
-a&&b.zoom.restoreState(a)})}},{key:"reset",value:function(){this.width.reset();this.height.reset();this.position.reset();this.orientation.reset();this.zoom.reset()}},{key:"toJSON",value:function(){return{width:this.width,height:this.height,position:this.position,orientation:this.orientation,zoom:this.zoom}}}]);return b}(h.a),aa=function(a){function b(a){n(this,b);var c=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,function(a){return c.registerDisposer(c.registerDisposer(a).changed.add(c.changed.dispatch))},
-function(a){a.changed.remove(c.changed.dispatch);a.dispose()}));c.parentNavigationState=a;c.registerDisposer(a);return c}p(b,a);J(b,[{key:"restoreState",value:function(a){Object(B.t)(a);for(var b=$jscomp.makeIterator(Object.keys(a)),c=b.next();!c.done;c=b.next()){c=c.value;var d=new Q(this.parentNavigationState);try{this.set(c,d.addRef()),d.restoreState(a[c])}finally{d.dispose()}}}},{key:"reset",value:function(){this.clear()}},{key:"toJSON",value:function(){for(var a={},b=$jscomp.makeIterator(this),
-c=b.next();!c.done;c=b.next()){var d=$jscomp.makeIterator(c.value);c=d.next().value;d=d.next().value;a[c]=d}return a}}]);return b}(L.a),ba=function(a){function b(a,c){n(this,b);var d=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.changed=new F.a;d.orthographicProjection=new z.b(!1);d.type=new D.c(c,r);d.type.changed.add(d.changed.dispatch);d.crossSections=d.registerDisposer(new aa(a));d.crossSections.changed.add(d.changed.dispatch);d.orthographicProjection.changed.add(d.changed.dispatch);
-d.registerDisposer(a);return d}p(b,a);J(b,[{key:"reset",value:function(){this.crossSections.clear();this.orthographicProjection.reset();this.type.reset()}},{key:"restoreState",value:function(a){var b=this;this.crossSections.clear();this.orthographicProjection.reset();"string"===typeof a?this.type.restoreState(a):(Object(B.t)(a),Object(B.v)(a,"type",function(a){return b.type.restoreState(a)}),Object(B.v)(a,"orthographicProjection",function(a){return b.orthographicProjection.restoreState(a)}),Object(B.v)(a,
-"crossSections",function(a){return void 0!==a&&b.crossSections.restoreState(a)}))}},{key:"toJSON",value:function(){var a=this.type,b=this.crossSections,c=this.orthographicProjection.toJSON();return 0===b.size&&void 0===c?a.value:{type:a.value,crossSections:b,orthographicProjection:c}}}]);return b}(h.a),ka=function(a){function b(a,c){n(this,b);var d=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.viewer=a;d.element=document.createElement("div");d.specification=d.registerDisposer(new ba(d.viewer.navigationState.addRef(),
-c));d.element.style.flex="1";var e=d.registerCancellable(u()(function(){return d.updateLayout()},0));d.specification.type.changed.add(e);Object(G.c)(d.element,"toggle-orthographic-projection",function(){return d.specification.orthographicProjection.toggle()});d.registerDisposer(d.viewer.display.updateStarted.add(function(){return e.flush()}));e();return d}p(b,a);J(b,[{key:"toJSON",value:function(){return this.specification.toJSON()}},{key:"restoreState",value:function(a){this.specification.restoreState(a)}},
-{key:"reset",value:function(){this.specification.reset()}},{key:"disposeLayout",value:function(){var a=this.layout;void 0!==a&&(a.dispose(),this.layout=void 0)}},{key:"updateLayout",value:function(){this.disposeLayout();this.layout=m(this.name).factory(this,this.element,this.viewer,this.specification.crossSections)}},{key:"disposed",value:function(){this.disposeLayout();O(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"name",get:function(){return this.specification.type.value},
-set:function(a){this.specification.type.value=a}},{key:"changed",get:function(){return this.specification.changed}}]);return b}(h.a)},function(h,f){},function(h,f,a){f.isFunction=function(a){return"function"===typeof a}},function(h,f,a){h=a(16).root.Symbol;f.rxSubscriber="function"===typeof h&&"function"===typeof h.for?h.for("rxSubscriber"):"@@rxSubscriber";f.$$rxSubscriber=f.rxSubscriber},function(h,f,a){function q(a){var f=a.Symbol;"function"===typeof f?f.observable?a=f.observable:(a=f("observable"),
-f.observable=a):a="@@observable";return a}h=a(16);f.getSymbolObservable=q;f.observable=q(h.root);f.$$observable=f.observable},function(h,f,a){var q=this&&this.__extends||function(a,f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(){var d=a.call(this,"object unsubscribed");this.name=d.name="ObjectUnsubscribedError";this.stack=d.stack;this.message=d.message}q(f,a);return f}(Error);
-f.ObjectUnsubscribedError=h},function(h,f,a){var q=this&&this.__extends||function(a,d){function b(){this.constructor=a}for(var c in d)d.hasOwnProperty(c)&&(a[c]=d[c]);a.prototype=null===d?Object.create(d):(b.prototype=d.prototype,new b)};h=a(12);var p=a(11);a=function(a){function d(){a.apply(this,arguments);this.value=null;this.hasCompleted=this.hasNext=!1}q(d,a);d.prototype._subscribe=function(b){return this.hasError?(b.error(this.thrownError),p.Subscription.EMPTY):this.hasCompleted&&this.hasNext?
-(b.next(this.value),b.complete(),p.Subscription.EMPTY):a.prototype._subscribe.call(this,b)};d.prototype.next=function(a){this.hasCompleted||(this.value=a,this.hasNext=!0)};d.prototype.error=function(b){this.hasCompleted||a.prototype.error.call(this,b)};d.prototype.complete=function(){this.hasCompleted=!0;this.hasNext&&a.prototype.next.call(this,this.value);a.prototype.complete.call(this)};return d}(h.Subject);f.AsyncSubject=a},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=
-a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(5);var p=a(6);f.mergeAll=function(a){void 0===a&&(a=Number.POSITIVE_INFINITY);return this.lift(new n(a))};var n=function(){function a(a){this.concurrent=a}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.concurrent))};return a}();f.MergeAllOperator=n;var d=function(a){function b(b,c){a.call(this,b);this.concurrent=c;this.hasCompleted=!1;this.buffer=[];this.active=
-0}q(b,a);b.prototype._next=function(a){this.active<this.concurrent?(this.active++,this.add(p.subscribeToResult(this,a))):this.buffer.push(a)};b.prototype._complete=function(){this.hasCompleted=!0;0===this.active&&0===this.buffer.length&&this.destination.complete()};b.prototype.notifyComplete=function(a){var b=this.buffer;this.remove(a);this.active--;0<b.length?this._next(b.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()};return b}(h.OuterSubscriber);f.MergeAllSubscriber=d},
-function(h,f,a){var q=a(36);f.isNumeric=function(a){return!q.isArray(a)&&0<=a-parseFloat(a)+1}},function(h,f,a){f.isDate=function(a){return a instanceof Date&&!isNaN(+a)}},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(12);var p=a(208),n=a(11),d=a(127),b=a(88),c=a(198);a=function(a){function g(b,c,d){void 0===b&&(b=Number.POSITIVE_INFINITY);
-void 0===c&&(c=Number.POSITIVE_INFINITY);a.call(this);this.scheduler=d;this._events=[];this._bufferSize=1>b?1:b;this._windowTime=1>c?1:c}q(g,a);g.prototype.next=function(b){var c=this._getNow();this._events.push(new e(c,b));this._trimBufferThenGetEvents();a.prototype.next.call(this,b)};g.prototype._subscribe=function(a){var e=this._trimBufferThenGetEvents(),g=this.scheduler;if(this.closed)throw new b.ObjectUnsubscribedError;if(this.hasError)var k=n.Subscription.EMPTY;else this.isStopped?k=n.Subscription.EMPTY:
-(this.observers.push(a),k=new c.SubjectSubscription(this,a));g&&a.add(a=new d.ObserveOnSubscriber(a,g));g=e.length;for(var l=0;l<g&&!a.closed;l++)a.next(e[l].value);this.hasError?a.error(this.thrownError):this.isStopped&&a.complete();return k};g.prototype._getNow=function(){return(this.scheduler||p.queue).now()};g.prototype._trimBufferThenGetEvents=function(){for(var a=this._getNow(),b=this._bufferSize,c=this._windowTime,d=this._events,e=d.length,g=0;g<e&&!(a-d[g].time<c);)g++;e>b&&(g=Math.max(g,
-e-b));0<g&&d.splice(0,g);return d};return g}(h.Subject);f.ReplaySubject=a;var e=function(){return function(a,b){this.time=a;this.value=b}}()},function(h,f,a){var q=this&&this.__extends||function(a,f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(){var d=a.call(this,"no elements in sequence");this.name=d.name="EmptyError";this.stack=d.stack;this.message=d.message}q(f,a);
-return f}(Error);f.EmptyError=h},function(h,f,a){function q(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}a.d(f,"k",function(){return p});h=a(39);f.d="annotation.MetadataChunkSource";f.c="annotation.GeometryChunkSource";f.j="annotation.SubsetGeometryChunkSource";
-f.f="annotation.reference.add";f.g="annotation.reference.delete";f.b="annotation.commit";f.a="annotation.commit";var p=function(a){function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var a=(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}q(d,a);return d}(h.i);f.e="annotation/PerspectiveRenderLayer";
-f.h="annotation/RenderLayer";f.i="annotation/RenderLayer.updateSegmentation"},function(h,f){h.exports=function(a){var f=typeof a;return null!=a&&("object"==f||"function"==f)}},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=
-Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function d(a,b){var c=b.type,d=a.typeToIds[c],g=Object(e.g)(c),k=g.serializedBytes,r=Object(l.b)(c),f=Object(m.a)(d,b.id,function(a,b){return a<b?-1:a===b?0:1}),t=0;if(0>f){f=~f;d.splice(f,0,b.id);var u=new Uint8Array(a.data.length+k);a.numPickIds+=
-r.pickIdsPerInstance;t=a.typeToOffset[c]+k*f;u.set(a.data.subarray(0,t),0);u.set(a.data.subarray(t),t+k);a.data=u}else t=a.typeToOffset[c]+g.serializedBytes*f;g.serializer(a.data.buffer,a.typeToOffset[c],d.length)(b,f);b=$jscomp.makeIterator(e.e);for(d=b.next();!d.done;d=b.next())d=d.value,d>c&&(a.typeToOffset[d]+=k);a.bufferValid=!1}function b(a,b,c){var d=a.typeToIds[b],g=Object(l.b)(b),k=g.bytes;c=Object(m.a)(d,c,function(a,b){return a<b?-1:a===b?0:1});if(0>c)return!1;a.numPickIds-=g.pickIdsPerInstance;
-d.splice(c,1);d=a.typeToOffset[b]+g.bytes*c;g=new Uint8Array(a.data.length-k);g.set(a.data.subarray(0,d),0);g.set(a.data.subarray(d+k),d);a.data=g;d=$jscomp.makeIterator(e.e);for(g=d.next();!g.done;g=d.next())g=g.value,g>b&&(a.typeToOffset[g]-=k);a.bufferValid=!1;return!0}function c(){for(var a=[],b=[],c=$jscomp.makeIterator(e.e),d=c.next();!d.done;d=c.next())d=d.value,a[d]=[],b[d]=0;return new D(void 0,{data:new Uint8Array(0),numPickIds:0,typeToOffset:b,typeToIds:a})}a.d(f,"b",function(){return F});
-a.d(f,"a",function(){return L});var e=a(28),g=a(95),l=a(51);h=a(24);f=a(44);var k=a(76),t=a(31),m=a(43),r=a(2),u=a(7),v=a(15),w=a(78),y=function O(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return O(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},x=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in
-d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();a=this&&this.__decorate||function(a,b,c,d){var e=arguments.length,g=3>e?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,k;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)g=Reflect.decorate(a,b,c,d);else for(var l=a.length-1;0<=l;l--)if(k=a[l])g=(3>e?k(g):3<e?k(b,c,g):k(b,c))||g;return 3<e&&g&&Object.defineProperty(b,c,g),g};var A=function(){function a(b){n(this,
-a);this.bufferValid=!1;this.data=b.data;for(var c=this.typeToIds=b.typeToIds,d=0,g=$jscomp.makeIterator(e.e),k=g.next();!k.done;k=g.next())k=k.value,d+=Object(l.b)(k).pickIdsPerInstance*c[k].length;this.numPickIds=d;this.typeToOffset=b.typeToOffset}x(a,[{key:"freeGPUMemory",value:function(a){a;a=this.buffer;void 0!==a&&(a.dispose(),this.bufferValid=!1,this.buffer=void 0)}}]);return a}(),z=function(a){function b(a,c){n(this,b);a=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));a.data=new A(c);
-return a}p(b,a);x(b,[{key:"freeGPUMemory",value:function(a){y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"freeGPUMemory",this).call(this,a);this.data.freeGPUMemory(a)}},{key:"dispose",value:function(){this.data=void 0}}]);return b}(h.b),D=function(a){function b(a,c){n(this,b);a=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));a.data=new A(c);return a}p(b,a);x(b,[{key:"freeGPUMemory",value:function(a){y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"freeGPUMemory",
-this).call(this,a);this.data.freeGPUMemory(a)}},{key:"dispose",value:function(){this.data=void 0}}]);return b}(f.b),E=function(a){function b(a,c){n(this,b);a=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));a.immediateChunkUpdates=!0;a.parent=c.parent;a.parameters=c.parameters;a.spec=c.spec;return a}p(b,a);x(b,[{key:"initializeCounterpart",value:function(a,c){c.parameters=this.parameters;c.parent=this.parent.rpcId;y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initializeCounterpart",
-this).call(this,a,c)}},{key:"addChunk",value:function(a,c){y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"addChunk",this).call(this,a,c)}},{key:"getChunk",value:function(a){return new D(this,a)}}]);return b}(f.c);E=a([Object(v.g)(g.c)],E);var G=function(a){function b(a,c){n(this,b);a=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,{}));a.parent=c;a.immediateChunkUpdates=!0;return a}p(b,a);x(b,[{key:"initializeCounterpart",value:function(a,c){c.parent=this.parent.rpcId;y(b.prototype.__proto__||
-Object.getPrototypeOf(b.prototype),"initializeCounterpart",this).call(this,a,c)}},{key:"addChunk",value:function(a,c){y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"addChunk",this).call(this,a,c)}},{key:"getChunk",value:function(a){return new z(this,a)}}]);return b}(h.e);G=a([Object(v.g)(g.j)],G);var C=function(a){function b(a,c){n(this,b);a=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));a.annotation=Object(e.f)(c.annotation);return a}p(b,a);return b}(h.b),B=function(a){function b(a,
-c){n(this,b);a=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));a.parent=c;return a}p(b,a);x(b,[{key:"getChunk",value:function(a){return new C(this,a)}},{key:"addChunk",value:function(a,c){y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"addChunk",this).call(this,a,c);a=this.parent.references.get(a);void 0!==a&&(a.value=c.annotation,a.changed.dispatch())}},{key:"deleteChunk",value:function(a){a=this.parent.references.get(a);void 0!==a&&(a.value=void 0,a.changed.dispatch())}},
-{key:"initializeCounterpart",value:function(a,c){c.parent=this.parent.rpcId;y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initializeCounterpart",this).call(this,a,c)}}]);return b}(h.e);B=a([Object(v.g)(g.d)],B);var F=function(a){function k(a,b){n(this,k);var d=q(this,(k.__proto__||Object.getPrototypeOf(k)).call(this));d.chunkManager=a;d.metadataChunkSource=d.registerDisposer(new B(d.chunkManager,d));d.objectToLocal=r.k.create();d.temporary=c();d.references=new Map;d.localUpdates=new Map;
-d.numCommitsInProgress=0;d.changed=new u.a;d.readonly=!1;d.sources=b.sourceSpecifications.map(function(b){return b.map(function(b){return d.registerDisposer(new E(a,{spec:b.spec,parameters:b.parameters,parent:d}))})});d.segmentFilteredSource=d.registerDisposer(new G(a,d));return d}p(k,a);$jscomp.initSymbol();$jscomp.initSymbolIterator();x(k,[{key:"getSources",value:function(a){a=this.sources;a.forEach(function(a){return a.forEach(function(a){return a.addRef()})});return a}},{key:"initializeCounterpart",
-value:function(a,b){this.metadataChunkSource.initializeCounterpart(a,{});for(var c=$jscomp.makeIterator(this.sources),d=c.next();!d.done;d=c.next()){d=$jscomp.makeIterator(d.value);for(var e=d.next();!e.done;e=d.next())e.value.initializeCounterpart(a,{})}this.segmentFilteredSource.initializeCounterpart(a,{});b.segmentFilteredSource=this.segmentFilteredSource.addCounterpartRef();b.metadataChunkSource=this.metadataChunkSource.addCounterpartRef();b.sources=this.sources.map(function(a){return a.map(function(a){return a.addCounterpartRef()})});
-b.chunkManager=this.chunkManager.rpcId;y(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"initializeCounterpart",this).call(this,a,b)}},{key:"add",value:function(a,b){var c=this;b=void 0===b?!0:b;a.id=Object(e.h)();var d=new e.a(a.id);d.value=a;this.references.set(d.id,d);d.registerDisposer(function(){c.references.delete(d.id)});this.applyLocalUpdate(d,!1,b,a);return d}},{key:"applyLocalUpdate",value:function(a,c,e,g){var k=this.localUpdates,l=a.id,m=this.localUpdates.get(l),r=a.value;if(null==
-r)throw Error("Cannot create local update from null annotation");void 0===m?(m={type:r.type,reference:a.addRef(),existingAnnotation:c?r:void 0,pendingCommit:void 0,commitInProgress:void 0},k.set(l,m),this.forEachPossibleChunk(r,function(a){b(a.data,r.type,l)}),null!==g&&d(this.temporary.data,g)):(null===g?b(this.temporary.data,r.type,r.id):d(this.temporary.data,g),a.value=g);if(e)if(void 0!==m.commitInProgress)m.pendingCommit=g;else{if(null===g&&void 0===m.existingAnnotation){k.delete(l);m.reference.dispose();
-return}this.sendCommitRequest(m,g)}this.notifyChanged(a.id,g||void 0)}},{key:"sendCommitRequest",value:function(a,b){this.updateCommitsInProgress(1);a.commitInProgress=b;this.rpc.invoke(g.b,{id:this.rpcId,annotationId:a.existingAnnotation&&a.reference.id,newAnnotation:b})}},{key:"delete",value:function(a){this.applyLocalUpdate(a,!0,!0,null)}},{key:"update",value:function(a,b){this.applyLocalUpdate(a,!0,!1,b)}},{key:"notifyChanged",value:function(a,b){var c=this.references.get(a);a=this.metadataChunkSource.chunks.get(a);
-void 0!==a&&(a.annotation=b||null);void 0!==c&&(c.value=b||null,c.changed.dispatch());this.chunkManager.chunkQueueManager.visibleChunksChanged.dispatch()}},{key:"commit",value:function(a){this.applyLocalUpdate(a,!0,!0,a.value)}},{key:"getReference",value:function(a){var b=this,c=this.references.get(a);if(void 0!==c)return c.addRef();c=new e.a(a);this.references.set(a,c);this.rpc.invoke(g.f,{id:this.rpcId,annotation:a});c.registerDisposer(function(){b.references.delete(a);b.rpc.invoke(g.g,{id:b.rpcId,
-annotation:a})});var d=this.metadataChunkSource.chunks.get(a);void 0!==d&&(c.value=d.annotation);return c}},{key:"forEachPossibleChunk",value:function(a,b){var c=this.sources;if(1!==c.length||1!==c[0].length)throw Error("Not implemented");c=c[0][0];if(1<c.chunks.size)throw Error("Not implemented");a;c=$jscomp.makeIterator(c.chunks.values());for(var d=c.next();!d.done;d=c.next())b(d.value);c=a.segments;if(void 0!==c&&0!==c.length)for(a=this.segmentFilteredSource,c=$jscomp.makeIterator(c),d=c.next();!d.done;d=
-c.next())d=a.chunks.get(Object(w.b)(d.value)),void 0!==d&&b(d)}},{key:"handleSuccessfulUpdate",value:function(a,c){var e=this.localUpdates.get(a);if(void 0===e||void 0===e.commitInProgress)throw Error("Received invalid successful update notification");this.updateCommitsInProgress(-1);if(null!==c&&e.reference.id!==c.id){if(null===e.commitInProgress)throw Error("Received invalid successful update notification");e.reference.id=c.id;this.references.delete(a);this.references.set(c.id,e.reference);this.localUpdates.delete(a);
-this.localUpdates.set(c.id,e);null!==e.reference.value&&(e.reference.value.id=c.id,b(this.temporary.data,e.type,a),d(this.temporary.data,e.reference.value));e.reference.changed.dispatch()}e.existingAnnotation=c||void 0;e.commitInProgress=void 0;a=e.pendingCommit;e.pendingCommit=void 0;null===c&&(a=void 0);void 0!==a?(null!==a&&(a.id=c.id),this.sendCommitRequest(e,a)):this.revertLocalUpdate(e)}},{key:"disposed",value:function(){var a=this.commitStatus;void 0!==a&&a.dispose()}},{key:"updateCommitsInProgress",
-value:function(a){this.numCommitsInProgress+=a;0===this.numCommitsInProgress?void 0!==this.commitStatus&&(this.commitStatus.dispose(),this.commitStatus=void 0):void 0===this.commitStatus&&(this.commitStatus=new t.a(!0)).setText("Commiting annotations")}},{key:"handleFailedUpdate",value:function(a,b){a=this.localUpdates.get(a);if(void 0===a||void 0===a.commitInProgress)throw Error("Received invalid update notification");(new t.a).setErrorMessage("Error commiting annotation update: "+b);this.revertLocalUpdate(a);
-this.updateCommitsInProgress(-1)}},{key:"revertLocalUpdate",value:function(a){b(this.temporary.data,a.type,a.reference.id);var c=a.existingAnnotation;void 0!==c&&this.forEachPossibleChunk(c,function(a){d(a.data,c)});a=a.reference;var e=a.id;a.value=c||null;a.changed.dispatch();a.dispose();this.localUpdates.delete(e)}},{key:Symbol.iterator,value:function(){function a(a,c){for(;;)switch(b){case 0:b=-1;default:return{value:void 0,done:!0}}}var b=0,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:"encodeOptions",value:function(a){return{}}}]);return k}(v.b);Object(v.e)(g.a,function(a){var b=this.get(a.id),c=a.annotationId,d=a.error;void 0!==d?b.handleFailedUpdate(c,d):(a=Object(e.f)(a.newAnnotation),b.handleSuccessfulUpdate(c,a))});var L=function(a){function b(a){n(this,b);return q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a.chunkManager,
-a.getSources({})))}p(b,a);x(b,[{key:"draw",value:function(){}}]);return b}(k.a)},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
-}a.d(f,"a",function(){return e});a.d(f,"b",function(){return g});var n=a(1),d=a(4),b=function k(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return k(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,
-d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),e=function(){function a(){p(this,a);this.map=new Map}c(a,[{key:"get",value:function(a,b){var c=this.map,d=c.get(a);void 0===d?(d=b(),d.registerDisposer(function(){c.delete(a)}),c.set(a,d)):d.addRef();return d}}]);return a}(),g=function(a){function e(){p(this,e);var a=(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||
-"object"!==typeof a&&"function"!==typeof a?this:a}q(e,a);c(e,[{key:"get",value:function(a,c){"string"!==typeof a&&(a=Object(d.g)(a));return b(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"get",this).call(this,a,c)}},{key:"getUncounted",value:function(a,b){return this.get(a,function(){return new n.b(b())}).value}}]);return e}(e)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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)}a.d(f,"a",function(){return t});f.e=function(a,b,c,d,e){c=void 0===c?a.RGBA8:c;d=void 0===d?a.RGBA:d;e=void 0===e?a.UNSIGNED_BYTE:
-e;for(var g=[],k=0;k<b;++k)g[k]=new u(a,c,d,e);return g};a.d(f,"b",function(){return w});a.d(f,"c",function(){return y});h=a(1);var d=a(2),b=a(23),c=a(52),e=a(77),g=a(141),l=function A(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return A(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},k=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||
-!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();a=function(a){function b(){q(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.width=Number.NaN;a.height=Number.NaN;return a}n(b,a);k(b,[{key:"hasSize",value:function(a,b){return this.width===a&&this.height===b}},{key:"resize",value:function(a,b){this.hasSize(a,b)||(this.width=a,this.height=b,this.performResize())}}]);
-return b}(h.a);var t=function(a){function b(a,c){c=void 0===c?!1:c;q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c?a.DEPTH_STENCIL:a.DEPTH_COMPONENT16));d.gl=a;d.includeStencilBuffer=c;return d}n(b,a);k(b,[{key:"attachToFramebuffer",value:function(){var a=this.gl;l(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"attachToFramebuffer",this).call(this,this.includeStencilBuffer?a.DEPTH_STENCIL_ATTACHMENT:a.DEPTH_ATTACHMENT)}}]);return b}(function(a){function b(a,
-c){q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.gl=a;d.internalformat=c;d.renderbuffer=null;d.renderbuffer=a.createRenderbuffer();return d}n(b,a);k(b,[{key:"performResize",value:function(){var a=this.gl;a.bindRenderbuffer(a.RENDERBUFFER,this.renderbuffer);a.renderbufferStorage(a.RENDERBUFFER,this.internalformat,this.width,this.height);a.bindRenderbuffer(a.RENDERBUFFER,null)}},{key:"disposed",value:function(){this.gl.deleteRenderbuffer(this.renderbuffer)}},{key:"attachToFramebuffer",
-value:function(a){var b=this.gl;b.framebufferRenderbuffer(b.FRAMEBUFFER,a,b.RENDERBUFFER,this.renderbuffer)}}]);return b}(a)),m=function(a){function b(a){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,!0))}n(b,a);return b}(t);f.d=m;var r=function(a){function b(a){q(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.gl=a;c.framebuffer=c.gl.createFramebuffer();return c}n(b,a);k(b,[{key:"disposed",value:function(){this.gl.deleteFramebuffer(this.framebuffer)}},
-{key:"bind",value:function(){var a=this.gl;a.bindFramebuffer(a.FRAMEBUFFER,this.framebuffer)}},{key:"unbind",value:function(){var a=this.gl;a.bindFramebuffer(a.FRAMEBUFFER,null)}}]);return b}(h.a),u=function(a){function b(a,c,d,e){q(this,b);var g=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));g.gl=a;g.internalFormat=c;g.format=d;g.dataType=e;g.texture=a.createTexture();return g}n(b,a);k(b,[{key:"performResize",value:function(){Object(e.a)(this.gl,this.texture,this.width,this.height,this.internalFormat,
-this.format,this.dataType)}},{key:"disposed",value:function(){this.gl.deleteTexture(this.texture)}},{key:"attachToFramebuffer",value:function(a){var b=this.gl;b.framebufferTexture2D(b.FRAMEBUFFER,a,b.TEXTURE_2D,this.texture,0)}}]);return b}(a),v=new Uint8Array(4),w=function(a){function b(a,c){q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.gl=a;d.width=Number.NaN;d.height=Number.NaN;d.fullAttachmentList=[];d.attachmentVerified=!1;d.singleAttachmentList=[d.gl.COLOR_ATTACHMENT0];
-var e=void 0===c.framebuffer?new r(a):c.framebuffer,g=c.colorBuffers;c=c.depthBuffer;d.framebuffer=d.registerDisposer(e);d.colorBuffers=g;d.depthBuffer=c;void 0!==c&&d.registerDisposer(c);var k=d.fullAttachmentList;g.forEach(function(b,c){d.registerDisposer(b);k[c]=a.COLOR_ATTACHMENT0+c});return d}n(b,a);k(b,[{key:"hasSize",value:function(a,b){return this.width===a&&this.height===b}},{key:"bind",value:function(a,b){this.width=a;this.height=b;this.framebuffer.bind();var c=this.gl,d=this.depthBuffer;
-void 0!==d&&(d.resize(a,b),d.attachToFramebuffer());this.colorBuffers.forEach(function(d,e){d.resize(a,b);d.attachToFramebuffer(c.COLOR_ATTACHMENT0+e)});c.drawBuffers(this.fullAttachmentList);this.verifyAttachment();c.viewport(0,0,a,b)}},{key:"bindSingle",value:function(a){var b=this.gl;this.framebuffer.bind();0!==a&&b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0+a,b.TEXTURE_2D,null,0);b.bindTexture(b.TEXTURE_2D,null);this.colorBuffers[a].attachToFramebuffer(b.COLOR_ATTACHMENT0);b.drawBuffers(this.singleAttachmentList)}},
-{key:"unbind",value:function(){this.framebuffer.unbind()}},{key:"readPixel",value:function(a,b,c){var d=this.gl;try{this.bindSingle(a),d.readPixels(b,c,1,1,d.RGBA,d.UNSIGNED_BYTE,v)}finally{this.framebuffer.unbind()}return v}},{key:"readPixelAsUint32",value:function(a,b,c){a=this.readPixel(a,b,c);return a[0]+(a[1]<<8)+(a[2]<<16)+(a[3]<<24)}},{key:"verifyAttachment",value:function(){if(!this.attachmentVerified){var a=this.gl;if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw Error("Framebuffer configuration not supported");
-this.attachmentVerified=!0}}}]);return b}(h.a),y=function(a){function e(a,b){q(this,e);var d=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));d.gl=a;d.shader=b;d.copyVertexPositionsBuffer=Object(c.a)(d.gl);d.copyTexCoordsBuffer=Object(c.a)(d.gl,0,0,1,1);d.registerDisposer(b);return d}n(e,a);k(e,[{key:"draw",value:function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];c=this.gl;var e=this.shader;e.bind();for(var g=b.length,k=0;k<g;++k)c.activeTexture(c.TEXTURE0+k),c.bindTexture(c.TEXTURE_2D,
-b[k]);c.uniformMatrix4fv(e.uniform("uProjectionMatrix"),!1,d.d);b=e.attribute("aVertexPosition");this.copyVertexPositionsBuffer.bindToVertexAttrib(b,2);e=e.attribute("aTexCoord");this.copyTexCoordsBuffer.bindToVertexAttrib(e,2);c.drawArrays(c.TRIANGLE_FAN,0,4);c.disableVertexAttribArray(b);c.disableVertexAttribArray(e);for(b=0;b<g;++b)c.activeTexture(c.TEXTURE0+b),c.bindTexture(c.TEXTURE_2D,null)}}],[{key:"get",value:function(a,c,d){c=void 0===c?g.a:c;d=void 0===d?1:d;return a.memoize.get("OffscreenCopyHelper:"+
-d+":"+Object(b.a)(c),function(){return new e(a,Object(g.b)(a,c,d))})}}]);return e}(h.a)},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return b});h=a(1);var p=a(101),n=a(52),d=function(){function a(a,
-b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();f.b=4;var b=function(a){function b(a,c){c=void 0===c?1:c;if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var d=(b.__proto__||Object.getPrototypeOf(b)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-d=!d||"object"!==typeof d&&"function"!==typeof d?this:d;d.circlesPerInstance=c;d.squareCornersBuffer=Object(n.a)(a,-1,-1,1,1,c,1);d.quadHelper=d.registerDisposer(new p.a(a,c));return d}q(b,a);d(b,[{key:"defineShader",value:function(a,b){a.addAttribute("highp vec2","aCircleCornerOffset");a.addUniform("highp vec4","uCircleParams");a.addVarying("highp vec2","vCircleCoord");a.addVertexCode("\nvoid emitCircle(vec4 position) {\n  gl_Position = position;\n  gl_Position.xy += aCircleCornerOffset * uCircleParams.xy * gl_Position.w;\n  vCircleCoord = aCircleCornerOffset;\n}\n");
-b?a.addFragmentCode("\nfloat getCircleAlphaMultiplier() {\n  return 1.0 - 2.0 * abs(0.5 - gl_FragCoord.z);\n}\n"):a.addFragmentCode("\nfloat getCircleAlphaMultiplier() {\n  return 1.0;\n}\n");a.addFragmentCode("\nvec4 getCircleColor(vec4 interiorColor, vec4 borderColor) {\n  float radius = length(vCircleCoord);\n  if (radius > 1.0) {\n    discard;\n  }\n\n  float borderColorFraction = clamp((radius - uCircleParams.z) / uCircleParams.w, 0.0, 1.0);\n  float feather = clamp((1.0 - radius) / uCircleParams.w, 0.0, 1.0);\n  vec4 color = mix(interiorColor, borderColor, borderColorFraction);\n\n  return vec4(color.rgb, color.a * feather * getCircleAlphaMultiplier());\n}\n")}},
-{key:"draw",value:function(a,b,c,d){var e=a.gl,g=a.attribute("aCircleCornerOffset");this.squareCornersBuffer.bindToVertexAttrib(g,2);var k=c.interiorRadiusInPixels+c.borderWidthInPixels+c.featherWidthInPixels;e.uniform4f(a.uniform("uCircleParams"),k/b.viewportWidth,k/b.viewportHeight,c.interiorRadiusInPixels/k,c.featherWidthInPixels/k);this.quadHelper.draw(e,d);a.gl.disableVertexAttribArray(g)}}]);return b}(h.a)},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function p(a){for(var b=new Uint16Array(6*a),c=0;c<a;++c){var d=4*c,k=6*c;b[k]=d;b[k+1]=d+1;b[k+2]=d+2;b[k+3]=d+2;b[k+4]=d+3;b[k+5]=d}return b}a.d(f,"a",function(){return b});h=a(1);var n=a(20),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in
-d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();f.b=4;var b=function(a){function b(a,c){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var d=(b.__proto__||Object.getPrototypeOf(b)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");d=!d||"object"!==typeof d&&"function"!==typeof d?this:d;d.quadsPerInstance=c;1!==c&&(d.quadIndexBuffer=d.registerDisposer(Object(n.b)(a,
-WebGL2RenderingContext.ELEMENT_ARRAY_BUFFER,p,c)).value);return d}q(b,a);d(b,[{key:"draw",value:function(a,b){1===this.quadsPerInstance?a.drawArraysInstanced(WebGL2RenderingContext.TRIANGLE_FAN,0,4,b):(this.quadIndexBuffer.bind(),a.drawElementsInstanced(WebGL2RenderingContext.TRIANGLES,6*this.quadsPerInstance,WebGL2RenderingContext.UNSIGNED_SHORT,0,b))}}]);return b}(h.a)},function(h,f,a){f.a=function(a,f){if(a.active&&void 0!==a.pickedAnnotationId){var h=a.pickedRenderLayer;if(null!==h){var d=a.pickedAnnotationLayer;
-if(void 0!==d&&(f=f.renderLayerToManagedLayerMap.get(h),void 0!==f))return{layer:f,annotationLayer:d,id:a.pickedAnnotationId,partIndex:a.pickedOffset}}}};f.b=function(a,f){a.registerDisposer(f.changed.add(function(){a.hoverState.value=f.active&&f.pickedAnnotationLayer===a?{id:f.pickedAnnotationId,partIndex:f.pickedOffset}:void 0}))}},function(h,f,a){f.b=function(a,d,b,c){c=void 0===c?q.e:c;var e=void 0;return new Promise(function(g,l){function k(m){null!==e&&(e=Object(p.b)(a.serverUrls,b.path,b.method),
-e.responseType=b.responseType,e.setRequestHeader("Authorization",m.credentials.tokenType+" "+m.credentials.accessToken),e.onloadend=function(){if(null!==e){var a=this.status;200<=a&&300>a?(c.remove(f),g(this.response)):401===a?d.get(m,c).then(k):504===a||503===a?d.get(void 0,c).then(k):(c.remove(f),l(p.a.fromXhr(this)))}},e.send(b.payload))}var f=function(){var a=e;e=null;null!=a&&a.abort();l(q.a)};c.add(f);d.get(void 0,c).then(k)})};var q=a(32),p=a(63);f.a="google-brainmaps"},function(h,f,a){function q(a,
-b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a){switch(a){case t.b.FLOAT32:return WebGL2RenderingContext.FLOAT;default:throw Error("Data type not supported by WebGL: ${DataType[dataType]}");}}f.f=function(a){return new k.c(void 0===a?"void main() {\n  emitDefault();\n}\n":a,u.A)};a.d(f,"c",function(){return F});a.d(f,"b",function(){return L});a.d(f,"e",function(){return J});a.d(f,"d",function(){return N});var b=a(30);h=a(24);var c=a(59),e=a(64),g=a(266),l=a(60),k=a(9),t=a(50),m=a(1),r=a(2),
-u=a(4),v=a(23),w=a(7),y=a(20),x=a(25),A=a(21),z=function U(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return U(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},D=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,
-c);d&&a(b,d);return b}}(),E=a(105),G=r.k.create(),C=new Float32Array(4);f.a="//NEUROGLANCER_SKELETON_LAYER_FRAGMENT_MAIN_START";var B=function(a){function b(a){q(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.vertexAttributes=a;c.shaders=new Map;c.shaderGeneration=-1;c.vertexAttributesKey=Object(u.g)(c.vertexAttributes);return c}n(b,a);D(b,[{key:"defineShader",value:function(a,b){a.addUniform("highp vec4","uColor");a.addUniform("highp mat4","uProjection");a.addUniform("highp vec4",
-"uPickID");var c="\ngl_Position = uProjection * vec4(aVertex0, 1.0);\n";a.addFragmentCode("\nvec4 segmentColor() {\n  return uColor;\n}\nvoid emitRGB(vec3 color) {\n  emit(vec4(color * uColor.a, uColor.a), uPickID);\n}\nvoid emitDefault() {\n  emit(uColor, uPickID);\n}\n");a.addFragmentCode(E);this.vertexAttributes.forEach(function(b,d){a.addAttribute("highp "+b.glslDataType,"aVertex"+d);0!==d&&(a.addVarying("highp "+b.glslDataType,"vVertex"+d),c+="vVertex"+d+" = aVertex"+d+";\n",a.addFragmentCode("#define "+
-b.name+" vVertex"+d+"\n"))});a.setVertexMain(c);a.setFragmentMainFunction("//NEUROGLANCER_SKELETON_LAYER_FRAGMENT_MAIN_START\n"+b)}},{key:"beginLayer",value:function(a,b,c,d){c=r.k.multiply(G,c.dataToDevice,d);a.uniformMatrix4fv(b.uniform("uProjection"),!1,c)}},{key:"getShader",value:function(a,b,c){var d=this;return this.registerDisposer(a.memoize.get("skeleton/SkeletonShaderManager:"+Object(v.a)(b)+":"+this.vertexAttributesKey+":"+c,function(){var e=new x.a(a);e.require(b);d.defineShader(e,c);return e.build()}))}},
-{key:"setColor",value:function(a,b,c){a.uniform4fv(b.uniform("uColor"),c)}},{key:"setPickID",value:function(a,b,c){a.uniform4fv(b.uniform("uPickID"),Object(A.r)(C,c))}},{key:"drawSkeleton",value:function(a,b,c){for(var d=this.vertexAttributes,e=d.length,g=c.vertexAttributeOffsets,k=0;k<e;++k){var l=d[k];c.vertexBuffer.bindToVertexAttrib(b.attribute("aVertex"+k),l.numComponents,l.webglDataType,!1,0,g[k])}c.indexBuffer.bind();a.drawElements(a.LINES,c.numIndices,a.UNSIGNED_INT,0)}},{key:"endLayer",value:function(a,
-b){for(var c=this.vertexAttributes.length,d=0;d<c;++d)a.disableVertexAttribArray(b.attribute("aVertex"+d))}}]);return b}(m.a),F=function(a){function c(a,b,k,l){q(this,c);var m=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));m.chunkManager=a;m.source=b;m.voxelSizeObject=k;m.displayState=l;m.tempMat=r.k.create();m.redrawNeeded=new w.a;m.fallbackFragmentMain="void main() {\n  emitDefault();\n}\n";Object(e.f)(l,m);m.displayState.shaderError.value=void 0;m.registerDisposer(l.fragmentMain.changed.add(function(){m.displayState.shaderError.value=
-void 0;m.redrawNeeded.dispatch()}));a=m.sharedObject=m.registerDisposer(new e.b(a,l));a.RPC_TYPE_ID=g.a;a.initializeCounterpartWithChunkManager({source:b.addCounterpartRef()});a=m.vertexAttributes=[O];b=$jscomp.makeIterator(b.vertexAttributes);for(k=b.next();!k.done;k=b.next())l=$jscomp.makeIterator(k.value),k=l.next().value,l=l.next().value,a.push({name:k,dataType:l.dataType,numComponents:l.numComponents,webglDataType:d(l.dataType),glslDataType:1<l.numComponents?"vec"+l.numComponents:"float"});return m}
-n(c,a);D(c,[{key:"getShader",value:function(a,b,c){var d=this.displayState.fragmentMain,e=d.changed.count,g=b.shaders;b.shaderGeneration!==e&&(g.clear(),b.shaderGeneration=e);e=g.get(c);if(void 0===e){e=null;try{e=b.getShader(a,c,d.value),this.fallbackFragmentMain=d.value,this.displayState.shaderError.value=null}catch(R){this.displayState.shaderError.value=R;try{e=b.getShader(a,c,this.fallbackFragmentMain)}catch(X){}}g.set(c,e)}return e}},{key:"draw",value:function(a,c,d,g){void 0===g&&(g=a.emitColor?
-1:5);var k=this.gl,l=this.source,m=this.displayState,f=Math.min(1,m.objectAlpha.value);if(!(0>=f)){var t=this.getShader(k,d,a.emitter);if(null!==t){t.bind();var u=this.tempMat;r.k.identity(u);l.skeletonVertexCoordinatesInVoxels&&r.k.scale(u,u,this.voxelSizeObject.size);r.k.multiply(u,this.displayState.objectToDataTransform.transform,u);d.beginLayer(k,t,a,u);l=l.chunks;var h=a.pickIDs;k.lineWidth(g);Object(e.d)(m,l,function(g,l,r){r.state===b.d.GPU_MEMORY&&(a.emitColor&&d.setColor(k,t,Object(e.e)(m,
-g,f)),a.emitPickID&&d.setPickID(k,t,h.registerUint64(c,l)),d.drawSkeleton(k,t,r))});d.endLayer(k,t)}}}},{key:"visibility",get:function(){return this.sharedObject.visibility}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}]);return c}(m.a),L=function(a){function b(a){q(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.base=a;c.renderHelper=c.registerDisposer(new B(c.base.vertexAttributes));c.registerDisposer(a);c.registerDisposer(a.redrawNeeded.add(function(){c.redrawNeeded.dispatch()}));
-c.setReady(!0);c.registerDisposer(a.visibility.add(c.visibility));return c}n(b,a);D(b,[{key:"draw",value:function(a){this.base.draw(a,this,this.renderHelper)}},{key:"gl",get:function(){return this.base.gl}},{key:"isTransparent",get:function(){return 1>this.base.displayState.objectAlpha.value}}]);return b}(c.a),J=function(a){function b(a){q(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.base=a;c.renderHelper=c.registerDisposer(new B(c.base.vertexAttributes));c.registerDisposer(a);
-c.registerDisposer(a.redrawNeeded.add(function(){c.redrawNeeded.dispatch()}));c.setReady(!0);c.registerDisposer(a.visibility.add(c.visibility));return c}n(b,a);D(b,[{key:"draw",value:function(a){this.base.draw(a,this,this.renderHelper,10)}},{key:"gl",get:function(){return this.base.gl}}]);return b}(l.b),O={dataType:t.b.FLOAT32,numComponents:3,name:"",webglDataType:WebGL2RenderingContext.FLOAT,glslDataType:"vec3"},M=function(a){function b(a,c){q(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,
-a));a.vertexAttributes=c.vertexAttributes;var d=a.indices=c.indices;a.vertexAttributeOffsets=c.vertexAttributeOffsets;a.numIndices=d.length;return a}n(b,a);D(b,[{key:"copyToGPU",value:function(a){z(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"copyToGPU",this).call(this,a);this.vertexBuffer=y.a.fromData(a,this.vertexAttributes,a.ARRAY_BUFFER,a.STATIC_DRAW);this.indexBuffer=y.a.fromData(a,this.indices,a.ELEMENT_ARRAY_BUFFER,a.STATIC_DRAW)}},{key:"freeGPUMemory",value:function(a){z(b.prototype.__proto__||
-Object.getPrototypeOf(b.prototype),"freeGPUMemory",this).call(this,a);this.vertexBuffer.dispose();this.indexBuffer.dispose()}}]);return b}(h.b),P=new Map,N=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);D(b,[{key:"getChunk",value:function(a){return new M(this,a)}},{key:"skeletonVertexCoordinatesInVoxels",get:function(){return!0}},{key:"vertexAttributes",get:function(){return P}}]);return b}(h.e)},function(h,f){h.exports="\n\nvec3 colormapJet(float x) {\n  vec3 result;\n  result.r = x < 0.89 ? ((x - 0.35) / 0.31) : (1.0 - (x - 0.89) / 0.11 * 0.5);\n  result.g = x < 0.64 ? ((x - 0.125) * 4.0) : (1.0 - (x - 0.64) / 0.27);\n  result.b = x < 0.34 ? (0.5 + x * 0.5 / 0.11) : (1.0 - (x - 0.34) / 0.31);\n  return clamp(result, 0.0, 1.0);\n}\n"},
-function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a){Object(z.t)(a);var b=Object(z.v)(a,"neariso_voxelres",function(a){return Object(z.u)(a,z.j)}),c=Object(z.v)(a,"neariso_imagesize",function(a){return Object(z.u)(a,z.i)}),d=Object(z.v)(a,"neariso_offset",function(a){return Object(z.u)(a,z.k)});return Object(z.v)(a,"resolutions",function(a){return Object(z.a)(a,z.r)}).map(function(a){var e=""+a,g=b.get(e),k=c.get(e),l=d.get(e);if(void 0===g||void 0===
-k||void 0===l)throw Error("Missing neariso_voxelres/neariso_imagesize/neariso_offset for resolution "+(a+"."));return{key:e,voxelSize:g,imageSize:k,voxelOffset:l}})}function b(a){a=E.get(a);void 0===a&&(a=v.c.UNKNOWN);return a}function c(a){Object(z.t)(a);var c=Object(z.v)(a,"channel_type",z.A);return{channelType:c,description:Object(z.v)(a,"description",z.A),volumeType:b(c),dataType:Object(z.v)(a,"datatype",function(a){return Object(z.m)(a,v.a)})}}function e(a){Object(z.t)(a);return{channels:Object(z.v)(a,
-"channels",function(a){return Object(z.u)(a,c)}),scales:Object(z.v)(a,"dataset",d)}}function g(a,b,c,d){return a.memoize.getUncounted({type:"ndstore:getTokenInfo",hostnames:b,token:c},function(){return Object(A.d)(Object(A.b)(b,d+"/"+c+"/info/"),"json").then(e)})}function l(a,b,c,d){var e=c.match(F);if(null===e)throw Error("Invalid volume path "+JSON.stringify(c));var k=e[1],l=e[2],m=Object(z.e)(e[3]||"");return a.memoize.getUncounted({type:"ndstore:MultiscaleVolumeChunkSource",hostnames:b,path:c},
-function(){return g(a,b,k,d).then(function(c){return new B(a,b,k,c,l,d,m)})})}function k(a,b){var c=b.match(L);if(null===c)throw Error("Invalid ndstore volume path: "+JSON.stringify(b));return l(a,[c[1]],c[2],u.b)}function t(a,b,c){return a.memoize.getUncounted({type:"dvid:getPublicTokens",hostnames:b},function(){return Object(A.d)(Object(A.b)(b,c+"/public_tokens/"),"json").then(function(a){return Object(z.a)(a,z.A)})})}function m(a,b,c,d){var e=c.match(/^(?:([^\/]+)(?:\/([^\/]*))?)?$/);if(null===
-e)return Promise.reject(null);if(void 0===e[2]){var k=e[1]||"";return t(a,b,d).then(function(a){return{offset:0,completions:Object(y.c)(k,a,function(a){return a+"/"},function(){})}})}return g(a,b,e[1],d).then(function(a){a=Object(y.c)(e[2],a.channels,function(a){return a[0]},function(a){return a[1].channelType+" ("+v.a[a[1].dataType]+")"});return{offset:e[1].length+1,completions:a}})}function r(a,b){var c=a.match(L);return null===c?Promise.reject(null):m(b,[c[1]],c[2],u.b).then(function(a){return Object(y.a)(c[1].length+
-1,a)})}Object.defineProperty(f,"__esModule",{value:!0});a.d(f,"getVolume",function(){return k});a.d(f,"volumeCompleter",function(){return r});a.d(f,"MultiscaleVolumeChunkSource",function(){return B});f.getTokenInfo=g;f.getShardedVolume=l;f.getPublicTokens=t;f.tokenAndChannelCompleter=m;a.d(f,"NDStoreDataSource",function(){return J});a.d(f,"SingleServerDataSource",function(){return O});h=a(24);f=a(46);var u=a(152),v=a(26),w=a(33),y=a(62),x=a(2),A=a(63),z=a(4),D=function(){function a(a,b){for(var c=
-0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),E=new Map;E.set("image",v.c.IMAGE);E.set("annotation",v.c.SEGMENTATION);var G=new Set(["npz","raw","jpeg"]),C=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);return b}(Object(h.f)(w.b,u.c)),B=function(){function a(b,c,d,e,g,
-k,l){q(this,a);this.chunkManager=b;this.baseUrls=c;this.key=d;this.tokenInfo=e;this.parameters=l;this.urlPrefix=u.b;this.neariso=!0;if(void 0===g){g=Array.from(e.channels.keys());if(1!==g.length)throw Error("Dataset contains multiple channels: "+JSON.stringify(g));g=g[0]}b=e.channels.get(g);if(void 0===b)throw Error("Specified channel "+JSON.stringify(g)+" is not one of the supported "+("channels "+JSON.stringify(Array.from(e.channels.keys()))));this.channel=g;this.channelInfo=b;this.scales=e.scales;
-void 0!==k&&(this.urlPrefix=k);"false"===Object(z.y)(l.neariso)&&(this.neariso=!1);e=Object(z.y)(l.encoding);if(void 0===e)e=this.volumeType===v.c.IMAGE?"jpeg":"npz";else if(!G.has(e))throw Error("Invalid encoding: "+JSON.stringify(e)+".");this.encoding=e}D(a,[{key:"getSources",value:function(a){var b=this;return this.scales.map(function(c){for(var d=c.voxelOffset,e=c.voxelSize,g=x.s.create(),k=0;3>k;++k)g[k]=Math.ceil(d[k]);return v.b.getDefaults({numChannels:b.numChannels,volumeType:b.volumeType,
-dataType:b.dataType,voxelSize:e,transform:x.k.fromTranslation(x.k.create(),x.s.multiply(x.s.create(),d,e)),baseVoxelOffset:g,upperVoxelBound:c.imageSize,volumeSourceOptions:a}).map(function(a){return b.chunkManager.getChunkSource(C,{spec:a,parameters:{baseUrls:b.baseUrls,urlPrefix:b.urlPrefix,key:b.key,channel:b.channel,resolution:c.key,encoding:b.encoding,neariso:b.neariso}})})})}},{key:"getMeshSource",value:function(){return null}},{key:"dataType",get:function(){return this.channelInfo.dataType}},
-{key:"numChannels",get:function(){return 1}},{key:"volumeType",get:function(){return this.channelInfo.volumeType}}]);return a}(),F=/^([^\/?]+)(?:\/([^\/?]+))?(?:\?(.*))?$/,L=/^((?:http|https):\/\/[^\/?]+)\/(.*)$/,J=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);D(b,[{key:"volumeCompleter",value:function(a,b){return r(a,b)}},{key:"getVolume",value:function(a,b){return k(a,b)}},{key:"description",get:function(){return"NDstore"}}]);
-return b}(f.a),O=function(a){function b(a,c,d){d=void 0===d?u.b:d;q(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.description=a;e.hostnames=c;e.urlprefix=d;return e}n(b,a);D(b,[{key:"getVolume",value:function(a,b){return l(a,this.hostnames,b,this.urlprefix)}},{key:"volumeCompleter",value:function(a,b){return m(b,this.hostnames,a,this.urlprefix)}}]);return b}(f.a)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
-}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a){return new r.a({shaderError:a.shaderError,
-fragmentMain:a.fragmentMain,fragmentMainStartLine:e.a})}Object.defineProperty(f,"__esModule",{value:!0});a.d(f,"ImageUserLayer",function(){return y});h=a(18);f=a(27);var b=a(47),c=a(26),e=a(160),g=a(56),l=a(162),k=a(163),t=a(55),m=a(81),r=a(112),u=a(40),v=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),w=
-function D(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return D(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a(171);a(172);var y=function(a){function b(a,c){q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));d.opacity=Object(g.a)(.5);d.blendMode=Object(l.c)();d.fragmentMain=Object(e.c)();d.shaderError=Object(t.c)();d.registerDisposer(d.fragmentMain.changed.add(d.specificationChanged.dispatch));
-d.tabs.add("rendering",{label:"Rendering",order:-100,getter:function(){return new x(d)}});d.tabs.default="rendering";return d}n(b,a);v(b,[{key:"restoreState",value:function(a){var c=this;w(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"restoreState",this).call(this,a);this.opacity.restoreState(a.opacity);this.blendMode.restoreState(a.blend);this.fragmentMain.restoreState(a.shader);a=this.multiscaleSource;if(void 0===a)throw Error("source property must be specified");a.then(function(a){c.wasDisposed||
-(a=c.renderLayer=new e.b(a,{opacity:c.opacity,blendMode:c.blendMode,fragmentMain:c.fragmentMain,shaderError:c.shaderError,transform:c.transform}),c.addRenderLayer(a),c.shaderError.changed.dispatch(),c.isReady=!0)})}},{key:"toJSON",value:function(){var a=w(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"toJSON",this).call(this);a.type="image";a.opacity=this.opacity.toJSON();a.blend=this.blendMode.toJSON();a.shader=this.fragmentMain.toJSON();return a}}]);return b}(Object(k.a)(h.i)),x=function(a){function b(a){q(this,
-b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.layer=a;c.opacityWidget=c.registerDisposer(new m.a(c.layer.opacity));c.codeWidget=c.registerDisposer(d(c.layer));a=c.element;a.classList.add("image-dropdown");var e=c.opacityWidget,g=document.createElement("div");g.className="image-dropdown-top-row";e.promptElement.textContent="Opacity";e=document.createElement("div");e.style.flex="1";var k=document.createElement("a"),l=document.createElement("button");l.type="button";l.textContent=
-"?";l.className="help-link";k.appendChild(l);k.title="Documentation on image layer rendering";k.target="_blank";k.href="https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/image_layer_rendering.md";l=document.createElement("button");l.innerHTML="&square;";l.className="maximize-button";l.title="Show larger editor view";c.registerEventListener(l,"click",function(){new A(c.layer)});g.appendChild(c.opacityWidget.element);g.appendChild(e);g.appendChild(l);g.appendChild(k);a.appendChild(g);
-a.appendChild(c.codeWidget.element);c.codeWidget.textEditor.refresh();c.visibility.changed.add(function(){c.visible&&c.codeWidget.textEditor.refresh()});return c}n(b,a);return b}(u.b),A=function(a){function b(a){q(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.layer=a;c.codeWidget=c.registerDisposer(d(c.layer));c.content.classList.add("image-layer-shader-overlay");c.content.appendChild(c.codeWidget.element);c.codeWidget.textEditor.refresh();return c}n(b,a);return b}(b.a);
-Object(f.e)("image",y);Object(f.f)(c.c.IMAGE,y)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a,b,c,d){var e=x.s.transformMat4(x.s.create(),a,b);a=Object(D.c)(c.voxelFromSpatial(U,e));return void 0!==d?(b=document.createElement("span"),b.className="neuroglancer-voxel-coordinates-link",b.textContent=a,b.title="Center view on voxel coordinates "+a+".",b.addEventListener("click",function(){d(e)}),b):document.createTextNode(a)}function b(a,b,c,e,g){switch(b.type){case k.c.AXIS_ALIGNED_BOUNDING_BOX:case k.c.LINE:a.appendChild(d(b.pointA,
-c,e,g));a.appendChild(document.createTextNode("\u2013"));a.appendChild(d(b.pointB,c,e,g));break;case k.c.POINT:a.appendChild(d(b.point,c,e,g));break;case k.c.ELLIPSOID:a.appendChild(d(b.center,c,e,g)),b=Object(x.p)(U,b.radii,c),e.voxelFromSpatial(b,b),a.appendChild(document.createTextNode("\u00b1"+Object(D.b)(b)))}}function c(a,b){var c=x.s.create();switch(a.type){case k.c.AXIS_ALIGNED_BOUNDING_BOX:case k.c.LINE:x.s.add(c,a.pointA,a.pointB);x.s.scale(c,c,.5);break;case k.c.POINT:x.s.copy(c,a.point);
-break;case k.c.ELLIPSOID:x.s.copy(c,a.center)}return x.s.transformMat4(c,c,b)}function e(a){var b;a=a.segmentationState.value;null!=a&&a.segmentSelectionState.hasSelectedSegment&&(b=[a.segmentSelectionState.selectedSegment.clone()]);return b}function g(a,b){return x.s.transformMat4(x.s.create(),a.position,b.globalToObject)}f.c=b;f.b=function(a){return{color:a.annotationColor,fillOpacity:a.annotationFillOpacity}};f.a=function(a){return function(a){function b(a){for(var c=[],d=0;d<arguments.length;++d)c[d-
-0]=arguments[d];q(this,b);var e,g=p(this,(e=b.__proto__||Object.getPrototypeOf(b)).call.apply(e,[].concat([this],$jscomp.arrayFromIterable(c))));g.annotationLayerState=g.registerDisposer(new v.d);g.selectedAnnotation=g.registerDisposer(new S(g.annotationLayerState.addRef()));g.annotationColor=new w.a(x.s.fromValues(1,1,0));g.annotationFillOpacity=Object(u.a)(0);g.selectedAnnotation.changed.add(g.specificationChanged.dispatch);g.annotationColor.changed.add(g.specificationChanged.dispatch);g.tabs.add("annotations",
-{label:"Annotations",order:10,getter:function(){return new Q(g,g.selectedAnnotation.addRef(),g.manager.voxelSize.addRef(),function(a){return g.manager.setSpatialCoordinates(a)})}});g.annotationLayerState.changed.add(function(){var a=g.annotationLayerState.value;if(void 0!==a){var b=new t.a(g.manager.chunkManager,a.addRef());Object(r.b)(a,g.manager.layerSelectedValues.mouseState);g.addRenderLayer(new t.e(b));g.addRenderLayer(new t.d(b.addRef()));if(b.source instanceof m.b){var c=g.registerDisposer(new m.a(b.source.addRef()));
-g.registerDisposer(Object(v.h)(a.filterBySegmentation,function(a,b){b||(g.addRenderLayer(c.addRef()),a.registerDisposer(function(){return g.removeRenderLayer(c)}))}))}}});return g}n(b,a);P(b,[{key:"restoreState",value:function(a){M(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"restoreState",this).call(this,a);this.selectedAnnotation.restoreState(a.selectedAnnotation);this.annotationColor.restoreState(a.annotationColor);this.annotationFillOpacity.restoreState(a.annotationFillOpacity)}},
-{key:"toJSON",value:function(){var a=M(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"toJSON",this).call(this);a.selectedAnnotation=this.selectedAnnotation.toJSON();a.annotationColor=this.annotationColor.toJSON();a.annotationFillOpacity=this.annotationFillOpacity.toJSON();return a}},{key:"initializeAnnotationLayerViewTab",value:function(a){a}}]);return b}(a)};h=a(284);a.n(h);h=a(10);var l=a.n(h),k=a(28),t=a(73),m=a(97),r=a(102),u=a(56),v=a(9);h=a(139);var w=a(164);f=a(1);var y=a(8),x=
-a(2),A=a(4),z=a(7),D=a(167),E=a(14),G=a(29),C=a(109),B=a(286),F=a(81),L=a(40),J=a(110),O=a(168),M=function X(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return X(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},P=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,
-d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),N=function(a){function b(a,c){q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.reference=a;d.annotationLayer=c;d.element=document.createElement("div");d.addSegmentWidget=d.registerDisposer(new O.a);d.debouncedUpdateView=l()(function(){return d.updateView()},0);d.element.className="neuroglancer-annotation-segment-list";var e=d.addSegmentWidget;e.element.style.display="inline-block";e.element.title=
-"Associate segments";d.element.appendChild(e.element);d.registerDisposer(c.segmentationState.changed.add(d.debouncedUpdateView));d.registerDisposer(function(){return d.unregisterSegmentationState()});d.registerDisposer(d.addSegmentWidget.valuesEntered.add(function(a){var b=d.reference.value;null!=b&&(a=[].concat($jscomp.arrayFromIterable(b.segments||[]),$jscomp.arrayFromIterable(a)),b=Object.assign({},b,{segments:a}),d.annotationLayer.source.update(d.reference,b),d.annotationLayer.source.commit(d.reference))}));
-d.registerDisposer(a.changed.add(d.debouncedUpdateView));d.updateView();return d}n(b,a);P(b,[{key:"unregisterSegmentationState",value:function(){var a=this.segmentationState;null!=a&&(a.visibleSegments.changed.remove(this.debouncedUpdateView),a.segmentColorHash.changed.remove(this.debouncedUpdateView),a.segmentSelectionState.changed.remove(this.debouncedUpdateView),this.segmentationState=void 0)}},{key:"updateView",value:function(){var a=this,b=this.annotationLayer.segmentationState.value;b!==this.segmentationState&&
-(this.unregisterSegmentationState(),this.segmentationState=b,null!=b&&(b.visibleSegments.changed.add(this.debouncedUpdateView),b.segmentColorHash.changed.add(this.debouncedUpdateView),b.segmentSelectionState.changed.add(this.debouncedUpdateView)));for(var c=this.element,d=this.addSegmentWidget.element.nextElementSibling;null!==d;){var e=d.nextElementSibling;c.removeChild(d);d=e}c.style.display="none";var g=this.reference.value;if(null!=g&&(d=g.segments,null!==b&&(c.style.display="",void 0!==d&&0!==
-d.length))){var k=b?b.segmentColorHash:void 0;d.forEach(function(d,e){0!==e&&c.appendChild(document.createTextNode(" "));e=document.createElement("span");e.title="Double click to toggle segment visibility, control+click to disassociate segment from annotation.";e.className="neuroglancer-annotation-segment-item";e.textContent=d.toString();void 0!==b&&(e.style.backgroundColor=k.computeCssColor(d),e.addEventListener("mouseenter",function(){b.segmentSelectionState.set(d)}),e.addEventListener("mouseleave",
-function(){b.segmentSelectionState.set(null)}),e.addEventListener("dblclick",function(a){a.ctrlKey||(b.visibleSegments.has(d)?b.visibleSegments.delete(d):b.visibleSegments.add(d))}));e.addEventListener("click",function(b){b.ctrlKey&&(b=(g.segments||[]).filter(function(a){return!E.a.equal(d,a)}),b=Object.assign({},g,{segments:b?b:void 0}),a.annotationLayer.source.update(a.reference,b),a.annotationLayer.source.commit(a.reference))});c.appendChild(e)})}}}]);return b}(f.a),S=function(a){function b(a){q(this,
-b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.annotationLayerState=a;c.changed=new z.a;c.referenceChanged=function(){c.validate();c.changed.dispatch()};c.validate=function(){var a=c.updateAnnotationLayer(),b=c.annotationLayer;if(void 0!==b){var d=c.value_;if(void 0!==d){var e=c.reference_;void 0!==e&&e.id!==d.id?d.id=e.id:void 0===e&&(e=c.reference_=b.source.getReference(d.id),e.changed.add(c.referenceChanged));if(null===e.value){c.unbindReference();c.value=void 0;return}}else c.unbindReference()}a&&
-c.changed.dispatch()};c.registerDisposer(a);c.registerDisposer(a.changed.add(c.validate));c.updateAnnotationLayer();c.reference_=void 0;c.value_=void 0;return c}n(b,a);P(b,[{key:"updateAnnotationLayer",value:function(){var a=this.annotationLayerState.value;if(a===this.annotationLayer)return!1;this.unbindLayer();this.annotationLayer=a;void 0!==a&&a.source.changed.add(this.validate);return!0}},{key:"unbindLayer",value:function(){void 0!==this.annotationLayer&&(this.annotationLayer.source.changed.remove(this.validate),
-this.annotationLayer=void 0)}},{key:"disposed",value:function(){this.unbindLayer();this.unbindReference();M(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"unbindReference",value:function(){var a=this.reference_;void 0!==a&&(a.changed.remove(this.referenceChanged),this.reference_=void 0)}},{key:"toJSON",value:function(){var a=this.value_;if(void 0!==a)return 0===a.partIndex?a.id:a}},{key:"reset",value:function(){this.value=void 0}},{key:"restoreState",
-value:function(a){void 0===a?this.value=void 0:"string"===typeof a?this.value={id:a,partIndex:0}:(Object(A.t)(a),this.value={id:Object(A.v)(a,"id",A.A),partIndex:Object(A.v)(a,"partIndex",A.x)})}},{key:"reference",get:function(){return this.reference_}},{key:"value",get:function(){return this.value_},set:function(a){this.value_=a;var b=this.reference_;void 0!==b&&(void 0!==a&&b.id===a.id||this.unbindReference());this.validate();this.changed.dispatch()}},{key:"validValue",get:function(){return this.annotationLayer&&
-this.value_}}]);return b}(f.a),U=x.s.create(),Z=function(a){function d(a,b,c,e,g){q(this,d);var l=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));l.layer=a;l.state=b;l.annotationLayer=c;l.voxelSize=e;l.setSpatialCoordinates=g;l.annotationListContainer=document.createElement("ul");l.annotationListElements=new Map;l.updated=!1;l.element.classList.add("neuroglancer-annotation-layer-view");l.annotationListContainer.classList.add("neuroglancer-annotation-list");l.registerDisposer(b);l.registerDisposer(e);
-l.registerDisposer(c);b=function(){l.updated=!1;l.updateView()};l.registerDisposer(c.source.changed.add(b));l.registerDisposer(l.visibility.changed.add(function(){return l.updateView()}));l.registerDisposer(c.transform.changed.add(b));l.updateView();b=document.createElement("div");b.className="neuroglancer-annotation-toolbox";a.initializeAnnotationLayerViewTab(l);a=l.registerDisposer(new F.a(l.annotationLayer.fillOpacity));a.promptElement.textContent="Fill opacity";l.element.appendChild(a.element);
-a=l.registerDisposer(new B.a(l.annotationLayer.color));a.element.title="Change annotation display color";b.appendChild(a.element);c.source.readonly||(c=document.createElement("button"),c.textContent=Object(k.g)(k.c.POINT).icon,c.title="Annotate point",c.addEventListener("click",function(){l.layer.tool.value=new aa(l.layer,{})}),b.appendChild(c),c=document.createElement("button"),c.textContent=Object(k.g)(k.c.AXIS_ALIGNED_BOUNDING_BOX).icon,c.title="Annotate bounding box",c.addEventListener("click",
-function(){l.layer.tool.value=new ba(l.layer,{})}),b.appendChild(c),c=document.createElement("button"),c.textContent=Object(k.g)(k.c.LINE).icon,c.title="Annotate line",c.addEventListener("click",function(){l.layer.tool.value=new ka(l.layer,{})}),b.appendChild(c),c=document.createElement("button"),c.textContent=Object(k.g)(k.c.ELLIPSOID).icon,c.title="Annotate ellipsoid",c.addEventListener("click",function(){l.layer.tool.value=new fa(l.layer,{})}),b.appendChild(c));l.element.appendChild(b);l.element.appendChild(l.annotationListContainer);
-l.annotationListContainer.addEventListener("mouseleave",function(){l.annotationLayer.hoverState.value=void 0});l.registerDisposer(l.annotationLayer.hoverState.changed.add(function(){return l.updateHoverView()}));l.registerDisposer(l.state.changed.add(function(){return l.updateSelectionView()}));return l}n(d,a);P(d,[{key:"updateSelectionView",value:function(){var a=this.state.value;if(void 0!==a)var b=a.id;a=this.previousSelectedId;b!==a&&(void 0!==a&&(a=this.annotationListElements.get(a),void 0!==
-a&&a.classList.remove("neuroglancer-annotation-selected")),void 0!==b&&(a=this.annotationListElements.get(b),void 0!==a&&(a.classList.add("neuroglancer-annotation-selected"),a.scrollIntoView())),this.previousSelectedId=b)}},{key:"updateHoverView",value:function(){var a=this.annotationLayer.hoverState.value;if(void 0!==a)var b=a.id;a=this.previousHoverId;b!==a&&(void 0!==a&&(a=this.annotationListElements.get(a),void 0!==a&&a.classList.remove("neuroglancer-annotation-hover")),void 0!==b&&(a=this.annotationListElements.get(b),
-void 0!==a&&a.classList.add("neuroglancer-annotation-hover")),this.previousHoverId=b)}},{key:"updateView",value:function(){var a=this;if(this.visible&&!this.updated){var b=this.annotationLayer,d=this.annotationListContainer,e=this.annotationListElements,g=b.source;Object(y.a)(d);this.annotationListElements.clear();b=b.objectToGlobal;var k={};g=$jscomp.makeIterator(g);for(var l=g.next();!l.done;k={annotation:k.annotation},l=g.next())k.annotation=l.value,l=this.makeAnnotationListElement(k.annotation,
-b),d.appendChild(l),e.set(k.annotation.id,l),l.addEventListener("mouseenter",function(b){return function(){a.annotationLayer.hoverState.value={id:b.annotation.id,partIndex:0}}}(k)),l.addEventListener("click",function(b){return function(){a.state.value={id:b.annotation.id,partIndex:0}}}(k)),l.addEventListener("mouseup",function(b){return function(d){2===d.button&&a.setSpatialCoordinates(c(b.annotation,a.annotationLayer.objectToGlobal))}}(k));this.previousHoverId=this.previousSelectedId=void 0;this.updated=
-!0;this.updateHoverView();this.updateSelectionView()}}},{key:"makeAnnotationListElement",value:function(a,c){var d=document.createElement("li");d.title="Click to select, right click to recenter view.";var e=document.createElement("div");e.className="neuroglancer-annotation-icon";e.textContent=Object(k.g)(a.type).icon;d.appendChild(e);e=document.createElement("div");e.className="neuroglancer-annotation-position";b(e,a,c,this.voxelSize,this.setSpatialCoordinates);d.appendChild(e);a.description&&(c=
-document.createElement("div"),c.className="neuroglancer-annotation-description",c.textContent=a.description,d.appendChild(c));return d}}]);return d}(L.b),H=function(a){function c(a,b,d){q(this,c);var e=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));e.state=a;e.voxelSize=b;e.setSpatialCoordinates=d;e.valid=!1;e.mouseEntered=!1;e.element.classList.add("neuroglancer-annotation-details");e.registerDisposer(a);e.registerDisposer(b);e.registerDisposer(e.state.changed.add(function(){e.valid=
-!1;e.updateView()}));e.registerDisposer(e.visibility.changed.add(function(){return e.updateView()}));e.state.changed.add(function(){e.valid=!1;e.updateView()});e.element.addEventListener("mouseenter",function(){e.mouseEntered=!0;void 0!==e.hoverState&&(e.hoverState.value=e.state.value)});e.element.addEventListener("mouseleave",function(){e.mouseEntered=!1;void 0!==e.hoverState&&(e.hoverState.value=void 0)});e.updateView();return e}n(c,a);P(c,[{key:"updateView",value:function(){var a=this;if(this.visible){if(this.element.style.display=
-null,!this.valid){var c=this.element;Object(y.a)(c);this.valid=!0;var d=this.state.reference;if(void 0!==d){var e=this.state.value,g=d.value;if(null!=g){var l=this.state.annotationLayerState.value;this.hoverState=l.hoverState;this.mouseEntered&&(this.hoverState.value=e);var m=l.objectToGlobal,r=this.voxelSize,f=Object(k.g)(g.type),t=document.createElement("div");t.className="neuroglancer-annotation-details-title";var u=document.createElement("div");u.className="neuroglancer-annotation-details-icon";
-u.textContent=f.icon;var h=document.createElement("div");h.className="neuroglancer-annotation-details-title-text";h.textContent=""+f.description;t.appendChild(u);t.appendChild(h);l.source.readonly||(f=Object(J.a)("\ud83d\uddd1","Delete annotation"),f.addEventListener("click",function(){var a=l.source.getReference(e.id);try{l.source.delete(a)}finally{a.dispose()}}),t.appendChild(f));f=Object(C.a)();f.title="Hide annotation details";f.addEventListener("click",function(){a.state.value=void 0});t.appendChild(f);
-c.appendChild(t);t=document.createElement("div");t.className="neuroglancer-annotation-details-position";b(t,g,m,r,this.setSpatialCoordinates);c.appendChild(t);g.type===k.c.AXIS_ALIGNED_BOUNDING_BOX?(t=document.createElement("div"),t.className="neuroglancer-annotation-details-volume",t.textContent=Object(D.a)(g.pointA,g.pointB,m),c.appendChild(t),t=Object(x.p)(U,x.s.subtract(U,g.pointA,g.pointB),m),m=document.createElement("div"),m.className="neuroglancer-annotation-details-volume-in-voxels",r=r.voxelFromSpatial(U,
-t),m.textContent=""+Object(D.b)(r),c.appendChild(m)):g.type===k.c.LINE&&(f=Object(x.p)(U,x.s.subtract(U,g.pointA,g.pointB),m),m=document.createElement("div"),m.className="neuroglancer-annotation-details-length",t=Object(D.d)(x.s.length(f)),u="",r.valid&&(r=x.s.length(r.voxelFromSpatial(U,f)),u=", "+Math.round(r)+" vx"),m.textContent=t+u,c.appendChild(m));r=this.segmentListWidget;void 0!==r&&r.reference!==d&&(r.dispose(),this.unregisterDisposer(r),r=this.segmentListWidget=void 0);void 0===r&&(this.segmentListWidget=
-r=this.registerDisposer(new N(d,l)));c.appendChild(r.element);var v=document.createElement("textarea");v.value=g.description||"";v.rows=3;v.className="neuroglancer-annotation-details-description";v.placeholder="Description";l.source.readonly?v.readOnly=!0:v.addEventListener("change",function(){var a=v.value;l.source.update(d,Object.assign({},g,{description:a?a:void 0}));l.source.commit(d)});c.appendChild(v)}}}}else this.element.style.display="none",this.hoverState=void 0}}]);return c}(L.b),Q=function(a){function b(a,
-c,d,e){q(this,b);var g=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));g.layer=a;g.state=c;g.voxelSize=d;g.setSpatialCoordinates=e;g.stack=g.registerDisposer(new L.a(function(a){return new Z(g.layer,g.state.addRef(),a.addRef(),g.voxelSize.addRef(),g.setSpatialCoordinates)},g.visibility));g.detailsTab=g.registerDisposer(new H(g.state,g.voxelSize.addRef(),g.setSpatialCoordinates));g.registerDisposer(c);g.registerDisposer(d);a=g.element;a.classList.add("neuroglancer-annotations-tab");g.stack.element.classList.add("neuroglancer-annotations-stack");
-a.appendChild(g.stack.element);a.appendChild(g.detailsTab.element);a=function(){g.detailsTab.visibility.value=void 0!==g.state.validValue&&g.visible?G.b.VISIBLE:G.b.IGNORED};g.registerDisposer(g.state.changed.add(a));g.registerDisposer(g.visibility.changed.add(a));a=function(){g.stack.selected=g.state.annotationLayerState.value};g.registerDisposer(g.state.annotationLayerState.changed.add(a));a();return g}n(b,a);return b}(L.b);a=function(a){function b(a,c){q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));
-d.layer=a;if(void 0===a.annotationLayerState)throw Error("Invalid layer for annotation tool.");d.annotationDescription=Object(A.v)(c,"description",A.y);return d}n(b,a);P(b,[{key:"annotationLayer",get:function(){return this.layer.annotationLayerState.value}}]);return b}(h.a);var aa=function(a){function b(a,c){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c))}n(b,a);P(b,[{key:"trigger",value:function(a){var b=this.annotationLayer;void 0!==b&&a.active&&(a={id:"",description:"",
-segments:e(b),point:x.s.transformMat4(x.s.create(),a.position,b.globalToObject),type:k.c.POINT},b=b.source.add(a,!0),this.layer.selectedAnnotation.value={id:b.id},b.dispose())}},{key:"toJSON",value:function(){return"annotatePoint"}},{key:"description",get:function(){return"annotate point"}}]);return b}(a);a=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);P(b,[{key:"trigger",value:function(a){var b=this,c=this.annotationLayer;if(void 0!==
-c&&a.active){var d=function(){var d=b.inProgressAnnotation,e=d.reference,g=b.getUpdatedAnnotation(e.value,a,c);d.annotationLayer.source.update(e,g);b.layer.selectedAnnotation.value={id:e.id}};if(void 0===this.inProgressAnnotation){var e=c.source.add(this.getInitialAnnotation(a,c),!1);this.layer.selectedAnnotation.value={id:e.id};var g=a.changed.add(d);this.inProgressAnnotation={annotationLayer:c,reference:e,disposer:function(){g();e.dispose()}}}else d(),this.inProgressAnnotation.annotationLayer.source.commit(this.inProgressAnnotation.reference),
-this.inProgressAnnotation.disposer(),this.inProgressAnnotation=void 0}}},{key:"disposed",value:function(){this.deactivate();M(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"deactivate",value:function(){void 0!==this.inProgressAnnotation&&(this.inProgressAnnotation.annotationLayer.source.delete(this.inProgressAnnotation.reference),this.inProgressAnnotation.disposer(),this.inProgressAnnotation=void 0)}}]);return b}(a);f=function(a){function b(){q(this,
-b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);P(b,[{key:"getInitialAnnotation",value:function(a,b){a=g(a,b);return{id:"",type:this.annotationType,description:"",pointA:a,pointB:a}}},{key:"getUpdatedAnnotation",value:function(a,b,c){b=g(b,c);return Object.assign({},a,{pointB:b})}}]);return b}(a);var ba=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);P(b,[{key:"toJSON",value:function(){return"annotateBoundingBox"}},
-{key:"description",get:function(){return"annotate bounding box"}}]);return b}(f);ba.prototype.annotationType=k.c.AXIS_ALIGNED_BOUNDING_BOX;var ka=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);P(b,[{key:"getInitialAnnotation",value:function(a,c){a=M(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"getInitialAnnotation",this).call(this,a,c);a.segments=e(c);return a}},{key:"getUpdatedAnnotation",value:function(a,c,d){a=
-M(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"getUpdatedAnnotation",this).call(this,a,c,d);var g=a.segments;void 0!==g&&0<g.length&&(g.length=1);(d=e(d))&&g&&(d=d.filter(function(a){return-1===g.findIndex(function(b){return E.a.equal(a,b)})}));a.segments=[].concat($jscomp.arrayFromIterable(g||[]),$jscomp.arrayFromIterable(d||[]))||void 0;return a}},{key:"toJSON",value:function(){return"annotateLine"}},{key:"description",get:function(){return"annotate line"}}]);return b}(f);ka.prototype.annotationType=
-k.c.LINE;var fa=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);P(b,[{key:"getInitialAnnotation",value:function(a,b){a=g(a,b);return{type:k.c.ELLIPSOID,id:"",description:"",segments:e(b),center:a,radii:x.s.fromValues(0,0,0)}}},{key:"getUpdatedAnnotation",value:function(a,b,c){var d=x.s.transformMat4(x.s.create(),a.center,c.objectToGlobal);d=x.s.distance(d,b.position);b=x.i.create();b[0]=b[4]=b[8]=1/(d*d);c=Object(x.j)(x.i.create(),
-c.objectToGlobal);x.i.multiply(b,b,c);x.i.transpose(c,c);x.i.multiply(b,c,b);return Object.assign({},a,{radii:x.s.fromValues(1/Math.sqrt(b[0]),1/Math.sqrt(b[4]),1/Math.sqrt(b[8]))})}},{key:"toJSON",value:function(){return"annotateSphere"}},{key:"description",get:function(){return"annotate ellipsoid"}}]);return b}(a);Object(h.b)("annotatePoint",function(a,b){return new aa(a,b)});Object(h.b)("annotateBoundingBox",function(a,b){return new ba(a,b)});Object(h.b)("annotateLine",function(a,b){return new ka(a,
-b)});Object(h.b)("annotateSphere",function(a,b){return new fa(a,b)})},function(h,f,a){f.a=function(){return Object(q.a)("\u274c")};var q=a(110)},function(h,f,a){f.a=function(a,f){var h=document.createElement("div"),d=document.createElement("div");d.textContent=a;h.className="neuroglancer-icon-button";h.appendChild(d);void 0!==f&&(h.title=f);return h};h=a(285);a.n(h)},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||
-"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}f.a=function(a){return function(a){function e(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");
-var g,k=q(this,(g=e.__proto__||Object.getPrototypeOf(e)).call.apply(g,[].concat([this],$jscomp.arrayFromIterable(b))));k.transform=new n.a;k.transform.changed.add(k.specificationChanged.dispatch);k.tabs.add("transform",{label:"Transform",order:100,getter:function(){return new d.a(k.transform)}});k.transform.restoreState(b[1].transform);return k}p(e,a);b(e,[{key:"toJSON",value:function(){var a=c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"toJSON",this).call(this);a.transform=this.transform.toJSON();
-return a}}]);return e}(a)};var n=a(58),d=a(289),b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),c=function g(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return g(a,b,c)}else{if("value"in d)return d.value;b=d.get;
-return void 0===b?void 0:b.call(c)}}},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,
-b):a.__proto__=b)}a.d(f,"a",function(){return g});h=a(291);a.n(h);h=a(292);a.n(h);h=a(169);a.n(h);h=a(170);a.n(h);h=a(48);var n=a.n(h);h=a(10);var d=a.n(h);h=a(1);var b=a(8),c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),e=function k(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,
-b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return k(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a(293)(n.a);var g=function(a){function g(a){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var b=q(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));b.state=a;b.changingValue=!1;b.debouncedValueUpdater=d()(function(){b.changingValue=!0;try{b.state.fragmentMain.value=b.textEditor.getValue()}finally{b.changingValue=
-!1}},500);b.textEditor=n()(function(a){},{value:b.state.fragmentMain.value,mode:"glsl",gutters:["CodeMirror-lint-markers"]});b.textEditor.on("change",function(){b.setValidState(void 0);b.debouncedValueUpdater()});b.registerDisposer(b.state.fragmentMain.changed.add(function(){b.changingValue||b.textEditor.setValue(b.state.fragmentMain.value)}));b.element.classList.add("neuroglancer-shader-code-widget");b.registerDisposer(b.state.shaderError.changed.add(function(){b.updateErrorState()}));b.updateErrorState();
-return b}p(g,a);c(g,[{key:"updateErrorState",value:function(){var a=this,b=this.state.shaderError.value;void 0===b?this.setValidState(void 0):null!==b?(this.textEditor.setOption("lint",{getAnnotations:function(){if("ShaderCompilationError"===b.name){var c=b.source.split("\n").indexOf(a.state.fragmentMainStartLine)+2;return b.errorMessages.map(function(a){return{message:a.message,severity:"error",from:n.a.Pos(void 0===a.line?0:a.line-c)}})}return"ShaderLinkError"===b.name?[{message:b.log,severity:"error",
-from:n.a.Pos(0)}]:[{message:b.message,severity:"error",from:n.a.Pos(0)}]}}),this.setValidState(!1)):(this.textEditor.setOption("lint",void 0),this.setValidState(!0))}},{key:"setValidState",value:function(a){var b=this.element;b.classList.remove("invalid-input");b.classList.remove("valid-input");!0===a?b.classList.add("valid-input"):!1===a&&b.classList.add("invalid-input")}},{key:"disposed",value:function(){this.debouncedValueUpdater.flush();this.debouncedValueUpdater=void 0;Object(b.b)(this.element);
-this.textEditor=void 0;e(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",this).call(this)}},{key:"element",get:function(){return this.textEditor.getWrapperElement()}}]);return g}(h.a)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a){return a-Math.floor(a)}a.d(f,"b",function(){return l});a.d(f,"a",function(){return m});var n=a(114),d=a(115),b=a(149),c=a(7),e=a(21),g=function(){function a(a,b){for(var c=
-0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),l=function(){function a(b){q(this,a);this.prefix=b;this.aName=this.prefix+"_a";this.bName=this.prefix+"_b"}g(a,[{key:"defineShader",value:function(a){var b=this.aName,c=this.bName;a.addUniform("highp vec4",b,4);a.addUniform("highp float",c,4);a.addFragmentCode(e.n);a.addFragmentCode(d.d);a.addFragmentCode(e.h);
-for(var g="\nvec3 "+this.prefix+"(uint64_t x) {\n  vec2 v;\n  float primeModulus = float("+n.b+");\n",k=0;2>k;++k){var l=2*k,m=2*k;g+="\n  v["+k+"] = computeHash(x,\n                        "+b+"["+m+"], "+b+"["+(m+1)+"],\n                        "+c+"["+l+"], "+c+"["+(l+1)+"],\n                        primeModulus, 1.0 / 256.0);\n"}a.addFragmentCode(g+"\n  vec3 hsv = vec3(v.x, 0.5 + v.y * 0.5, 1.0);\n  return hsvToRgb(hsv);\n}\n")}},{key:"enable",value:function(a,b,c){a.uniform4fv(b.uniform(this.aName),
-c.a_);a.uniform1fv(b.uniform(this.bName),c.b_)}}]);return a}(),k=new Float32Array(2),t=new Float32Array(3),m=function(){function a(b){q(this,a);this.a_=new Float32Array(16);this.b_=new Float32Array(4);this.changed=new c.a;null==b?(this.hashFunctions=Array(2),this.randomize_()):this.hashFunctions=b;this.computeGPUCoefficients_()}g(a,[{key:"compute",value:function(a,c){var d=c.low;c=c.high;for(var e=this.hashFunctions,g=0;2>g;++g)k[g]=p(e[g].compute(d,c)/256);Object(b.a)(a,k[0],.5+.5*k[1],1);return a}},
-{key:"computeCssColor",value:function(a){this.compute(t,a);return"rgb("+100*t[0]+"%,"+100*t[1]+"%,"+100*t[2]+"%)"}},{key:"debugCompute",value:function(a,b){var c=b.low;b=b.high;for(var d=this.b_,e=n.b,g=0;2>g;++g){for(var k=2*g,l=2*g,m=new Float32Array(2),r=0;4>r;++r)m[0]+=this.a_[4*l+r]*(c>>8*r&255),m[1]+=this.a_[4*(l+1)+r]*(b>>8*r&255);l=(m[0]+m[1])%e;r=l*l%e;var f=r*d[k+1]%e,t=(d[k]+l+f)%e;console.log("b = "+d[k]+", sums="+m[0]+" "+m[1]+", dotResult="+l+", "+("prod = "+l*l+" dotResult2="+r+", y="+
-f+", ")+("modResult="+t));a[g]=p(1/256*t)}return a}},{key:"randomize_",value:function(){for(var a=0;2>a;++a)this.hashFunctions[a]=n.a.generate()}},{key:"randomize",value:function(){this.randomize_();this.computeGPUCoefficients_();this.changed.dispatch()}},{key:"toString",value:function(){return"new SegmentColorHash(["+this.hashFunctions+"])"}},{key:"computeGPUCoefficients_",value:function(){for(var a=this.hashFunctions,b=this.a_,c=this.b_,d=0;2>d;++d){var e=a[d],g=2*d,k=8*d;c[g]=1*e.b;c[g+1]=1*e.c;
-for(g=0;4>g;++g)b[k+g]=1*e.a0[g],b[k+4+g]=1*e.a1[g]}}}],[{key:"getDefault",value:function(){return new a([new n.a(Float32Array.of(609,2364,3749,2289),Float32Array.of(2840,1186,3660,1833),1718,1109),new n.a(Float32Array.of(3466,3835,3345,2040),Float32Array.of(3382,901,18,3444),1534,1432)])}}]);return a}()},function(h,f,a){a.d(f,"a",function(){return p});var q=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);
-Object.defineProperty(a,d.key,d)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}();f.b=4093;var p=function(){function a(d,b,c,e){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.a0=d;this.a1=b;this.b=c;this.c=e}q(a,[{key:"computeDotProduct",value:function(a,b){var c=this.a0,d=this.a1;return c[0]*(a&255)+c[1]*(a>>8&255)+c[2]*(a>>16&255)+c[3]*(a>>24&255)+(d[0]*(b&255)+d[1]*(b>>8&255)+d[2]*(b>>16&255)+d[3]*(b>>24&255))}},{key:"compute",value:function(a,
-b){var c=this.b,d=this.c;a=this.computeDotProduct(a,b);return(a+a*a%4093*d+c)%4093}},{key:"toString",value:function(){return"new HashFunction(Float32Array.of("+this.a0+"), "+("Float32Array.of("+this.a1+"), "+this.b+", "+this.c+")")}}],[{key:"generate",value:function(){function d(){return Math.floor(4093*Math.random())}return new a(Float32Array.of(d(),d(),d(),d()),Float32Array.of(d(),d(),d(),d()),d(),d())}}]);return a}()},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
-}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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)}a.d(f,"a",function(){return t});
-a.d(f,"c",function(){return m});a.d(f,"b",function(){return r});var d=a(114),b=a(66);h=a(1);var c=a(21),e=a(77),g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),l=function v(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==
-a)return v(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},k=[c.q,c.n,c.e,c.i,"\nfloat computeHash(uint64_t x, vec4 a0, vec4 a1, float b, float c, float modulus, float scalar) {\n  x.low = unnormalizeUint8(x.low);\n  x.high = unnormalizeUint8(x.high);\n  float dotResult = imod(exactDot(a0, x.low) + exactDot(a1, x.high), modulus);\n  float dotResult2 = imod(dotResult * dotResult, modulus);\n  float y = imod(dotResult2 * c, modulus);\n  float modResult = imod(dotResult + y + b, modulus);\n  return fract(modResult * scalar);\n}\n"];
-f.d=k;var t=function(a){function b(a,c){q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.gl=a;d.hashTable=c;d.hashFunctions=null;d.generation=-1;d.texture=null;c=c.hashFunctions.length;d.a=new Float32Array(16*c);d.b=new Float32Array(4*c+5);d.texture=a.createTexture();return d}n(b,a);g(b,[{key:"computeCoefficients",value:function(){var a=this.hashTable,b=a.hashFunctions;if(this.hashFunctions!==b){this.hashFunctions=b;for(var c=this.a,e=this.b,g=b.length,k=a.width,l=[1/k,
-1/a.height],m=0;2>m;++m)e[4*g+m]=d.b,e[4*g+3+m]=l[m];e[4*g+2]=1/(a.entryStride*k);for(k=0;k<g;++k)for(l=b[k],m=0;2>m;++m){var r=l[m],f=4*k+2*m,t=4*(4*k+2*m);e[f]=r.b+(0===m?.5/a.entryStride:.5);e[f+1]=r.c;for(f=0;4>f;++f)c[t+f]=r.a0[f],c[t+4+f]=r.a1[f]}}}},{key:"copyToGPU",value:function(){this.computeCoefficients();var a=this.hashTable,b=a.generation;if(this.generation!==b){this.generation=b;var c=a.width,d=a.height,g=this.gl;b=this.texture;g.activeTexture(g.TEXTURE0+g.tempTextureUnit);g.bindTexture(g.TEXTURE_2D,
-b);g.pixelStorei(g.UNPACK_ALIGNMENT,1);Object(e.b)(g);var k=g.RGBA8,l=g.RGBA;a.tableWithMungedEmptyKey(function(b){g.texImage2D(g.TEXTURE_2D,0,k,c*a.entryStride,d,0,l,g.UNSIGNED_BYTE,new Uint8Array(b.buffer))});g.bindTexture(g.TEXTURE_2D,null)}}},{key:"disposed",value:function(){this.gl.deleteTexture(this.texture);this.texture=null;this.hashTable=this.gl=void 0;this.hashFunctions=null;l(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}}],[{key:"get",value:function(a,
-b){var c=this;return a.memoize.get(b,function(){return new c(a,b)})}}]);return b}(h.a),m=function(){function a(c,d){d=void 0===d?b.c:d;q(this,a);this.prefix=c;this.numAlternatives=d;$jscomp.initSymbol();this.textureUnitSymbol=Symbol.for("gpuhashtable:"+this.prefix);this.aName=this.prefix+"_a";this.bName=this.prefix+"_b";this.samplerName=this.prefix+"_sampler"}g(a,[{key:"defineShader",value:function(a){var b=this.aName,c=this.bName,d=this.samplerName,e=this.numAlternatives;a.addUniform("highp vec4",
-b,4*e);a.addUniform("highp float",c,4*e+5);a.addTextureSampler2D(d,this.textureUnitSymbol);a.addFragmentCode(k);for(var g="",l=0;l<e;++l){for(var m=0;2>m;++m){var r=4*l+2*m,f=4*l+2*m;g+="\nfloat "+this.prefix+"_computeHash_"+l+"_"+m+"(uint64_t x) {\n  float primeModulus = "+c+"["+(4*e+m)+"];\n  float scalar = "+c+"["+(4*e+3+m)+"];\n  return computeHash(x,\n                     "+b+"["+f+"], "+b+"["+(f+1)+"],\n                     "+c+"["+r+"], "+c+"["+(r+1)+"],\n                     primeModulus, scalar);\n}\n"}g+=
-"\nvec2 "+this.prefix+"_computeHash_"+l+"(uint64_t x) {\n  vec2 v;\n  v[0] = "+this.prefix+"_computeHash_"+l+"_0(x);\n  v[1] = "+this.prefix+"_computeHash_"+l+"_1(x);\n  return v;\n}\n"}g+="\nbool "+this.hasFunctionName+"(uint64_t x) {\n  float highOffset = "+c+"["+(4*e+2)+"];\n";for(b=0;b<e;++b)g+="\n  {\n    vec2 v = "+this.prefix+"_computeHash_"+b+"(x);\n    vec4 lowResult = texture("+d+", v);\n    vec4 highResult = texture("+d+", vec2(v.x + highOffset, v.y));\n    if (lowResult == x.low && highResult == x.high) {\n      return true;\n    }\n  }\n";
-a.addFragmentCode(g+"\n  return false;\n}\n")}},{key:"enable",value:function(a,b,c){c.copyToGPU();var d=b.textureUnit(this.textureUnitSymbol);a.activeTexture(a.TEXTURE0+d);a.bindTexture(a.TEXTURE_2D,c.texture);a.uniform4fv(b.uniform(this.aName),c.a);a.uniform1fv(b.uniform(this.bName),c.b)}},{key:"disable",value:function(a,b){b=b.textureUnit(this.textureUnitSymbol);a.activeTexture(a.TEXTURE0+b);a.bindTexture(a.TEXTURE_2D,null)}},{key:"hasFunctionName",get:function(){return this.prefix+"_has"}}]);return a}(),
-r=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);g(b,[{key:"defineShader",value:function(a){l(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);for(var c=this.samplerName,d=this.numAlternatives,e="\nbool "+this.getFunctionName+"(uint64_t x, out uint64_t value) {\n  float highOffset = "+this.bName+"["+(4*d+2)+"];\n",g=0;g<d;++g)e+="\n  {\n    vec2 v = "+this.prefix+"_computeHash_"+g+"(x);\n    vec4 lowResult = texture("+
-c+", v);\n    vec4 highResult = texture("+c+", vec2(v.x + highOffset, v.y));\n    if (lowResult == x.low && highResult == x.high) {\n      value.low = texture("+c+", vec2(v.x + 2.0 * highOffset, v.y));\n      value.high = texture("+c+", vec2(v.x + 3.0 * highOffset, v.y));\n      return true;\n    }\n  }\n";a.addFragmentCode(e+"\n  return false;\n}\n")}},{key:"getFunctionName",get:function(){return this.prefix+"_get"}}]);return b}(m)},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function d(){return new m.c([],function(a){return Object(v.a)(a,
-v.y)})}function b(a){return Object(E.a)(a.dataType,a.numComponents)}function c(a){return a.map(function(a){return Object(z.c)(new z.b,a.dataType,a.numComponents)})}function e(a,b){return a.memoize.getUncounted({type:"single_mesh:getMeshInfo",parameters:b},function(){return a.rpc.promiseInvoke(t.a,{chunkManager:a.addCounterpartRef(),parameters:b})})}a.d(f,"b",function(){return L});f.e=b;a.d(f,"d",function(){return M});a.d(f,"c",function(){return Z});f.f=function(a,b){return e(a,b).then(function(c){return a.getChunkSource(S,
-{parameters:Object.assign({},b,{info:c})})})};var g=a(30);h=a(24);var l=a(58),k=a(59),t=a(177),m=a(9),r=a(50),u=a(2),v=a(4),w=a(23),y=a(29),x=a(55),A=a(140),z=a(117),D=a(25),E=a(21),G=a(15),C=function Q(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return Q(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},B=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];
-d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();f.a="//NEUROGLANCER_SINGLE_MESH_LAYER_FRAGMENT_MAIN_START";var F=a(105),L=function aa(){n(this,aa);this.shaderError=Object(x.c)();var a=void 0;this.fragmentMain=new m.c(void 0===a?"void main() {\n  emitGray();\n}\n":a,v.A);this.attributeNames=d();this.objectToDataTransform=new l.a};$jscomp.initSymbol();var J=Symbol("SingleMeshShaderManager.vertexAttributeTextureUnit"),
-O=Object(z.c)(new z.b,r.b.FLOAT32,3),M=function(){function a(b,c,d){n(this,a);this.attributeNames=b;this.attributeInfo=c;this.fragmentMain=d;this.tempLightVec=new Float32Array(4);this.tempPickID=new Float32Array(4);this.textureAccessHelper=new z.a("vertexData");this.indexBufferHelper=new A.a("VertexIndex")}B(a,[{key:"defineAttributeAccess",value:function(a,c){var d=this.textureAccessHelper;d.defineShader(a);a.addVertexCode(d.getAccessor("readVertexPosition","uVertexAttributeSampler[0]",r.b.FLOAT32,
-3));a.addVertexCode(d.getAccessor("readVertexNormal","uVertexAttributeSampler[1]",r.b.FLOAT32,3));var e=2,g="\nvec3 vertexPosition = readVertexPosition("+c+");\nvec3 vertexNormal = readVertexNormal("+c+");\n",k=this.attributeNames;this.attributeInfo.forEach(function(l,m){if(void 0!==k[m]){var r=b(l);a.addVarying("highp "+r,"vCustom"+m);a.addFragmentCode("\n#define "+k[m]+" vCustom"+m+"\n");a.addVertexCode(d.getAccessor("readAttribute"+m,"uVertexAttributeSampler["+e+"]",l.dataType,l.numComponents));
-g+="vCustom"+m+" = readAttribute"+m+"("+c+");\n";e+=1}});a.addTextureSampler2D("uVertexAttributeSampler",J,e);a.addVertexMain(g)}},{key:"defineShader",value:function(a){a.require(A.b);this.indexBufferHelper.defineShader(a);a.addVarying("highp float","vLightingFactor");a.addUniform("highp vec4","uLightDirection");a.addUniform("highp vec4","uColor");a.addUniform("highp mat4","uModelMatrix");a.addUniform("highp mat4","uProjection");a.addUniform("highp vec4","uPickID");a.addVarying("highp vec4","vPickID");
-a.addVertexCode(E.b);a.addVertexCode(E.c);a.addVertexMain("\nfloat vertexIndex = getVertexIndex();\nuint32_t triangleIndex;\ndivmod(getPrimitiveIndex(), 3.0, triangleIndex);\nuint32_t pickID; pickID.value = uPickID;\nvPickID = add(pickID, triangleIndex).value;\n");a.addFragmentCode("\nvoid emitPremultipliedRGBA(vec4 color) {\n  emit(vec4(color.rgb * vLightingFactor, color.a), vPickID);\n}\nvoid emitRGBA(vec4 color) {\n  color = clamp(color, 0.0, 1.0);\n  color.xyz *= color.a;\n  emitPremultipliedRGBA(color);\n}\nvoid emitRGB(vec3 color) {\n  emitRGBA(vec4(color, 1.0));\n}\nvoid emitGray() {\n  emitRGB(vec3(1.0, 1.0, 1.0));\n}\n");
-a.addFragmentCode(F);this.defineAttributeAccess(a,"vertexIndex");a.addVertexMain("\ngl_Position = uProjection * (uModelMatrix * vec4(vertexPosition, 1.0));\nvec3 normal = normalize((uModelMatrix * vec4(vertexNormal, 0.0)).xyz);\nvLightingFactor = abs(dot(normal, uLightDirection.xyz)) + uLightDirection.w;\n");a.setFragmentMainFunction("//NEUROGLANCER_SINGLE_MESH_LAYER_FRAGMENT_MAIN_START\n"+this.fragmentMain)}},{key:"beginLayer",value:function(a,b,c){var d=c.dataToDevice,e=c.lightDirection,g=c.ambientLighting;
-c=c.directionalLighting;a.uniformMatrix4fv(b.uniform("uProjection"),!1,d);d=this.tempLightVec;u.s.scale(d,e,c);d[3]=g;a.uniform4fv(b.uniform("uLightDirection"),d)}},{key:"setPickID",value:function(a,b,c){a.uniform4fv(b.uniform("uPickID"),Object(E.r)(this.tempPickID,c))}},{key:"beginObject",value:function(a,b,c){a.uniformMatrix4fv(b.uniform("uModelMatrix"),!1,c)}},{key:"getShader",value:function(a,b){var c=this,d={attributeNames:this.attributeNames,attributeInfo:this.attributeInfo,fragmentMain:this.fragmentMain};
-return a.memoize.get("single_mesh/SingleMeshShaderManager:"+Object(w.a)(b)+":"+Object(v.g)(d),function(){var d=new D.a(a);d.require(b);c.defineShader(d);return d.build()})}},{key:"bindVertexData",value:function(a,b,c){this.textureAccessHelper.setupTextureLayout(a,b,c);var d=b.textureUnit(J)+a.TEXTURE0,e=function(b){a.activeTexture(d++);a.bindTexture(a.TEXTURE_2D,b)};e(c.vertexTexture);e(c.normalTexture);var g=this.attributeNames;c.vertexAttributeTextures.forEach(function(a,b){void 0!==g[b]&&e(a)})}},
-{key:"disableVertexData",value:function(a,b){for(var c=2,d=this.attributeInfo.length,e=this.attributeNames,g=0;g<d;++g)void 0!==e[g]&&++c;b=b.textureUnit(J)+a.TEXTURE0;for(d=0;d<c;++d)a.activeTexture(b++),a.bindTexture(a.TEXTURE_2D,null)}},{key:"drawFragment",value:function(a,b,c,d){d.ensure(c.numIndices).bind(b);this.bindVertexData(a,b,c.vertexData);this.indexBufferHelper.bind(c.indexBuffer,b);a.drawArrays(a.TRIANGLES,0,c.numIndices)}},{key:"endLayer",value:function(a,b){Object(A.c)(a,b);this.indexBufferHelper.disable(b);
-this.disableVertexData(a,b)}}]);return a}(),P=function(){function a(){n(this,a)}B(a,[{key:"copyToGPU",value:function(a,b){var c=this;Object(z.d)(this,a,1,this.vertexPositions.length/3);var d=function(b,d){var e=a.createTexture();a.bindTexture(a.TEXTURE_2D,e);Object(z.f)(a,c,d,b);return e};this.vertexTexture=d(this.vertexPositions,O);this.normalTexture=d(this.vertexNormals,O);this.vertexAttributeTextures=this.vertexAttributes.map(function(a,c){return d(a,b[c])});a.bindTexture(a.TEXTURE_2D,null)}},
-{key:"freeGPUMemory",value:function(a){a.deleteTexture(this.vertexTexture);a.deleteTexture(this.normalTexture);for(var b=this.vertexAttributeTextures,c=$jscomp.makeIterator(b),d=c.next();!d.done;d=c.next())a.deleteTexture(d.value);b.length=0}}]);return a}(),N=function(a){function b(a,c){n(this,b);a=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));var d=a.vertexData=new P;d.vertexPositions=c.vertexPositions;d.vertexNormals=c.vertexNormals;d.vertexAttributes=c.vertexAttributes;c=a.indices=
-c.indices;a.numIndices=c.length;return a}p(b,a);B(b,[{key:"copyToGPU",value:function(a){C(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"copyToGPU",this).call(this,a);this.vertexData.copyToGPU(a,this.source.attributeTextureFormats);this.indexBuffer=Object(A.e)(a,this.indices)}},{key:"freeGPUMemory",value:function(a){C(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"freeGPUMemory",this).call(this,a);this.vertexData.freeGPUMemory(a);this.indexBuffer.dispose()}}]);return b}(h.b),
-S=function(a){function b(){n(this,b);var a=q(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.attributeTextureFormats=c(a.info.vertexAttributes);return a}p(b,a);B(b,[{key:"getChunk",value:function(a){return new N(this,a)}},{key:"info",get:function(){return this.parameters.info}}]);return b}(Object(h.f)(h.e,t.d)),U=function(a){function b(){n(this,b);return q(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}p(b,a);return b}(Object(y.c)(G.b)),Z=function(a){function b(a,
-c){n(this,b);var d=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.source=a;d.displayState=c;d.shaders=new Map;d.sharedObject=d.registerDisposer(new U);d.fallbackFragmentMain="void main() {\n  emitGray();\n}\n";d.countingBuffer=d.registerDisposer(Object(A.d)(d.gl));d.displayState.shaderError.value=void 0;var e=function(){d.shaderManager=void 0;d.displayState.shaderError.value=void 0;d.disposeShaders();d.redrawNeeded.dispatch()};d.registerDisposer(c.fragmentMain.changed.add(e));d.registerDisposer(c.attributeNames.changed.add(e));
-d.registerDisposer(c.objectToDataTransform.changed.add(function(){d.redrawNeeded.dispatch()}));d.displayState.shaderError.value=void 0;c=d.sharedObject;c.visibility.add(d.visibility);c.RPC_TYPE_ID=t.c;c.initializeCounterpart(a.chunkManager.rpc,{chunkManager:a.chunkManager.rpcId,source:a.addCounterpartRef()});d.setReady(!0);return d}p(b,a);B(b,[{key:"disposeShaders",value:function(){for(var a=this.shaders,b=$jscomp.makeIterator(a.values()),c=b.next();!c.done;c=b.next())c=c.value,null!==c&&c.dispose();
-a.clear()}},{key:"disposed",value:function(){this.disposeShaders();C(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"makeShaderManager",value:function(a){a=void 0===a?this.displayState.fragmentMain.value:a;return new M(this.displayState.attributeNames.value,this.source.info.vertexAttributes,a)}},{key:"getShader",value:function(a){var b=this.shaders,c=b.get(a);if(void 0===c){c=null;var d=this.shaderManager;void 0===d&&(d=this.shaderManager=this.makeShaderManager());
-var e=this.displayState.fragmentMain.value;try{c=d.getShader(this.gl,a),this.fallbackFragmentMain=e,this.displayState.shaderError.value=null}catch(Ba){if(this.displayState.shaderError.value=Ba,d=this.fallbackFragmentMain,d!==e){d=this.shaderManager=this.makeShaderManager(d);try{c=d.getShader(this.gl,a)}catch(Za){}}}b.set(a,c)}return c}},{key:"draw",value:function(a){if(a.emitColor||!a.alreadyEmittedPickID){var b=this.source.chunks.get(t.b);if(void 0!==b&&b.state===g.d.GPU_MEMORY){var c=this.getShader(a.emitter);
-if(null!==c){var d=this.gl,e=this.shaderManager;c.bind();e.beginLayer(d,c,a);var k=a.pickIDs;e.beginObject(d,c,this.displayState.objectToDataTransform.transform);a.emitPickID&&e.setPickID(d,c,k.register(this,b.numIndices/3));e.drawFragment(d,c,b,this.countingBuffer);e.endLayer(d,c)}}}}},{key:"drawPicking",value:function(a){this.draw(a)}},{key:"transformPickedValue",value:function(a,b){a=this.source.chunks.get(t.b);if(void 0!==a){b*=3;var c=a.indices;if(!(b>=c.length)){var d=c[b],e=[],g=this.displayState.attributeNames.value;
-a.vertexData.vertexAttributes.forEach(function(a,b){b=g[b];void 0!==b&&e.push(b+"="+a[d].toPrecision(6))});return e.join(", ")}}}},{key:"isTransparent",get:function(){return null!==this.displayState.fragmentMain.value.match(/emitRGBA|emitPremultipliedRGBA/)}},{key:"gl",get:function(){return this.source.gl}}]);return b}(k.a)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b,c){c=Math.ceil(c/b);a.dataWidth=b;a.textureHeight=
-c;a.textureAccessCoefficients=Float32Array.of(1/b,1/(b*c),b)}a.d(f,"b",function(){return g});f.c=function(a,b,c){c=void 0===c?1:c;switch(b){case d.b.UINT8:if(1>c||4<c)break;a.texelsPerElement=1;a.textureInternalFormat=t[c];a.textureFormat=l[c];a.texelType=WebGL2RenderingContext.UNSIGNED_BYTE;a.arrayElementsPerTexel=c;a.arrayConstructor=Uint8Array;return a;case d.b.UINT16:if(1>c||2<c)break;a.texelsPerElement=1;a.textureInternalFormat=t[2*c];a.textureFormat=l[2*c];a.texelType=WebGL2RenderingContext.UNSIGNED_BYTE;
-a.arrayElementsPerTexel=2*c;a.arrayConstructor=Uint8Array;return a;case d.b.UINT64:if(1!==c)break;a.texelsPerElement=2;a.textureInternalFormat=WebGL2RenderingContext.RGBA8;a.textureFormat=WebGL2RenderingContext.RGBA;a.texelType=WebGL2RenderingContext.UNSIGNED_BYTE;a.arrayElementsPerTexel=4;a.arrayConstructor=Uint8Array;return a;case d.b.UINT32:if(1!==c)break;a.texelsPerElement=1;a.textureInternalFormat=WebGL2RenderingContext.RGBA8;a.textureFormat=WebGL2RenderingContext.RGBA;a.texelType=WebGL2RenderingContext.UNSIGNED_BYTE;
-a.arrayElementsPerTexel=4;a.arrayConstructor=Uint8Array;return a;case d.b.FLOAT32:if(!(1>c||4<c))return a.texelsPerElement=1,a.textureInternalFormat=m[c],a.textureFormat=l[c],a.texelType=WebGL2RenderingContext.FLOAT,a.arrayElementsPerTexel=c,a.arrayConstructor=Float32Array,a}throw Error("No supported texture format for "+d.b[b]+"["+c+"].");};f.e=function(a,b,c,d,e,g){b=b.maxTextureSize;var k=d*e*g;if(!(c*d<=b&&e*g<=b))if(c*d*e<=b&&g<=b)d*=e;else if(d=Math.ceil(k/b),d*c>b)throw Error("Chunk data size exceeds maximum texture size: "+
-c+" * "+k);p(a,d,k)};f.d=function(a,b,c,d){b=b.maxTextureSize;var e=Math.ceil(d/b);if(e*c>b)throw Error("Number of elements exceeds maximum texture size: "+c+" * "+d);p(a,e,d)};f.f=function(a,b,d,e){var g=d.arrayConstructor,k=d.textureInternalFormat,l=d.textureFormat,m=d.texelsPerElement,r=b.dataWidth;b=b.textureHeight;var f=r*b*d.arrayElementsPerTexel*m;e.constructor!==g&&(e=new g(e.buffer,e.byteOffset,e.byteLength/g.BYTES_PER_ELEMENT));e=Object(n.b)(e,f);a.pixelStorei(WebGL2RenderingContext.UNPACK_ALIGNMENT,
-1);Object(c.b)(a);a.texImage2D(a.TEXTURE_2D,0,k,r*m,b,0,l,d.texelType,e)};a.d(f,"a",function(){return r});var n=a(43),d=a(50),b=a(21),c=a(77),e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=function v(){q(this,v)},l=[-1,WebGL2RenderingContext.RED,WebGL2RenderingContext.RG,WebGL2RenderingContext.RGB,WebGL2RenderingContext.RGBA],
-k=["","r","rg","rgb","rgba"],t=[-1,WebGL2RenderingContext.R8,WebGL2RenderingContext.RG8,WebGL2RenderingContext.RGB8,WebGL2RenderingContext.RGBA8],m=[-1,WebGL2RenderingContext.R32F,WebGL2RenderingContext.RG32F,WebGL2RenderingContext.RGB32F,WebGL2RenderingContext.RGBA32F],r=function(){function a(b){q(this,a);this.key=b;this.uniformName="uTextureAccessCoefficients_"+this.key;this.readTextureValue="readTextureValue_"+this.key}e(a,[{key:"defineShader",value:function(a){a.addUniform("highp vec3",this.uniformName)}},
-{key:"getReadTextureValueCode",value:function(a){for(var b=this.uniformName,c="\nvoid "+this.readTextureValue+"(highp sampler2D sampler, float index",d=0;d<a;++d)c+=", out vec4 output"+d;c+=") {\n  float offset = "+.5/a+";\n  float xCoord = fract((index + offset) * "+b+".x);\n  vec2 texCoords = vec2(xCoord,\n                        (index - (xCoord - 0.5 - offset * "+b+".x) * "+b+".z) *\n                        "+b+".y);\n";for(d=0;d<a;++d)c+="\n  output"+d+" = texture(sampler,\n                        vec2(texCoords.x +\n                             "+
-b+".x * "+(d/a).toFixed(8)+",\n                             texCoords.y));\n";return c+"\n}\n"}},{key:"getAccessor",value:function(a,c,e,g){g=void 0===g?1:g;var l=Object(b.a)(e,g),m=[];m.push(this.getReadTextureValueCode(e===d.b.UINT64?2:1));a="\n"+l+" "+a+"(float index) {\n";switch(e){case d.b.UINT8:m.push(b.o);a+="\n  "+l+" result;\n  vec4 temp;\n  "+this.readTextureValue+"("+c+", index, temp);\n  result.value = temp."+k[g]+";\n  return result;\n";break;case d.b.UINT16:m.push(b.l);a+="\n  "+l+" result;\n  vec4 temp;\n  "+
-this.readTextureValue+"("+c+", index, temp);\n  result.value = temp."+k[2*g]+";\n  return result;\n";break;case d.b.UINT32:m.push(b.m);a+="\n  "+l+" result;\n  "+this.readTextureValue+"("+c+", index, result.value);\n  return result;\n";break;case d.b.UINT64:m.push(b.n);a+="\n  "+l+" result;\n  "+this.readTextureValue+"("+c+", index, result.low, result.high);\n  return result;\n";break;case d.b.FLOAT32:m.push(b.f),a+="\n  vec4 temp;\n  "+this.readTextureValue+"("+c+", index, temp);\n  return temp."+
-k[g]+";\n"}m.push(a+"\n}\n");return m}},{key:"setupTextureLayout",value:function(a,b,c){a.uniform3fv(b.uniform(this.uniformName),c.textureAccessCoefficients)}}]);return a}()},function(h,f,a){function q(a){return Object(b.a)(a.dataTransfer.types,"neuroglancer-layer\x00")}function p(a){if(void 0!==g&&g.manager.rootLayers===a.rootLayers)return g}function n(a,b,c){if(a.shiftKey)return"copy";if(a.ctrlKey)return"move";a=void 0===c?!1:c;a=void 0===a?!1:a;c=p(b);b=void 0===c?"copy":a||c.manager!==b?"link":
-"move";return b}f.e=function(a,c){a.dataTransfer.setData(Object(b.b)("neuroglancer-layer\x00",c.layers.map(function(a){return{name:a.name,visible:a.visible}})),JSON.stringify({layers:c.layers.map(function(a){return a.toJSON()}),layout:c.layoutSpec}));void 0!==g&&g.disposer();var d,e=function(){c.manager.unregisterDisposer(e);for(var a=$jscomp.makeIterator(c.layers),b=a.next();!b.done;b=a.next())b.value.dispose();c.manager.dispose();g===d&&(g=void 0)};g=d={manager:c.manager.addRef(),layers:c.layers.map(function(a){return a.addRef()}),
-layoutSpec:c.layoutSpec,disposer:e}};f.a=function(a){if(void 0!==g){if(a&&"move"===a.dataTransfer.dropEffect){var b=new Set(g.layers);g.manager.layerManager.filter(function(a){return!b.has(a)})}g.disposer()}};f.c=q;f.d=n;f.f=function(a,c,d){return Object(b.e)(a,n(a,c,void 0===d?!1:d))};f.b=function(a,b,e,g,f){var k=p(b),m=!f&&void 0!==k&&k.manager===b;if(!e&&void 0!==k){var r=new l;r.manager=b;r.numSourceLayers=k.layers.length;r.sourceManager=k.manager;r.moveSupported=m;r.layers=new Map;r.layoutSpec=
-k.layoutSpec;if(!f&&k.manager===b)if(g)k.layers.forEach(function(a,b){r.layers.set(a,b)});else return;k.layers.forEach(function(a,c){!f&&b.layerManager.has(a)||r.layers.set(a.addRef(),c)});return r}a=q(a);if(void 0!==a)try{var t=Object(c.a)(a.parameters,function(a,e){var g=Object(c.v)(a,"name",c.A);a=Object(c.v)(a,"visible",c.l);g=new d.b(g,null,b);g.visible=a;return[g,e]}),h=new l;h.numSourceLayers=t.length;h.moveSupported=m;h.manager=b;h.dragType=a.dragType;h.layers=new Map(t);return h}catch(z){}};
-var d=a(27),b=a(119),c=a(4),e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g,l=function(){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");}e(a,[{key:"finalize",value:function(a){var b=this.dragType;if(void 0!==b)try{var c=JSON.parse(a.dataTransfer.getData(b)),
-d=c.layers,e=c.layout;if(!Array.isArray(d)||this.numSourceLayers!==d.length)throw Error("Invalid layer drop data");this.layoutSpec=e;for(var g=$jscomp.makeIterator(this.layers),k=g.next();!k.done;k=g.next()){var l=$jscomp.makeIterator(k.value),f=l.next().value,t=l.next().value;this.manager.initializeLayerFromSpec(f,d[t])}}catch(D){return!1}return!0}},{key:"compatibleWithMethod",value:function(a){return this.method===a||!this.moveSupported&&"move"===a?!0:!1}},{key:"method",get:function(){return void 0!==
-this.sourceManager?this.manager===this.sourceManager?"move":"link":"copy"}}]);return a}()},function(h,f,a){f.b=function(a,b){b=JSON.stringify(b);b=Object(q.b)((new TextEncoder).encode(b));return a+b};f.a=function(a,b){a=$jscomp.makeIterator(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;a:{var d=b;if(c.startsWith(d))try{var g=c.substring(d.length);var l=(new TextDecoder).decode(Object(q.a)(g));var k=JSON.parse(l);break a}catch(t){k=void 0;break a}k=void 0}d=k;if(void 0!==d)return{parameters:d,
-dragType:c}}};f.e=function(a,b){return n=a.dataTransfer.dropEffect=b};f.c=function(){return n};f.d=function(a){a.draggable=!0;return Object(p.c)(a,"dragstart",function(a){a.stopPropagation();a.preventDefault()})};var q=a(166),p=a(1),n},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?
-a:b}function n(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)}a.d(f,"b",function(){return w});a.d(f,"c",function(){return y});a.d(f,"a",function(){return x});var d=a(31),b=a(187),c=a(181);h=a(1);var e=a(8),g=a(22),l=a(2),k=a(61),t=a(148),m=a(53),
-r=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),u=function z(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return z(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a(336);a(84);
-f.d="neuroglancer-position";var v=g.a.fromObject({tab:{action:"tab-forward",preventDefault:!1},arrowup:{action:"adjust-up"},arrowdown:{action:"adjust-down"},wheel:{action:"adjust-via-wheel"},"shift+tab":{action:"tab-backward",preventDefault:!1},backspace:{action:"delete-backward",preventDefault:!1},escape:{action:"cancel"},mouseup0:{action:"select-all-if-was-not-focused",preventDefault:!1}}),w=function(a){function m(a,e){e=void 0===e?6:e;q(this,m);var r=p(this,(m.__proto__||Object.getPrototypeOf(m)).call(this));
-r.position=a;r.maxNumberWidth=e;r.element=document.createElement("div");r.inputContainer=document.createElement("div");r.inputElement=document.createElement("input");r.hintElement=document.createElement("input");r.tempPosition=l.s.create();r.updateHintScrollPosition=r.registerCancellable(Object(b.a)(function(){r.hintElement.scrollLeft=r.inputElement.scrollLeft}));var f=r.element,h=r.inputElement,u=r.hintElement,n=r.inputContainer;n.className="neuroglancer-position-widget-input-container";h.className=
-"neuroglancer-position-widget-input";u.className="neuroglancer-position-widget-hint";r.inputFieldWidth=3*e+11;e=$jscomp.makeIterator([h,u]);for(var w=e.next();!w.done;w=e.next())w=w.value,w.spellcheck=!1,w.autocomplete="off",w.type="text",w.style.width=r.inputFieldWidth+"ch";u.disabled=!0;e=document.createElement("div");e.textContent="\u29c9";e.className="neuroglancer-copy-button neuroglancer-button";e.title="Copy position to clipboard";e.addEventListener("click",function(){var a=Object(c.b)(r.getPositionText());
-d.a.showTemporaryMessage(a?"Position copied to clipboard":"Failed to copy position to clipboard")});e.addEventListener("dragstart",function(b){b.dataTransfer.setData("neuroglancer-position",JSON.stringify(a.toJSON()));b.dataTransfer.setData("text",r.getPositionText());b.stopPropagation()});e.draggable=!0;f.appendChild(e);f.appendChild(n);n.appendChild(h);n.appendChild(u);f.className="neuroglancer-position-widget";r.registerDisposer(a.changed.add(r.registerCancellable(Object(b.a)(function(){return r.updateView()}))));
-r.registerDisposer(new k.b(h,v)).allShortcutsAreGlobal=!0;r.registerDisposer(new t.a(h,v));r.registerEventListener(h,"change",function(){return r.updatePosition()});r.registerEventListener(h,"blur",function(){return r.updatePosition()});r.registerEventListener(h,"input",function(){return r.cleanInput()});r.registerEventListener(h,"keydown",r.updateHintScrollPosition);r.registerEventListener(h,"copy",function(a){var b=h.value.substring(h.selectionStart,h.selectionEnd);b=b.trim().replace(/\s+/g," ");
-a.clipboardData.setData("text/plain",b);a.stopPropagation();a.preventDefault()});var x=!1;r.registerEventListener(h,"mousedown",function(){x=document.activeElement===h});r.registerDisposer(Object(g.c)(h,"select-all-if-was-not-focused",function(a){x||(h.selectionStart=0,h.selectionEnd=h.value.length,h.selectionDirection="forward",a.preventDefault())}));r.registerDisposer(Object(g.c)(h,"tab-forward",function(a){var b=Math.min(h.selectionStart,h.selectionEnd),c=h.value.substring(b).match(/^([^,\s]*)((?:\s+)|(?:\s*,\s*))?([^,\s]*)/);
-null!==c&&void 0!==c[2]&&(h.selectionStart=b+c[1].length+c[2].length,h.selectionEnd=h.selectionStart+c[3].length,h.selectionDirection="forward",a.preventDefault())}));r.registerDisposer(Object(g.c)(h,"tab-backward",function(a){var b=h.value.substring(0,Math.max(h.selectionStart,h.selectionEnd)).match(/([^,\s]*)((?:\s+)|(?:\s*,\s*))?([^,\s]*)$/);null!==b&&void 0!==b[2]&&(h.selectionStart=b.index,h.selectionEnd=h.selectionStart+b[1].length,h.selectionDirection="forward",a.preventDefault())}));r.registerDisposer(Object(g.c)(h,
-"delete-backward",function(a){if(h.selectionStart===h.selectionEnd&&h.selectionStart===h.value.length){var b=h.value.match(/^(.*)(?![\s])(?:(?:\s+)|(?:\s*,\s*))$/);null!==b&&(h.value=b[1],r.cleanInput(),a.preventDefault())}}));r.registerDisposer(Object(g.c)(h,"cancel",function(){r.updateView();r.inputElement.blur()}));r.registerDisposer(Object(g.c)(h,"adjust-via-wheel",function(a){a=a.detail;var b=a.deltaY;0!==b&&r.adjustFromCursor(Math.ceil((h.scrollLeft+a.offsetX-h.clientLeft)/(h.scrollWidth/r.inputFieldWidth)),
--Math.sign(b))}));r.registerDisposer(Object(g.c)(h,"adjust-up",function(){r.adjustFromCursor(void 0,1)}));r.registerDisposer(Object(g.c)(h,"adjust-down",function(){r.adjustFromCursor(void 0,-1)}));r.updateView();return r}n(m,a);r(m,[{key:"adjustFromCursor",value:function(a,b){var c=this.inputElement;void 0===a&&(a="forward"===c.selectionDirection?c.selectionEnd:c.selectionStart);void 0!==this.cleanInput()&&(a=c.value.substring(0,a).split(",").length-1,this.updatePosition(),c=this.tempPosition,this.position.getVoxelCoordinates(c)&&
-(c[a]+=b,this.position.setVoxelCoordinates(c),this.updateView()))}},{key:"cleanInput",value:function(){var a=this.inputElement.selectionStart,b=/(-?\d+(?:\.(?:\d+)?)?)/.source,c=/((?:\s+(?![\s,]))|(?:\s*,\s*))/.source,d=/([\[\]{}()\s]*)/.source;b=this.inputElement.value.match(new RegExp("^"+d+"(?![\\s])"+b+"?"+("(?:"+c+b+"?(?:"+c+b+"?)?)?")+(d+"$")));if(null!==b){var e="  ",g="x ",k=2,m=b[1].length;c=function(b,c,d){if(void 0!==b){var l=m+b.length;void 0===c&&(c=b,d=" ".repeat(c.length));a>=m&&(k=
-a===l?e.length+c.length:e.length+Math.min(c.length,a-m));e+=c;g+=d;m=l}};c(b[2]);c(b[3],",   ","  y ");c(b[4]);c(b[5],",   ","  z ");c(b[6]);this.hintElement.value=g;this.inputElement.value!==e&&(this.inputElement.value=e,this.inputElement.selectionEnd=k,this.inputElement.selectionStart=k);this.updateHintScrollPosition();return void 0!==b[2]&&void 0!==b[4]&&void 0!==b[6]?{position:l.s.set(this.tempPosition,parseFloat(b[2]),parseFloat(b[4]),parseFloat(b[6]))}:{}}this.hintElement.value=""}},{key:"updatePosition",
-value:function(){var a=this.cleanInput();void 0!==a&&void 0!==a.position&&this.position.setVoxelCoordinates(a.position)}},{key:"getPositionText",value:function(){var a=this.tempPosition;return this.position.getVoxelCoordinates(a)?Math.floor(a[0])+", "+Math.floor(a[1])+", "+Math.floor(a[2]):"<unspecified position>"}},{key:"updateView",value:function(){var a=this.tempPosition;if(this.position.getVoxelCoordinates(a)){var b=this.inputElement;a="  "+Math.floor(a[0])+",   "+Math.floor(a[1])+",   "+Math.floor(a[2]);
-var c=a.indexOf(","),d=a.indexOf(",",c+1)-c-4;c="x "+" ".repeat(c-2)+"  y "+" ".repeat(d)+"  z";d=b.selectionStart;var e=b.selectionEnd,g=b.selectionDirection;b.value=a;b.setSelectionRange(d,e,g);this.hintElement.value=c+" ".repeat(a.length-c.length);this.updateHintScrollPosition()}else this.inputElement.value="",this.hintElement.value=""}},{key:"disposed",value:function(){Object(e.b)(this.element);u(m.prototype.__proto__||Object.getPrototypeOf(m.prototype),"disposed",this).call(this)}}]);return m}(h.a),
-y=function(a){function c(a,d){q(this,c);var e=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));e.element=a;e.voxelSize=d;e.dimensionsContainer=document.createElement("span");e.unitsElement=document.createElement("span");var g=e.dimensionsContainer,k=e.unitsElement;a.className="neuroglancer-voxel-size-widget";a.title="Voxel size";g.className="neuroglancer-voxel-size-dimensions-container";a.appendChild(g);a.appendChild(k);k.className="neuroglancer-voxel-size-units";e.registerDisposer(d.changed.add(e.registerCancellable(Object(b.a)(function(){return e.updateView()}))));
-e.updateView();return e}n(c,a);r(c,[{key:"updateView",value:function(){var a=this.dimensionsContainer,b=this.unitsElement;Object(e.a)(a);this.element.style.display=this.voxelSize.valid?null:"none";var c=this.voxelSize.size,d=Object(m.d)(Math.min(c[0],c[1],c[2]));b.textContent=d.unit;for(b=0;3>b;++b){for(var g=c[b]/d.lengthInNanometers,k="",l=0;2>=l&&(k=g.toFixed(l),parseFloat(k)!==g);++l);g=document.createElement("span");g.className="neuroglancer-voxel-size-dimension";g.textContent=k;a.appendChild(g)}}},
-{key:"disposed",value:function(){Object(e.b)(this.element);u(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(h.a),x=function(a){function c(a,d,e){q(this,c);var g=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));g.element=a;g.mouseState=d;g.voxelSize=e;g.tempPosition=l.s.create();a.className="neuroglancer-mouse-position-widget";a=g.registerCancellable(Object(b.a)(function(){return g.updateView()}));g.registerDisposer(d.changed.add(a));g.registerDisposer(e.changed.add(a));
-return g}n(c,a);r(c,[{key:"updateView",value:function(){var a="",b=this.mouseState,c=this.voxelSize;b.active&&c.valid&&(a=this.tempPosition,c.voxelFromSpatial(a,b.position),a="x "+Math.floor(a[0])+",  y "+Math.floor(a[1])+",  z "+Math.floor(a[2]));this.element.textContent=a}},{key:"disposed",value:function(){Object(e.b)(this.element);u(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(h.a)},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a){var b=a.viewer;return Object.assign({},Object(D.d)(b),{navigationState:b.perspectiveNavigationState,inputEventMap:b.inputEventBindings.perspectiveView,
-orthographicProjection:a.specification.orthographicProjection,showScaleBar:b.showScaleBar,rpc:b.chunkManager.rpc})}function d(a){return Object.assign({},Object(D.d)(a),{navigationState:a.navigationState,inputEventMap:a.inputEventBindings.sliceView})}function b(a,b,c){c=void 0===b?a.navigationState:new u.e(new u.g(a.navigationState.pose.position,u.f.makeRelative(a.navigationState.pose.orientation,b)),c||a.navigationState.zoomFactor);a=new w.a(a.chunkManager,a.layerManager,c);a[N]=b||z.n.create();return a}
-function c(a,c,d){return a.map(function(a){return b(c,a[N],d)})}function e(a,b){var c=a.onResize;a.onResize=function(){b.dedebounceUpdates?this.sliceView.setViewportSize(this.element.clientWidth,this.element.clientHeight):c.call(this)};return a}function g(a,b){Object(B.c)(a.element,"nehuba-rotate-via-mouse-drag",function(c){var d=a.viewer,e=a.sliceView,g=d.mouseState;if(g.updateUnconditionally()){var k=b.rotateAtViewCentre?void 0:z.s.clone(g.position);Object(F.a)(c.detail,function(a,b,c){a=e.viewportAxes;
-d.navigationState.pose.rotateAbsolute(a[1],b/4*Math.PI/180,k);d.navigationState.pose.rotateAbsolute(a[0],c/4*Math.PI/180,k)})}});return a}function l(a,b){var c=a.zoomByMouse;a.zoomByMouse=function(a){b.zoomAtViewCentre?this.navigationState.zoomBy(a):c.call(this,a)};return a}function k(a,b){var c=a.registerDisposer(new C.a),d=c.element;a.registerDisposer(new x.a(b,d));a.element.appendChild(d);var e=a.draw;a.draw=function(){e.call(this);var a=this.sliceView,b=c.dimensions;b.targetLengthInPixels=Math.min(a.width/
-4,100);b.nanometersPerPixel=a.pixelSize;c.update()};return a}function t(a){var b=a.draw;a.draw=function(){b.call(this);var c={missingImageChunks:m(this.sliceView,function(a){return a instanceof L.b}),missingChunks:m(this.sliceView),nanometersToOffsetPixels:function(b){b=z.s.transformMat4(z.s.create(),b,a.sliceView.dataToViewport);b[0]=b[0]+a.sliceView.width/2+a.element.clientLeft;b[1]=b[1]+a.sliceView.height/2+a.element.clientTop;return b}};c=new CustomEvent("sliceRenderEvent",{bubbles:!0,detail:c});
-this.element.dispatchEvent(c)}}function m(a,b){var c=a.visibleLayerList.filter(function(a){return b?b(a):!0});return 0===c.length?-1:c.map(function(b){return a.visibleLayers.get(b)}).reduce(function(a,b){return a.concat(b)},[]).filter(function(a){return a.source instanceof J.b}).map(function(a){return a}).map(function(b){var c=b.source.chunks;if(b=a.visibleChunks.get(b.chunkLayout))return b.map(function(a){return c.get(a)}).filter(function(a){return!(a&&a.state===O.d.GPU_MEMORY)}).length;console.log("visibleChunks are not defined");
-return 0}).reduce(function(a,b){return a+b},0)}a.d(f,"a",function(){return U});var r=a(184),u=a(57),v=a(82),w=a(44),y=a(60),x=a(35);h=a(1);var A=a(8),z=a(2),D=a(83),E=a(191),G=a(193),C=a(192),B=a(22),F=a(80),L=a(160),J=a(33),O=a(30),M=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),P=function H(a,b,c){null===
-a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return H(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};$jscomp.initSymbol();var N=Symbol("SliceQuat");$jscomp.initSymbol();var S=Symbol("config");f.b=S;f.c="layoutEvent";var U=function(a){function m(a,f,h,u){if(!(this instanceof m))throw new TypeError("Cannot call a class as a function");var p=q(this,(m.__proto__||Object.getPrototypeOf(m)).call(this));
-p.container=a;p.rootElement=f;p.viewer=h;u;var w=h.display.container[S];if(!w)throw Error("Are you trying to use nehuba classes directly? Use should use defined API instead");var D=w.layout||{};D.useNehubaPerspective&&!D.useNehubaPerspective.doNotRestrictUserNavigation&&Object(G.e)(h);var A=function(a){t(e(l(g(a,w),w),w));return a};D.views||(D.views="hbp-neuro");"hbp-neuro"===D.views&&(D.views={slice1:z.n.rotateX(z.n.create(),z.n.create(),-Math.PI/2),slice2:z.n.rotateY(z.n.create(),z.n.rotateX(z.n.create(),
-z.n.create(),-Math.PI/2),-Math.PI/2),slice3:z.n.rotateX(z.n.create(),z.n.create(),Math.PI)});u=D.views;var C=[u.slice1,u.slice2,u.slice3].map(function(a){return b(h,a)}),B,F=h.display,J=Object.assign({},n(a),{showSliceViews:h.showPerspectiveSliceViews,showSliceViewsCheckbox:!D.hideSliceViewsCheckbox,slicesNavigationState:h.navigationState}),L=Object.assign({},d(h),{showScaleBar:new x.b(!1,!1)}),M=Object.assign({},d(h),{showScaleBar:new x.b(!1,!1)});a=[r.b(1,r.a("column",[r.b(1,r.a("row",[r.b(1,function(a){p.registerDisposer(A(k(new y.a(F,
-a,C[0],L),h.showScaleBar)))}),r.b(1,function(a){p.registerDisposer(A(new y.a(F,a,C[1],M)))})])),r.b(1,r.a("row",[r.b(1,function(a){p.registerDisposer(A(new y.a(F,a,C[2],M)))}),r.b(1,function(a){if(D.useNehubaPerspective){var b=D.useNehubaPerspective;B=p.registerDisposer(new E.a(F,a,J,w));C.forEach(function(a){B.planarSlices.add(a.addRef())});if(b.fixedZoomPerspectiveSlices){var d=b.fixedZoomPerspectiveSlices;c(C,h,d.sliceZoom).forEach(function(a){var b=d.sliceViewportSizeMultiplier;a.setViewportSize(d.sliceViewportWidth*
-b,d.sliceViewportHeight*b);B.sliceViews.set(a,!1)})}else for(b=$jscomp.makeIterator(C),a=b.next();!a.done;a=b.next())B.sliceViews.set(a.value.addRef(),!1)}else for(B=p.registerDisposer(new v.b(F,a,J)),b=$jscomp.makeIterator(C),a=b.next();!a.done;a=b.next())B.sliceViews.set(a.value.addRef(),!1)})]))]))];r.a("row",a)(f);F.onResize();f=new CustomEvent("layoutEvent",{detail:{perspective:B&&B.element}});h.display.container.dispatchEvent(f);return p}p(m,a);M(m,[{key:"disposed",value:function(){Object(A.a)(this.rootElement);
-P(m.prototype.__proto__||Object.getPrototypeOf(m.prototype),"disposed",this).call(this)}}]);return m}(h.a);f.d="sliceRenderEvent"},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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)}a.d(f,"b",function(){return k});a.d(f,"a",function(){return t});var d=a(7),b=a(14);h=a(113);var c=a(66),e=a(115),g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&
-a(b.prototype,c);d&&a(b,d);return b}}(),l=function r(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return r(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},k=function(a){function b(){q(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.hashMapShaderManager=new e.b("customColors");return a}n(b,a);g(b,[{key:"defineShader",value:function(a){var c=
-this.prefix;this.prefix=c+"_NG";l(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);this.hashMapShaderManager.defineShader(a);a.addFragmentCode("\nvec3 "+c+"(uint64_t x) {\n  uint64_t mappedValue;\n  if ("+this.hashMapShaderManager.getFunctionName+"(x, mappedValue)) {\n    return mappedValue.low.rgb;\n  }\n  return "+this.prefix+"(x);\n}\n");this.prefix=c}},{key:"enable",value:function(a,c,d){var g=e.a.get(a,d.gpuColorMap);this.hashMapShaderManager.enable(a,
-c,g);l(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"enable",this).call(this,a,c,d)}}]);return b}(h.b),t=function(a){function e(a,b){q(this,e);a=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a));a.gpuColorMap=new c.a;a.colorMap=new Map;a.changed.dispose();a.changed=b;return a}n(e,a);g(e,[{key:"setSegmentColor",value:function(a,c,d,e){var g=65536*e+256*d+c;this.colorMap.set(a,{red:c,green:d,blue:e,gpu:g});this.gpuColorMap.set(new b.a(a),new b.a(g))||this.repopulateGpuMap();
-this.changed.dispatch()}},{key:"unsetSegmentColor",value:function(a){this.colorMap.delete(a);this.repopulateGpuMap();this.changed.dispatch()}},{key:"batchUpdate",value:function(a){var b=this;a.forEach(function(a,c){var d=a.red,e=a.green;a=a.blue;b.colorMap.set(c,{red:d,green:e,blue:a,gpu:65536*a+256*e+d})});this.repopulateGpuMap();this.changed.dispatch()}},{key:"clearCustomSegmentColors",value:function(){this.colorMap.clear();this.gpuColorMap.clear();this.changed.dispatch()}},{key:"repopulateGpuMap",
-value:function(){var a=this.colorMap,c=this.gpuColorMap;c.clear();a.forEach(function(a,d){c.set(new b.a(d),new b.a(a.gpu))})}},{key:"compute",value:function(a,b){var c=this.colorMap.get(b.low);if(c){b=c.green;var d=c.blue;a[0]=c.red/255;a[1]=b/255;a[2]=d/255;return a}return l(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"compute",this).call(this,a,b)}},{key:"toString",value:function(){return"new NehubaSegmentColorHash(["+this.hashFunctions+"])"}}],[{key:"from",value:function(a){var b=
-new e(a.hashFunctions,a.changed);a.changed=new d.a;return b}},{key:"getDefault",value:function(){throw Error("NehubaSegmentColorHash is supposed to be created by `from` static method");}}]);return e}(h.a)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a){if(!a.showSliceViewsCheckboxValue)return w;var b=a&&a.config.layout.useNehubaPerspective.centerToOrigin,c=a&&a.config.layout.useNehubaPerspective.mesh,d=c&&c.backFaceColor||a&&a.config&&a.config.layout&&
-a.config.layout.useNehubaPerspective&&a.config.layout.useNehubaPerspective.perspectiveSlicesBackground||a&&a.crossSectionBackground,g=e.k.create(),k=c&&c.removeOctant||e.u.fromValues(0,0,0,0);if(a&&c){var l=a.slicesPose;c.removeBasedOnNavigation&&(l.toMat4(g),e.k.invert(g,g));c.flipRemovedOctant&&(k=e.u.fromValues(0,0,-(b?a.perspectiveNavigationState.zoomFactor.value:1),1),a=a.perspectiveNavigationState.pose,b=b?l.position.spatialCoordinates:e.s.fromValues(0,0,0),a=a.orientation.orientation,l=e.n.invert(e.n.create(),
-l.orientation.orientation),l=e.n.multiply(e.n.create(),l,a),l=e.k.fromQuat(e.k.create(),l),e.u.transformMat4(k,k,l),k[0]=k[0]<b[0]/100?-1:1,k[1]=k[1]<b[1]/100?-1:1,k[2]=k[2]<b[2]/100?-1:1)}return{navState:g,octant:k,backFaceColor:e.u.fromValues(d[0],d[1],d[2],1)}}a.d(f,"a",function(){return v});f.c=d;a.d(f,"b",function(){return y});var b=a(30),c=a(64),e=a(2),g=a(23),l=a(25),k=a(14),t=a(66);h=a(15);a=a(54);var m=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||
-!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),r=function A(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return A(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},u=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}
-n(b,a);m(b,[{key:"defineShader",value:function(a){r(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);a.addVarying("highp vec4","vNavPos");a.addUniform("highp mat4","uNavState");a.addUniform("highp vec4","uOctant");a.addUniform("highp vec4","uBackFaceColor");a.setVertexMain("\nvec4 position = uModelMatrix * vec4(aVertexPosition, 1.0);\nvNavPos = uNavState * position * uOctant;\ngl_Position = uProjection * position;\nvec3 normal = (uModelMatrix * vec4(aVertexNormal, 0.0)).xyz;\nfloat lightingFactor = abs(dot(normal, uLightDirection.xyz)) + uLightDirection.w;\nvColor = vec4(lightingFactor * uColor.rgb, uColor.a);\n\t\t");
-a.setFragmentMain("\nif (vNavPos.x > 0.0 && vNavPos.y > 0.0 && vNavPos.z > 0.0) {\n  discard;\n} else {\n  if (gl_FrontFacing) emit(vColor, uPickID);\n  else emit(uBackFaceColor, uPickID);\n}\n\t\t")}},{key:"setValuesForClipping",value:function(a,b,c){this.setNavState(a,b,c.navState);this.setOctant(a,b,c.octant);this.setBackFaceColor(a,b,c.backFaceColor)}},{key:"setNavState",value:function(a,b,c){a.uniformMatrix4fv(b.uniform("uNavState"),!1,c)}},{key:"setOctant",value:function(a,b,c){a.uniform4fv(b.uniform("uOctant"),
-c)}},{key:"setBackFaceColor",value:function(a,b,c){a.uniform4fv(b.uniform("uBackFaceColor"),c)}},{key:"getShader",value:function(a,b){var c=this;return a.memoize.get("mesh/NehubaMeshShaderManager:"+Object(g.a)(b),function(){var d=new l.a(a);d.require(b);c.defineShader(d);return d.build()})}}]);return b}(a.b),v=function(a){function e(a,b,c){q(this,e);a=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a,b,c));a.meshShaderManager=new u;return a}n(e,a);m(e,[{key:"draw",value:function(a){var e=
-this;if(a.emitColor||!a.alreadyEmittedPickID){var g=this.gl,k=this.displayState,l=this.meshShaderManager,m=Math.min(1,k.objectAlpha.value);if(!(0>=m)){var r=this.getShader(a.emitter);r.bind();l.beginLayer(g,r,a);a.extra||console.error("Bad configuration. Nehuba mesh layer is used by neuroglancer code.");var f=d(a.extra);l.setValuesForClipping(g,r,f);var t=a.extra&&a.extra.config.layout.useNehubaPerspective.mesh,h=t&&t.surfaceParcellation;t=this.source.fragmentSource.objectChunks;var u=a.pickIDs,v=
-this.displayState.objectToDataTransform.transform,n=k.visibleSegments;var p=n instanceof y?h||a.extra.showSliceViewsCheckboxValue?n.getLoadedMeshes():0===n.size?n.getLoadedMeshes():n:n;var q=new Proxy(k,{get:function(a,b){if("visibleSegments"===b)return p;b=a[b];return"function"===typeof b?b.bind(a):b}}),z=0;Object(c.d)(q,t,function(d,t,p){a.emitColor&&l.setColor(g,r,Object(c.e)(k,d,m));a.emitPickID&&l.setPickID(g,r,u.registerUint64(e,t));a.extra.showSliceViewsCheckboxValue&&n instanceof y&&!h&&(n.has(d)?
-l.setValuesForClipping(g,r,w):l.setValuesForClipping(g,r,f));l.beginObject(g,r,v);d=$jscomp.makeIterator(p);for(t=d.next();!t.done;t=d.next())t=t.value,t.state===b.d.GPU_MEMORY&&(l.drawFragment(g,r,t),z++)});l.endLayer(g,r);a.extra.meshRendered=0<t.size;-1===a.extra.meshesLoaded&&(a.extra.meshesLoaded=0);a.extra.meshesLoaded+=t.size;-1===a.extra.meshFragmentsLoaded&&(a.extra.meshFragmentsLoaded=0);a.extra.meshFragmentsLoaded+=z;t=Array.from(t.keys());a.extra.lastMeshId=t[t.length-1]}}}}]);return e}(a.a),
-w={navState:e.k.create(),octant:e.u.fromValues(0,0,0,0),backFaceColor:e.u.fromValues(.5,.5,.5,1)},y=function(a){function b(a){q(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.localHashTable=new t.b;c.wrapped=a;a=$jscomp.makeIterator(c.wrapped.hashTable);for(var d=a.next();!d.done;d=a.next())c.localHashTable.add(d.value);return c}n(b,a);$jscomp.initSymbol();$jscomp.initSymbolIterator();m(b,[{key:"setMeshesToLoad",value:function(a){var b=this;this.wrapped.clear();a.forEach(function(a){a=
-new k.a(a);b.wrapped.add(a);b.wrapped.changed.dispatch(a,!1)})}},{key:"getLoadedMeshes",value:function(){return this.wrapped}},{key:"add_",value:function(a){a;throw Error("Unexpected member access of VisibleSegmentsWrapper");}},{key:"add",value:function(a){this.localHashTable.add(a)&&this.changed.dispatch(a,!0)}},{key:"has",value:function(a){return this.localHashTable.has(a)}},{key:Symbol.iterator,value:function(){return this.localHashTable.keys()}},{key:"delete_",value:function(a){a;throw Error("Unexpected member access of VisibleSegmentsWrapper");
-}},{key:"delete",value:function(a){this.localHashTable.delete(a)&&this.changed.dispatch(a,!1)}},{key:"clear",value:function(){this.localHashTable.clear()&&this.changed.dispatch(null,!1)}},{key:"toJSON",value:function(){for(var a=[],b=$jscomp.makeIterator(this),c=b.next();!c.done;c=b.next())a.push(c.value.toString());return a}},{key:"initializeSharedObject",value:function(a,b){b=void 0===b?a.newId():b;b;throw Error("Unexpected member access of VisibleSegmentsWrapper");}},{key:"initializeCounterpart",
-value:function(a,b){b=void 0===b?{}:b;a;b;throw Error("Unexpected member access of VisibleSegmentsWrapper");}},{key:"addCounterpartRef",value:function(){throw Error("Unexpected member access of VisibleSegmentsWrapper");}},{key:"ownerDispose",value:function(){throw Error("Unexpected member access of VisibleSegmentsWrapper");}},{key:"counterpartRefCountReachedZero",value:function(a){a;throw Error("Unexpected member access of VisibleSegmentsWrapper");}},{key:"addRef",value:function(){throw Error("Unexpected member access of VisibleSegmentsWrapper");
-}},{key:"dispose",value:function(){throw Error("Unexpected member access of VisibleSegmentsWrapper");}},{key:"refCountReachedZero",value:function(){throw Error("Unexpected member access of VisibleSegmentsWrapper");}},{key:"disposed",value:function(){throw Error("Unexpected member access of VisibleSegmentsWrapper");}},{key:"registerDisposer",value:function(a){a;throw Error("Unexpected member access of VisibleSegmentsWrapper");}},{key:"unregisterDisposer",value:function(a){a;throw Error("Unexpected member access of VisibleSegmentsWrapper");
-}},{key:"registerEventListener",value:function(a,b,c,d){a;b;c;d;throw Error("Unexpected member access of VisibleSegmentsWrapper");}},{key:"registerCancellable",value:function(a){a;throw Error("Unexpected member access of VisibleSegmentsWrapper");}},{key:"hashTable",get:function(){return this.localHashTable}},{key:"changed",get:function(){return this.wrapped.changed}},{key:"size",get:function(){return this.localHashTable.size}},{key:"rpcId",get:function(){return this.wrapped.rpcId},set:function(a){a}},
-{key:"rpc",get:function(){throw Error("Unexpected member access of VisibleSegmentsWrapper");},set:function(a){a}},{key:"isOwner",get:function(){throw Error("Unexpected member access of VisibleSegmentsWrapper");}},{key:"unreferencedGeneration",get:function(){throw Error("Unexpected member access of VisibleSegmentsWrapper");}},{key:"referencedGeneration",get:function(){throw Error("Unexpected member access of VisibleSegmentsWrapper");}},{key:"RPC_TYPE_ID",get:function(){throw Error("Unexpected member access of VisibleSegmentsWrapper");
-}},{key:"refCount",set:function(a){a},get:function(){throw Error("Unexpected member access of VisibleSegmentsWrapper");}},{key:"wasDisposed",get:function(){throw Error("Unexpected member access of VisibleSegmentsWrapper");}}]);return b}(h.b)},function(h,f,a){var q=this&&this.__extends||function(a,f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(d,b){a.call(this);this.value=
-d;this.scheduler=b;this._isScalar=!0;b&&(this._isScalar=!1)}q(f,a);f.create=function(a,b){return new f(a,b)};f.dispatch=function(a){var b=a.value,c=a.subscriber;a.done?c.complete():(c.next(b),c.closed||(a.done=!0,this.schedule(a)))};f.prototype._subscribe=function(a){var b=this.value,c=this.scheduler;if(c)return c.schedule(f.dispatch,0,{done:!1,value:b,subscriber:a});a.next(b);a.closed||a.complete()};return f}(a(0).Observable);f.ScalarObservable=h},function(h,f,a){var q=this&&this.__extends||function(a,
-b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(38),n=a(36);h=a(5);var d=a(6),b={};f.combineLatest=function(){for(var a=[],b=0;b<arguments.length;b++)a[b-0]=arguments[b];b=null;"function"===typeof a[a.length-1]&&(b=a.pop());1===a.length&&n.isArray(a[0])&&(a=a[0].slice());a.unshift(this);return this.lift.call(new p.ArrayObservable(a),new c(b))};var c=function(){function a(a){this.project=a}
-a.prototype.call=function(a,b){return b.subscribe(new e(a,this.project))};return a}();f.CombineLatestOperator=c;var e=function(a){function c(b,c){a.call(this,b);this.project=c;this.active=0;this.values=[];this.observables=[]}q(c,a);c.prototype._next=function(a){this.values.push(b);this.observables.push(a)};c.prototype._complete=function(){var a=this.observables,b=a.length;if(0===b)this.destination.complete();else{this.toRespond=this.active=b;for(var c=0;c<b;c++){var e=a[c];this.add(d.subscribeToResult(this,
-e,e,c))}}};c.prototype.notifyComplete=function(a){0===--this.active&&this.destination.complete()};c.prototype.notifyNext=function(a,c,d,e,g){a=this.values;e=a[d];e=this.toRespond?e===b?--this.toRespond:this.toRespond:0;a[d]=c;0===e&&(this.project?this._tryProject(a):this.destination.next(a.slice()))};c.prototype._tryProject=function(a){try{var b=this.project.apply(this,a)}catch(m){this.destination.error(m);return}this.destination.next(b)};return c}(h.OuterSubscriber);f.CombineLatestSubscriber=e},
-function(h,f,a){function q(){for(var a=[],e=0;e<arguments.length;e++)a[e-0]=arguments[e];e=null;n.isScheduler(a[a.length-1])&&(e=a.pop());return null===e&&1===a.length&&a[0]instanceof p.Observable?a[0]:(new d.ArrayObservable(a,e)).lift(new b.MergeAllOperator(1))}var p=a(0),n=a(37),d=a(38),b=a(90);f.concat=function(){for(var a=[],b=0;b<arguments.length;b++)a[b-0]=arguments[b];return this.lift.call(q.apply(void 0,[this].concat(a)))};f.concatStatic=q},function(h,f,a){var q=this&&this.__extends||function(a,
-b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);var p=a(69);f.observeOn=function(a,b){void 0===b&&(b=0);return this.lift(new n(a,b))};var n=function(){function a(a,b){void 0===b&&(b=0);this.scheduler=a;this.delay=b}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.scheduler,this.delay))};return a}();f.ObserveOnOperator=n;var d=function(a){function c(b,c,d){void 0===d&&(d=0);
-a.call(this,b);this.scheduler=c;this.delay=d}q(c,a);c.dispatch=function(a){a.notification.observe(a.destination);this.unsubscribe()};c.prototype.scheduleMessage=function(a){this.add(this.scheduler.schedule(c.dispatch,this.delay,new b(a,this.destination)))};c.prototype._next=function(a){this.scheduleMessage(p.Notification.createNext(a))};c.prototype._error=function(a){this.scheduleMessage(p.Notification.createError(a))};c.prototype._complete=function(){this.scheduleMessage(p.Notification.createComplete())};
-return c}(h.Subscriber);f.ObserveOnSubscriber=d;var b=function(){return function(a,b){this.notification=a;this.destination=b}}();f.ObserveOnMessage=b},function(h,f,a){function q(){for(var a=[],b=0;b<arguments.length;b++)a[b-0]=arguments[b];b=a[a.length-1];"function"===typeof b&&a.pop();return(new n.ArrayObservable(a)).lift(new g(b))}var p=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=
-b.prototype,new c)},n=a(38),d=a(36);h=a(3);var b=a(5),c=a(6),e=a(68);f.zipProto=function(){for(var a=[],b=0;b<arguments.length;b++)a[b-0]=arguments[b];return this.lift.call(q.apply(void 0,[this].concat(a)))};f.zipStatic=q;var g=function(){function a(a){this.project=a}a.prototype.call=function(a,b){return b.subscribe(new l(a,this.project))};return a}();f.ZipOperator=g;var l=function(a){function b(b,c,d){void 0===d&&(d=Object.create(null));a.call(this,b);this.iterators=[];this.active=0;this.project=
-"function"===typeof c?c:null;this.values=d}p(b,a);b.prototype._next=function(a){var b=this.iterators;d.isArray(a)?b.push(new t(a)):"function"===typeof a[e.iterator]?b.push(new k(a[e.iterator]())):b.push(new m(this.destination,this,a))};b.prototype._complete=function(){var a=this.iterators,b=a.length;if(0===b)this.destination.complete();else{this.active=b;for(var c=0;c<b;c++){var d=a[c];d.stillUnsubscribed?this.add(d.subscribe(d,c)):this.active--}}};b.prototype.notifyInactive=function(){this.active--;
-0===this.active&&this.destination.complete()};b.prototype.checkIterators=function(){for(var a,b=this.iterators,c=b.length,d=this.destination,e=0;e<c;e++)if(a=b[e],"function"===typeof a.hasValue&&!a.hasValue())return;var g=!1,k=[];for(e=0;e<c;e++){a=b[e];var l=a.next();a.hasCompleted()&&(g=!0);if(l.done){d.complete();return}k.push(l.value)}this.project?this._tryProject(k):d.next(k);g&&d.complete()};b.prototype._tryProject=function(a){try{var b=this.project.apply(this,a)}catch(y){this.destination.error(y);
-return}this.destination.next(b)};return b}(h.Subscriber);f.ZipSubscriber=l;var k=function(){function a(a){this.iterator=a;this.nextResult=a.next()}a.prototype.hasValue=function(){return!0};a.prototype.next=function(){var a=this.nextResult;this.nextResult=this.iterator.next();return a};a.prototype.hasCompleted=function(){var a=this.nextResult;return a&&a.done};return a}(),t=function(){function a(a){this.array=a;this.length=this.index=0;this.length=a.length}a.prototype[e.iterator]=function(){return this};
-a.prototype.next=function(a){a=this.index++;var b=this.array;return a<this.length?{value:b[a],done:!1}:{value:null,done:!0}};a.prototype.hasValue=function(){return this.array.length>this.index};a.prototype.hasCompleted=function(){return this.array.length===this.index};return a}(),m=function(a){function b(b,c,d){a.call(this,b);this.parent=c;this.observable=d;this.stillUnsubscribed=!0;this.buffer=[];this.isComplete=!1}p(b,a);b.prototype[e.iterator]=function(){return this};b.prototype.next=function(){var a=
-this.buffer;return 0===a.length&&this.isComplete?{value:null,done:!0}:{value:a.shift(),done:!1}};b.prototype.hasValue=function(){return 0<this.buffer.length};b.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete};b.prototype.notifyComplete=function(){0<this.buffer.length?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()};b.prototype.notifyNext=function(a,b,c,d,e){this.buffer.push(b);this.parent.checkIterators()};b.prototype.subscribe=function(a,
-b){return c.subscribeToResult(this,this.observable,this,b)};return b}(b.OuterSubscriber)},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);f.map=function(a,b){if("function"!==typeof a)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return this.lift(new p(a,b))};var p=function(){function a(a,c){this.project=
-a;this.thisArg=c}a.prototype.call=function(a,c){return c.subscribe(new n(a,this.project,this.thisArg))};return a}();f.MapOperator=p;var n=function(a){function b(b,d,g){a.call(this,b);this.project=d;this.count=0;this.thisArg=g||this}q(b,a);b.prototype._next=function(a){try{var b=this.project.call(this.thisArg,a,this.count++)}catch(g){this.destination.error(g);return}this.destination.next(b)};return b}(h.Subscriber)},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=
-a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);f.reduce=function(a,b){var c=!1;2<=arguments.length&&(c=!0);return this.lift(new p(a,b,c))};var p=function(){function a(a,c,d){void 0===d&&(d=!1);this.accumulator=a;this.seed=c;this.hasSeed=d}a.prototype.call=function(a,c){return c.subscribe(new n(a,this.accumulator,this.seed,this.hasSeed))};return a}();f.ReduceOperator=p;var n=function(a){function b(b,d,g,l){a.call(this,
-b);this.accumulator=d;this.hasSeed=l;this.index=0;this.hasValue=!1;this.acc=g;this.hasSeed||this.index++}q(b,a);b.prototype._next=function(a){this.hasValue||(this.hasValue=this.hasSeed)?this._tryReduce(a):(this.acc=a,this.hasValue=!0)};b.prototype._tryReduce=function(a){try{var b=this.accumulator(this.acc,a,this.index++)}catch(g){this.destination.error(g);return}this.acc=b};b.prototype._complete=function(){(this.hasValue||this.hasSeed)&&this.destination.next(this.acc);this.destination.complete()};
-return b}(h.Subscriber);f.ReduceSubscriber=n},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a){Object(B.t)(a);try{return{corner:Object(B.v)(a,"corner",function(a){return Object(B.f)(C.s.create(),a,B.n)}),size:Object(B.v)(a,"size",function(a){return Object(B.f)(C.s.create(),a,B.o)}),metadata:Object(B.v)(a,"metadata",B.y)}}catch(fa){throw Error("Failed to parse bounding box: "+fa.message);}}function b(a){var b=a.match(/^([^:?]+:[^:?]+:[^:?]+)(?::([^:?]+))?(?:\?(.*))?$/);
-if(null===b)throw Error("Invalid Brain Maps volume key: "+JSON.stringify(a)+".");var c;void 0!==b[2]&&(c={changeStackId:b[2]});a=Object(B.e)(b[3]||"");return{volumeId:b[1],changeSpec:c,parameters:a}}function c(a){try{return Object(B.t)(a),{id:Object(B.v)(a,"id",B.A),label:Object(B.v)(a,"label",B.A),description:Object(B.v)(a,"description",B.y)}}catch(fa){throw Error("Failed to parse project: "+fa.message);}}function e(a){try{return Object(B.t)(a),Object(B.v)(a,"project",function(a){return void 0===
-a?[]:Object(B.a)(a,c)})}catch(fa){throw Error("Error parsing project list: "+fa.message);}}function g(a){return Object(B.v)(a,"changeStackId",function(a){return void 0===a?void 0:Object(B.a)(a,B.A)})}function l(a){a=a.scales[0];return[[{parameters:void 0,spec:new t.k({voxelSize:a.voxelSize,chunkSize:C.s.multiply(C.s.create(),a.upperVoxelBound,a.voxelSize),upperChunkBound:C.s.fromValues(1,1,1)})}]]}Object.defineProperty(f,"__esModule",{value:!0});a.d(f,"BrainmapsSkeletonSource",function(){return M});
-a.d(f,"VolumeInfo",function(){return N});a.d(f,"MultiscaleVolumeInfo",function(){return S});a.d(f,"MeshInfo",function(){return U});a.d(f,"MultiscaleVolumeChunkSource",function(){return Z});f.parseVolumeKey=b;a.d(f,"VolumeList",function(){return Q});f.parseChangeStackList=g;a.d(f,"BrainmapsAnnotationSource",function(){return aa});a.d(f,"BrainmapsDataSource",function(){return ba});var k=a(28),t=a(95);h=a(73);var m=a(24),r=a(260),u=a(46),v=a(103),w=a(264),y=a(54),x=a(104),A=a(39),z=a(26),D=a(33),E=a(31),
-G=a(62),C=a(2),B=a(4),F=a(23),L=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),J=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);return b}(Object(m.f)(Object(r.a)()(D.b),w.e)),O=function(a){function b(){q(this,b);return p(this,(b.__proto__||
-Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);return b}(Object(m.f)(Object(r.a)()(y.c),w.b)),M=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);L(b,[{key:"skeletonVertexCoordinatesInVoxels",get:function(){return!1}}]);return b}(Object(m.f)(Object(r.a)()(x.d),w.c)),P=new Map;P.set("UINT8",z.a.UINT8);P.set("FLOAT",z.a.FLOAT32);P.set("UINT64",z.a.UINT64);var N=function fa(a){q(this,fa);try{Object(B.t)(a),this.numChannels=
-Object(B.v)(a,"channelCount",B.z),this.dataType=Object(B.v)(a,"channelType",function(a){return Object(B.s)(a,P)}),this.voxelSize=Object(B.v)(a,"pixelSize",function(a){return Object(B.f)(C.s.create(),a,B.o)}),this.upperVoxelBound=Object(B.v)(a,"volumeSize",function(a){return Object(B.f)(C.s.create(),a,B.z)}),this.boundingBoxes=Object(B.v)(a,"boundingBox",function(a){return void 0===a?[]:Object(B.a)(a,d)})}catch(X){throw Error("Failed to parse BrainMaps volume geometry: "+X.message);}},S=function R(a){q(this,
-R);try{Object(B.t)(a);var b=this.scales=Object(B.v)(a,"geometry",function(a){return Object(B.a)(a,function(a){return new N(a)})});if(0===b.length)throw Error("Expected at least one scale.");var c=b[0],d=this.numChannels=c.numChannels,e=this.dataType=c.dataType;a=1;for(var g=b.length;a<g;++a){var k=b[a];if(k.dataType!==e)throw Error("Scale "+a+" has data type "+z.a[k.dataType]+" "+("but scale 0 has data type "+z.a[e]+"."));if(k.numChannels!==d)throw Error("Scale "+a+" has "+k.numChannels+" channel(s) "+
-("but scale 0 has "+d+" channels."));}}catch(Aa){throw Error("Failed to parse BrainMaps multiscale volume specification: "+Aa.message);}},U=function X(a){q(this,X);Object(B.t)(a);this.name=Object(B.v)(a,"name",B.A);this.type=Object(B.v)(a,"type",B.A)},Z=function(){function a(b,c,d,e,g,k,l,m){q(this,a);this.chunkManager=b;this.instance=c;this.credentialsProvider=d;this.volumeId=e;this.changeSpec=g;this.multiscaleVolumeInfo=k;this.encoding=m.encoding;this.chunkLayoutPreference=m.chunkLayoutPreference;
-if(1===this.numChannels)switch(this.dataType){case z.a.UINT64:var r=z.c.SEGMENTATION}void 0===r&&(r=void 0!==m.volumeType?m.volumeType:z.c.IMAGE);this.volumeType=r;try{Object(B.t)(l),this.meshes=Object(B.v)(l,"meshes",function(a){return void 0===a?[]:Object(B.a)(a,function(a){return new U(a)})})}catch(Fb){throw Error("Failed to parse BrainMaps meshes specification: "+Fb.message);}}L(a,[{key:"getSources",value:function(a){var b=this,c=w.d.RAW;this.dataType===z.a.UINT64?c=w.d.COMPRESSED_SEGMENTATION:
-this.volumeType===z.c.IMAGE&&this.dataType===z.a.UINT8&&1===this.numChannels&&this.encoding!==w.d.RAW&&(c=w.d.JPEG);var d=this.scales[0],e=C.s.multiply(C.s.create(),d.upperVoxelBound,d.voxelSize);return this.scales.map(function(d,g){return z.b.getDefaults({voxelSize:d.voxelSize,dataType:d.dataType,numChannels:d.numChannels,upperVoxelBound:d.upperVoxelBound,upperClipBound:e,volumeType:b.volumeType,volumeSourceOptions:a,chunkLayoutPreference:b.chunkLayoutPreference}).map(function(a){return b.chunkManager.getChunkSource(J,
-{credentialsProvider:b.credentialsProvider,spec:a,parameters:{instance:b.instance,volumeId:b.volumeId,changeSpec:b.changeSpec,scaleIndex:g,encoding:c}})})})}},{key:"getMeshSource",value:function(){for(var a=$jscomp.makeIterator(this.meshes),b=a.next();!b.done;b=a.next()){b=b.value;if("TRIANGLES"===b.type)return this.chunkManager.getChunkSource(O,{credentialsProvider:this.credentialsProvider,parameters:{instance:this.instance,volumeId:this.volumeId,meshName:b.name,changeSpec:this.changeSpec}});if("LINE_SEGMENTS"===
-b.type)return this.chunkManager.getChunkSource(M,{credentialsProvider:this.credentialsProvider,parameters:{instance:this.instance,volumeId:this.volumeId,meshName:b.name,changeSpec:this.changeSpec}})}return null}},{key:"getStaticAnnotations",value:function(){var a=this.scales[0],b=new k.b(C.k.fromScaling(C.k.create(),a.voxelSize));b.readonly=!0;b.add(Object(k.i)(C.s.create(),a.upperVoxelBound));a.boundingBoxes.forEach(function(a,c){b.add({type:k.c.AXIS_ALIGNED_BOUNDING_BOX,description:a.metadata,pointA:a.corner,
-pointB:C.s.add(C.s.create(),a.corner,a.size),id:"boundingBox"+c})});return b}},{key:"scales",get:function(){return this.multiscaleVolumeInfo.scales}},{key:"dataType",get:function(){return this.multiscaleVolumeInfo.dataType}},{key:"numChannels",get:function(){return this.multiscaleVolumeInfo.numChannels}}]);return a}(),H=/^([^\/]+)\/(.*)$/,Q=function Ka(a,b){q(this,Ka);this.projects=new Map;this.hierarchicalVolumeIds=new Map;var c=this.projects;a=$jscomp.makeIterator(e(a));for(var d=a.next();!d.done;d=
-a.next())d=d.value,c.set(d.id,d);try{Object(B.t)(b);var g=this.volumeIds=Object(B.v)(b,"volumeId",function(a){return void 0===a?[]:Object(B.a)(a,B.A)});g.sort();for(var k=new Map,l=$jscomp.makeIterator(g),m=l.next();!m.done;m=l.next()){var r=m.value;for(b=0;;){var f=r.indexOf(":",b);-1===f?f=void 0:++f;var t=r.substring(0,b),h=k.get(t);void 0===h&&(h=new Set,k.set(t,h));h.add(r.substring(b,f));if(void 0===f)break;b=f}}for(var u=this.hierarchicalVolumeIds,v=$jscomp.makeIterator(k),n=v.next();!n.done;n=
-v.next()){var p=$jscomp.makeIterator(n.value),w=p.next().value,x=p.next().value;u.set(w,Array.from(x))}}catch(Ua){throw Error("Failed to parse Brain Maps volume list reply: "+Ua.message);}},aa=function(a){function b(a,c){q(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,Object.assign({sourceSpecifications:l(c.multiscaleVolumeInfo)},c)));C.k.fromScaling(a.objectToLocal,c.multiscaleVolumeInfo.scales[0].voxelSize);return a}n(b,a);return b}(Object(m.f)(Object(r.a)()(h.c),w.a)),ba=
-function(a){function c(a,b){q(this,c);var d=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.instance=a;d.credentialsProvider=b;return d}n(c,a);L(c,[{key:"getMeshSource",value:function(a,b){return a.getChunkSource(O,{credentialsProvider:this.credentialsProvider,parameters:this.getMeshSourceParameters(b)})}},{key:"getMeshSourceParameters",value:function(a){var c=a.match(H);if(null===c)throw Error("Invalid Brainmaps mesh URL: "+a);a=b(c[1]);return{instance:this.instance,volumeId:a.volumeId,
-changeSpec:a.changeSpec,meshName:c[2]}}},{key:"getSkeletonSource",value:function(a,b){return a.getChunkSource(M,{credentialsProvider:this.credentialsProvider,parameters:this.getMeshSourceParameters(b)})}},{key:"getMultiscaleInfo",value:function(a,b){var c=this;return a.memoize.getUncounted({type:"brainmaps:getMultiscaleInfo",volumeId:b,instance:this.instance,credentialsProvider:Object(F.a)(this.credentialsProvider)},function(){return Object(v.b)(c.instance,c.credentialsProvider,{method:"GET",path:"/v1beta2/volumes/"+
-b,responseType:"json"}).then(function(a){return new S(a)})})}},{key:"getVolume",value:function(a,c,d){var e=this;c=b(c);var g=c.volumeId,k=c.changeSpec,l=c.parameters;Object(B.t)(l);c=Object(B.v)(l,"encoding",function(a){return void 0===a?void 0:Object(B.m)(a,w.d)});l=Object(B.v)(l,"chunkLayout",function(a){return void 0===a?void 0:Object(B.m)(a,A.a)});var m=Object.assign({},d,{encoding:c,chunkLayoutPreference:l});return a.memoize.getUncounted({type:"brainmaps:getVolume",instance:this.instance,volumeId:g,
-changeSpec:k,brainmapsOptions:m},function(){return Promise.all([e.getMultiscaleInfo(a,g),Object(v.b)(e.instance,e.credentialsProvider,{method:"GET",path:"/v1beta2/objects/"+g+"/meshes",responseType:"json"})]).then(function(b){var c=$jscomp.makeIterator(b);b=c.next().value;c=c.next().value;return new Z(a,e.instance,e.credentialsProvider,g,k,b,c,m)})})}},{key:"getAnnotationSource",value:function(a,c){var d=this;c=b(c);var e=c.volumeId;c=c.changeSpec;if(void 0===c)throw Error("A changestack must be specified.");
-var g={instance:this.instance,volumeId:e,changestack:c.changeStackId};return a.memoize.getUncounted({type:"brainmaps:getAnnotationSource",instance:this.instance,credentialsProvider:Object(F.a)(this.credentialsProvider),parameters:g},function(){return d.getMultiscaleInfo(a,e).then(function(b){return a.getChunkSource(aa,{parameters:g,credentialsProvider:d.credentialsProvider,multiscaleVolumeInfo:b})})})}},{key:"getVolumeList",value:function(a){var b=this;return a.memoize.getUncounted({instance:this.instance,
-type:"brainmaps:getVolumeList"},function(){var a=Promise.all([Object(v.b)(b.instance,b.credentialsProvider,{method:"GET",path:"/v1beta2/projects",responseType:"json"}),Object(v.b)(b.instance,b.credentialsProvider,{method:"GET",path:"/v1beta2/volumes",responseType:"json"})]).then(function(a){var b=$jscomp.makeIterator(a);a=b.next().value;b=b.next().value;return new Q(a,b)}),c=b.instance.description+" volume list";E.a.forPromise(a,{delay:!0,initialMessage:"Retrieving "+c+".",errorPrefix:"Error retrieving "+
-c+": "});return a})}},{key:"getChangeStackList",value:function(a,b){var c=this;return a.memoize.getUncounted({instance:this.instance,type:"brainmaps:getChangeStackList",volumeId:b},function(){var a=Object(v.b)(c.instance,c.credentialsProvider,{method:"GET",path:"/v1beta2/changes/"+b+"/change_stacks",responseType:"json"}).then(function(a){return g(a)}),d="change stacks for "+b;E.a.forPromise(a,{delay:!0,initialMessage:"Retrieving "+d+".",errorPrefix:"Error retrieving "+d+": "});return a})}},{key:"volumeCompleter",
-value:function(a,b){var c=this;return this.getVolumeList(b).then(function(d){var e=a.match(/^([^:]+:[^:]+:[^:]+):(.*)$/);if(null!==e){var g=e[1],k=e[2];return c.getChangeStackList(b,g).then(function(a){if(void 0===a)throw null;return{offset:g.length+1,completions:Object(G.b)(k,a)}})}var l=a.lastIndexOf(":")+1;e=a.substring(0,l);l=a.substring(l);var m=d.hierarchicalVolumeIds.get(e);if(void 0===m)throw null;return e?{offset:e.length,completions:Object(G.b)(l,m)}:{offset:0,completions:Object(G.c)(l,
-m,function(a){return a},function(a){return(a=d.projects.get(a.substring(0,a.length-1)))&&a.label})}})}},{key:"description",get:function(){return this.instance.description}}]);return c}(u.a);f.productionInstance={description:"Google Brain Maps",serverUrls:["https://brainmaps.googleapis.com"]}},function(h,f,a){a(34);a(227);a(228);var q=a(133),p=a(229),n=a(230),d=a(231),b=a(134),c=a(135);a.d(f,"a",function(){return q});a.d(f,"b",function(){return p});a.d(f,"c",function(){return n});a.d(f,"d",function(){return d});
-a.d(f,"e",function(){return b});a.d(f,"f",function(){return c})},function(h,f,a){function q(a,b,c){var d=b[0],g=b[1],l=b[2],k=b[3],f=b[4],m=b[5],r=b[6],h=b[7];b=b[8];var v=c[0],n=c[1],p=c[2],q=c[3],A=c[4],z=c[5],D=c[6],E=c[7];c=c[8];a[0]=v*d+n*k+p*r;a[1]=v*g+n*f+p*h;a[2]=v*l+n*m+p*b;a[3]=q*d+A*k+z*r;a[4]=q*g+A*f+z*h;a[5]=q*l+A*m+z*b;a[6]=D*d+E*k+c*r;a[7]=D*g+E*f+c*h;a[8]=D*l+E*m+c*b;return a}function p(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];a[3]=b[3]-c[3];a[4]=b[4]-c[4];a[5]=b[5]-c[5];
-a[6]=b[6]-c[6];a[7]=b[7]-c[7];a[8]=b[8]-c[8];return a}Object.defineProperty(f,"__esModule",{value:!0});f.create=function(){var a=new n.a(9);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};f.fromMat4=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[4];a[4]=b[5];a[5]=b[6];a[6]=b[8];a[7]=b[9];a[8]=b[10];return a};f.clone=function(a){var b=new n.a(9);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return b};f.copy=function(a,b){a[0]=
-b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];return a};f.fromValues=function(a,b,c,e,g,l,k,f,m){var d=new n.a(9);d[0]=a;d[1]=b;d[2]=c;d[3]=e;d[4]=g;d[5]=l;d[6]=k;d[7]=f;d[8]=m;return d};f.set=function(a,b,c,e,g,l,k,f,m,r){a[0]=b;a[1]=c;a[2]=e;a[3]=g;a[4]=l;a[5]=k;a[6]=f;a[7]=m;a[8]=r;return a};f.identity=function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};f.transpose=function(a,b){if(a===b){var c=b[1],d=b[2],g=b[5];a[1]=b[3];
-a[2]=b[6];a[3]=c;a[5]=b[7];a[6]=d;a[7]=g}else a[0]=b[0],a[1]=b[3],a[2]=b[6],a[3]=b[1],a[4]=b[4],a[5]=b[7],a[6]=b[2],a[7]=b[5],a[8]=b[8];return a};f.invert=function(a,b){var c=b[0],d=b[1],g=b[2],l=b[3],k=b[4],f=b[5],m=b[6],r=b[7];b=b[8];var h=b*k-f*r,v=-b*l+f*m,n=r*l-k*m,p=c*h+d*v+g*n;if(!p)return null;p=1/p;a[0]=h*p;a[1]=(-b*d+g*r)*p;a[2]=(f*d-g*k)*p;a[3]=v*p;a[4]=(b*c-g*m)*p;a[5]=(-f*c+g*l)*p;a[6]=n*p;a[7]=(-r*c+d*m)*p;a[8]=(k*c-d*l)*p;return a};f.adjoint=function(a,b){var c=b[0],d=b[1],g=b[2],l=
-b[3],k=b[4],f=b[5],m=b[6],r=b[7];b=b[8];a[0]=k*b-f*r;a[1]=g*r-d*b;a[2]=d*f-g*k;a[3]=f*m-l*b;a[4]=c*b-g*m;a[5]=g*l-c*f;a[6]=l*r-k*m;a[7]=d*m-c*r;a[8]=c*k-d*l;return a};f.determinant=function(a){var b=a[3],c=a[4],d=a[5],g=a[6],l=a[7],k=a[8];return a[0]*(k*c-d*l)+a[1]*(-k*b+d*g)+a[2]*(l*b-c*g)};f.multiply=q;f.translate=function(a,b,c){var d=b[0],g=b[1],l=b[2],k=b[3],f=b[4],m=b[5],r=b[6],h=b[7];b=b[8];var v=c[0];c=c[1];a[0]=d;a[1]=g;a[2]=l;a[3]=k;a[4]=f;a[5]=m;a[6]=v*d+c*k+r;a[7]=v*g+c*f+h;a[8]=v*l+c*
-m+b;return a};f.rotate=function(a,b,c){var d=b[0],g=b[1],l=b[2],k=b[3],f=b[4],m=b[5],r=b[6],h=b[7];b=b[8];var v=Math.sin(c);c=Math.cos(c);a[0]=c*d+v*k;a[1]=c*g+v*f;a[2]=c*l+v*m;a[3]=c*k-v*d;a[4]=c*f-v*g;a[5]=c*m-v*l;a[6]=r;a[7]=h;a[8]=b;return a};f.scale=function(a,b,c){var d=c[0];c=c[1];a[0]=d*b[0];a[1]=d*b[1];a[2]=d*b[2];a[3]=c*b[3];a[4]=c*b[4];a[5]=c*b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];return a};f.fromTranslation=function(a,b){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=b[0];a[7]=b[1];a[8]=1;
-return a};f.fromRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=c;a[2]=0;a[3]=-c;a[4]=b;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};f.fromScaling=function(a,b){a[0]=b[0];a[1]=0;a[2]=0;a[3]=0;a[4]=b[1];a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};f.fromMat2d=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=0;a[3]=b[2];a[4]=b[3];a[5]=0;a[6]=b[4];a[7]=b[5];a[8]=1;return a};f.fromQuat=function(a,b){var c=b[0],d=b[1],g=b[2];b=b[3];var l=c+c,k=d+d,f=g+g;c*=l;var m=d*l;d*=k;var r=g*l,h=g*k;g*=f;l*=b;k*=b;b*=
-f;a[0]=1-d-g;a[3]=m-b;a[6]=r+k;a[1]=m+b;a[4]=1-c-g;a[7]=h-l;a[2]=r-k;a[5]=h+l;a[8]=1-c-d;return a};f.normalFromMat4=function(a,b){var c=b[0],d=b[1],g=b[2],l=b[3],k=b[4],f=b[5],m=b[6],r=b[7],h=b[8],v=b[9],n=b[10],p=b[11],q=b[12],A=b[13],z=b[14];b=b[15];var D=c*f-d*k,E=c*m-g*k,G=c*r-l*k,C=d*m-g*f,B=d*r-l*f,F=g*r-l*m,L=h*A-v*q,J=h*z-n*q;h=h*b-p*q;var O=v*z-n*A;v=v*b-p*A;n=n*b-p*z;p=D*n-E*v+G*O+C*h-B*J+F*L;if(!p)return null;p=1/p;a[0]=(f*n-m*v+r*O)*p;a[1]=(m*h-k*n-r*J)*p;a[2]=(k*v-f*h+r*L)*p;a[3]=(g*
-v-d*n-l*O)*p;a[4]=(c*n-g*h+l*J)*p;a[5]=(d*h-c*v-l*L)*p;a[6]=(A*F-z*B+b*C)*p;a[7]=(z*G-q*F-b*E)*p;a[8]=(q*B-A*G+b*D)*p;return a};f.projection=function(a,b,c){a[0]=2/b;a[1]=0;a[2]=0;a[3]=0;a[4]=-2/c;a[5]=0;a[6]=-1;a[7]=1;a[8]=1;return a};f.str=function(a){return"mat3("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+")"};f.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],
-2)+Math.pow(a[7],2)+Math.pow(a[8],2))};f.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];a[4]=b[4]+c[4];a[5]=b[5]+c[5];a[6]=b[6]+c[6];a[7]=b[7]+c[7];a[8]=b[8]+c[8];return a};f.subtract=p;f.multiplyScalar=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;a[4]=b[4]*c;a[5]=b[5]*c;a[6]=b[6]*c;a[7]=b[7]*c;a[8]=b[8]*c;return a};f.multiplyScalarAndAdd=function(a,b,c,e){a[0]=b[0]+c[0]*e;a[1]=b[1]+c[1]*e;a[2]=b[2]+c[2]*e;a[3]=b[3]+c[3]*e;a[4]=b[4]+c[4]*e;a[5]=
-b[5]+c[5]*e;a[6]=b[6]+c[6]*e;a[7]=b[7]+c[7]*e;a[8]=b[8]+c[8]*e;return a};f.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]};f.equals=function(a,b){var c=a[0],d=a[1],g=a[2],l=a[3],k=a[4],f=a[5],m=a[6],r=a[7];a=a[8];var h=b[0],v=b[1],p=b[2],q=b[3],x=b[4],A=b[5],z=b[6],D=b[7];b=b[8];return Math.abs(c-h)<=n.b*Math.max(1,Math.abs(c),Math.abs(h))&&Math.abs(d-v)<=n.b*Math.max(1,Math.abs(d),Math.abs(v))&&
-Math.abs(g-p)<=n.b*Math.max(1,Math.abs(g),Math.abs(p))&&Math.abs(l-q)<=n.b*Math.max(1,Math.abs(l),Math.abs(q))&&Math.abs(k-x)<=n.b*Math.max(1,Math.abs(k),Math.abs(x))&&Math.abs(f-A)<=n.b*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(m-z)<=n.b*Math.max(1,Math.abs(m),Math.abs(z))&&Math.abs(r-D)<=n.b*Math.max(1,Math.abs(r),Math.abs(D))&&Math.abs(a-b)<=n.b*Math.max(1,Math.abs(a),Math.abs(b))};var n=a(34);f.mul=q;f.sub=p},function(h,f,a){function q(){var a=new m.a(3);a[0]=0;a[1]=0;a[2]=0;return a}function p(a){var b=
-a[0],c=a[1];a=a[2];return Math.sqrt(b*b+c*c+a*a)}function n(a,b,c){var d=new m.a(3);d[0]=a;d[1]=b;d[2]=c;return d}function d(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];return a}function b(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];a[2]=b[2]*c[2];return a}function c(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];a[2]=b[2]/c[2];return a}function e(a,b){var c=b[0]-a[0],d=b[1]-a[1];a=b[2]-a[2];return Math.sqrt(c*c+d*d+a*a)}function g(a,b){var c=b[0]-a[0],d=b[1]-a[1];a=b[2]-a[2];return c*c+d*d+a*a}function l(a){var b=
-a[0],c=a[1];a=a[2];return b*b+c*c+a*a}function k(a,b){var c=b[0],d=b[1],e=b[2];c=c*c+d*d+e*e;0<c&&(c=1/Math.sqrt(c),a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c);return a}function t(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}Object.defineProperty(f,"__esModule",{value:!0});f.create=q;f.clone=function(a){var b=new m.a(3);b[0]=a[0];b[1]=a[1];b[2]=a[2];return b};f.length=p;f.fromValues=n;f.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];return a};f.set=function(a,b,c,d){a[0]=b;a[1]=c;a[2]=d;return a};f.add=function(a,
-b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];return a};f.subtract=d;f.multiply=b;f.divide=c;f.ceil=function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);a[2]=Math.ceil(b[2]);return a};f.floor=function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);a[2]=Math.floor(b[2]);return a};f.min=function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);a[2]=Math.min(b[2],c[2]);return a};f.max=function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);a[2]=Math.max(b[2],c[2]);return a};
-f.round=function(a,b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);a[2]=Math.round(b[2]);return a};f.scale=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;return a};f.scaleAndAdd=function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;a[2]=b[2]+c[2]*d;return a};f.distance=e;f.squaredDistance=g;f.squaredLength=l;f.negate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];return a};f.inverse=function(a,b){a[0]=1/b[0];a[1]=1/b[1];a[2]=1/b[2];return a};f.normalize=k;f.dot=t;f.cross=function(a,b,c){var d=b[0],
-e=b[1];b=b[2];var g=c[0],k=c[1];c=c[2];a[0]=e*c-b*k;a[1]=b*g-d*c;a[2]=d*k-e*g;return a};f.lerp=function(a,b,c,d){var e=b[0],g=b[1];b=b[2];a[0]=e+d*(c[0]-e);a[1]=g+d*(c[1]-g);a[2]=b+d*(c[2]-b);return a};f.hermite=function(a,b,c,d,e,g){var k=g*g,l=k*(2*g-3)+1,m=k*(g-2)+g,f=k*(g-1);g=k*(3-2*g);a[0]=b[0]*l+c[0]*m+d[0]*f+e[0]*g;a[1]=b[1]*l+c[1]*m+d[1]*f+e[1]*g;a[2]=b[2]*l+c[2]*m+d[2]*f+e[2]*g;return a};f.bezier=function(a,b,c,d,e,g){var k=1-g,l=k*k,m=g*g,f=l*k;l*=3*g;k*=3*m;g*=m;a[0]=b[0]*f+c[0]*l+d[0]*
-k+e[0]*g;a[1]=b[1]*f+c[1]*l+d[1]*k+e[1]*g;a[2]=b[2]*f+c[2]*l+d[2]*k+e[2]*g;return a};f.random=function(a,b){b=b||1;var c=2*m.c()*Math.PI,d=2*m.c()-1,e=Math.sqrt(1-d*d)*b;a[0]=Math.cos(c)*e;a[1]=Math.sin(c)*e;a[2]=d*b;return a};f.transformMat4=function(a,b,c){var d=b[0],e=b[1];b=b[2];var g=c[3]*d+c[7]*e+c[11]*b+c[15];g=g||1;a[0]=(c[0]*d+c[4]*e+c[8]*b+c[12])/g;a[1]=(c[1]*d+c[5]*e+c[9]*b+c[13])/g;a[2]=(c[2]*d+c[6]*e+c[10]*b+c[14])/g;return a};f.transformMat3=function(a,b,c){var d=b[0],e=b[1];b=b[2];
-a[0]=d*c[0]+e*c[3]+b*c[6];a[1]=d*c[1]+e*c[4]+b*c[7];a[2]=d*c[2]+e*c[5]+b*c[8];return a};f.transformQuat=function(a,b,c){var d=b[0],e=b[1],g=b[2];b=c[0];var k=c[1],l=c[2];c=c[3];var m=c*d+k*g-l*e,f=c*e+l*d-b*g,r=c*g+b*e-k*d;d=-b*d-k*e-l*g;a[0]=m*c+d*-b+f*-l-r*-k;a[1]=f*c+d*-k+r*-b-m*-l;a[2]=r*c+d*-l+m*-k-f*-b;return a};f.rotateX=function(a,b,c,d){var e=[],g=[];e[0]=b[0]-c[0];e[1]=b[1]-c[1];e[2]=b[2]-c[2];g[0]=e[0];g[1]=e[1]*Math.cos(d)-e[2]*Math.sin(d);g[2]=e[1]*Math.sin(d)+e[2]*Math.cos(d);a[0]=g[0]+
-c[0];a[1]=g[1]+c[1];a[2]=g[2]+c[2];return a};f.rotateY=function(a,b,c,d){var e=[],g=[];e[0]=b[0]-c[0];e[1]=b[1]-c[1];e[2]=b[2]-c[2];g[0]=e[2]*Math.sin(d)+e[0]*Math.cos(d);g[1]=e[1];g[2]=e[2]*Math.cos(d)-e[0]*Math.sin(d);a[0]=g[0]+c[0];a[1]=g[1]+c[1];a[2]=g[2]+c[2];return a};f.rotateZ=function(a,b,c,d){var e=[],g=[];e[0]=b[0]-c[0];e[1]=b[1]-c[1];e[2]=b[2]-c[2];g[0]=e[0]*Math.cos(d)-e[1]*Math.sin(d);g[1]=e[0]*Math.sin(d)+e[1]*Math.cos(d);g[2]=e[2];a[0]=g[0]+c[0];a[1]=g[1]+c[1];a[2]=g[2]+c[2];return a};
-f.angle=function(a,b){a=n(a[0],a[1],a[2]);b=n(b[0],b[1],b[2]);k(a,a);k(b,b);b=t(a,b);return 1<b?0:-1>b?Math.PI:Math.acos(b)};f.str=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"};f.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]};f.equals=function(a,b){var c=a[0],d=a[1];a=a[2];var e=b[0],g=b[1];b=b[2];return Math.abs(c-e)<=m.b*Math.max(1,Math.abs(c),Math.abs(e))&&Math.abs(d-g)<=m.b*Math.max(1,Math.abs(d),Math.abs(g))&&Math.abs(a-b)<=m.b*Math.max(1,Math.abs(a),Math.abs(b))};
-var m=a(34);f.sub=d;f.mul=b;f.div=c;f.dist=e;f.sqrDist=g;f.len=p;f.sqrLen=l;h=function(){var a=q();return function(b,c,d,e,g,k){c||(c=3);d||(d=0);for(e=e?Math.min(e*c+d,b.length):b.length;d<e;d+=c)a[0]=b[d],a[1]=b[d+1],a[2]=b[d+2],g(a,a,k),b[d]=a[0],b[d+1]=a[1],b[d+2]=a[2];return b}}();f.forEach=h},function(h,f,a){function q(){var a=new t.a(4);a[0]=0;a[1]=0;a[2]=0;a[3]=0;return a}function p(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];a[3]=b[3]-c[3];return a}function n(a,b,c){a[0]=b[0]*c[0];
-a[1]=b[1]*c[1];a[2]=b[2]*c[2];a[3]=b[3]*c[3];return a}function d(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];a[2]=b[2]/c[2];a[3]=b[3]/c[3];return a}function b(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;return a}function c(a,b){var c=b[0]-a[0],d=b[1]-a[1],e=b[2]-a[2];a=b[3]-a[3];return Math.sqrt(c*c+d*d+e*e+a*a)}function e(a,b){var c=b[0]-a[0],d=b[1]-a[1],e=b[2]-a[2];a=b[3]-a[3];return c*c+d*d+e*e+a*a}function g(a){var b=a[0],c=a[1],d=a[2];a=a[3];return Math.sqrt(b*b+c*c+d*d+a*a)}function l(a){var b=
-a[0],c=a[1],d=a[2];a=a[3];return b*b+c*c+d*d+a*a}function k(a,b){var c=b[0],d=b[1],e=b[2];b=b[3];var g=c*c+d*d+e*e+b*b;0<g&&(g=1/Math.sqrt(g),a[0]=c*g,a[1]=d*g,a[2]=e*g,a[3]=b*g);return a}Object.defineProperty(f,"__esModule",{value:!0});f.create=q;f.clone=function(a){var b=new t.a(4);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];return b};f.fromValues=function(a,b,c,d){var e=new t.a(4);e[0]=a;e[1]=b;e[2]=c;e[3]=d;return e};f.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];return a};f.set=function(a,
-b,c,d,e){a[0]=b;a[1]=c;a[2]=d;a[3]=e;return a};f.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];return a};f.subtract=p;f.multiply=n;f.divide=d;f.ceil=function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);a[2]=Math.ceil(b[2]);a[3]=Math.ceil(b[3]);return a};f.floor=function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);a[2]=Math.floor(b[2]);a[3]=Math.floor(b[3]);return a};f.min=function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);a[2]=Math.min(b[2],
-c[2]);a[3]=Math.min(b[3],c[3]);return a};f.max=function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);a[2]=Math.max(b[2],c[2]);a[3]=Math.max(b[3],c[3]);return a};f.round=function(a,b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);a[2]=Math.round(b[2]);a[3]=Math.round(b[3]);return a};f.scale=b;f.scaleAndAdd=function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;a[2]=b[2]+c[2]*d;a[3]=b[3]+c[3]*d;return a};f.distance=c;f.squaredDistance=e;f.length=g;f.squaredLength=l;f.negate=function(a,b){a[0]=
--b[0];a[1]=-b[1];a[2]=-b[2];a[3]=-b[3];return a};f.inverse=function(a,b){a[0]=1/b[0];a[1]=1/b[1];a[2]=1/b[2];a[3]=1/b[3];return a};f.normalize=k;f.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]};f.lerp=function(a,b,c,d){var e=b[0],g=b[1],k=b[2];b=b[3];a[0]=e+d*(c[0]-e);a[1]=g+d*(c[1]-g);a[2]=k+d*(c[2]-k);a[3]=b+d*(c[3]-b);return a};f.random=function(a,c){c=c||1;a[0]=t.c();a[1]=t.c();a[2]=t.c();a[3]=t.c();k(a,a);b(a,a,c);return a};f.transformMat4=function(a,b,c){var d=b[0],e=b[1],
-g=b[2];b=b[3];a[0]=c[0]*d+c[4]*e+c[8]*g+c[12]*b;a[1]=c[1]*d+c[5]*e+c[9]*g+c[13]*b;a[2]=c[2]*d+c[6]*e+c[10]*g+c[14]*b;a[3]=c[3]*d+c[7]*e+c[11]*g+c[15]*b;return a};f.transformQuat=function(a,b,c){var d=b[0],e=b[1],g=b[2],k=c[0],l=c[1],m=c[2];c=c[3];var f=c*d+l*g-m*e,t=c*e+m*d-k*g,h=c*g+k*e-l*d;d=-k*d-l*e-m*g;a[0]=f*c+d*-k+t*-m-h*-l;a[1]=t*c+d*-l+h*-k-f*-m;a[2]=h*c+d*-m+f*-l-t*-k;a[3]=b[3];return a};f.str=function(a){return"vec4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};f.exactEquals=function(a,b){return a[0]===
-b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]};f.equals=function(a,b){var c=a[0],d=a[1],e=a[2];a=a[3];var g=b[0],k=b[1],l=b[2];b=b[3];return Math.abs(c-g)<=t.b*Math.max(1,Math.abs(c),Math.abs(g))&&Math.abs(d-k)<=t.b*Math.max(1,Math.abs(d),Math.abs(k))&&Math.abs(e-l)<=t.b*Math.max(1,Math.abs(e),Math.abs(l))&&Math.abs(a-b)<=t.b*Math.max(1,Math.abs(a),Math.abs(b))};var t=a(34);f.sub=p;f.mul=n;f.div=d;f.dist=c;f.sqrDist=e;f.len=g;f.sqrLen=l;h=function(){var a=q();return function(b,c,d,e,g,k){c||(c=4);d||
-(d=0);for(e=e?Math.min(e*c+d,b.length):b.length;d<e;d+=c)a[0]=b[d],a[1]=b[d+1],a[2]=b[d+2],a[3]=b[d+3],g(a,a,k),b[d]=a[0],b[d+1]=a[1],b[d+2]=a[2],b[d+3]=a[3];return b}}();f.forEach=h},function(h,f,a){f.a=function(a){a=Math.ceil((void 0===a?128:a)/32);var f=new Uint32Array(a);crypto.getRandomValues(f);for(var h="",d=0;d<a;++d)h+=("00000000"+f[d].toString(16)).slice(-8);return h}},function(h,f,a){f=a(236);a="object"==typeof self&&self&&self.Object===Object&&self;f=f||a||Function("return this")();h.exports=
-f},function(h,f,a){f=a(137).Symbol;h.exports=f},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return d});f.c=function(a,d){if(void 0!==d){"string"===typeof d&&(d={type:d});Object(p.t)(d);var c=Object(p.v)(d,
-"type",p.A);c=b.get(c);if(void 0===c)throw Error("Invalid tool type: "+JSON.stringify(d)+".");return c(a,d)}};f.b=function(a,d){b.set(a,d)};h=a(1);var p=a(4),n=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),d=function(a){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");
-var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}q(b,a);n(b,[{key:"setActive",value:function(a){}},{key:"deactivate",value:function(){}}]);return b}(h.a),b=new Map},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}f.c=function(a,b,c){c=void 0===c?!1:c;b=b.attribute("aIndexRaw");0<=b&&(c&&a.vertexAttribDivisor(b,0),a.disableVertexAttribArray(b))};f.d=function(a){return a.memoize.get("IndexBuffer",function(){return new c(a)})};f.b=function(a){a.addAttribute("highp vec3","aIndexRaw");a.addVertexCode(d.m);a.addVertexCode("\nuint32_t getPrimitiveIndex() {\n  uint32_t result;\n  result.value = vec4(aIndexRaw, 0.0);\n  return result;\n}\n")};
-a.d(f,"a",function(){return e});f.e=function(a,b){return n.a.fromData(a,new Uint8Array(b.buffer,b.byteOffset,b.byteLength),WebGL2RenderingContext.ARRAY_BUFFER,WebGL2RenderingContext.STATIC_DRAW)};h=a(1);var n=a(20),d=a(21),b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),c=function(a){function c(a){q(this,
-c);var b=(c.__proto__||Object.getPrototypeOf(c)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");b=!b||"object"!==typeof b&&"function"!==typeof b?this:b;b.gl=a;b.buffer=b.registerDisposer(new n.a(a));return b}p(c,a);b(c,[{key:"resize",value:function(a){var b;if(256>a){var c=b=new Uint8Array(a);for(var d=0;d<a;++d)c[d]=d;c=1}else if(65536>a){c=b=new Uint8Array(2*a);d=0;for(var e=2*a,g=0;g<e;g+=2)c[g]=d,c[g+1]=d>>8,++d;c=2}else if(16777216>a){c=
-b=new Uint8Array(3*a);d=3*a;for(g=e=0;g<d;g+=3)c[g]=e,c[g+1]=e>>8,c[g+2]=e>>16,++e;c=3}else throw Error("Length of index buffer must not exceed 2^24.");this.buffer.setData(b);this.numComponents=c;this.length=a}},{key:"ensure",value:function(a){(void 0===this.length||this.length<a)&&this.resize(a);return this}},{key:"bindToVertexAttrib",value:function(a){this.buffer.bindToVertexAttrib(a,this.numComponents,WebGL2RenderingContext.UNSIGNED_BYTE,!0)}},{key:"bind",value:function(a,b){b=void 0===b?0:b;a=
-a.attribute("aIndexRaw");0<=a&&(this.bindToVertexAttrib(a),0!==b&&this.gl.vertexAttribDivisor(a,b))}}]);return c}(h.a),e=function(){function a(b){q(this,a);this.name=b;this.attributeName="a"+this.name;this.getterName="get"+this.name}b(a,[{key:"defineShader",value:function(a){a.addAttribute("highp vec4",this.attributeName);a.addVertexCode("\nfloat "+this.getterName+" () {\n  vec4 temp = "+this.attributeName+";\n  return temp.x + temp.y * 256.0 + temp.z * 65536.0;\n}\n")}},{key:"bind",value:function(a,
-b){a.bindToVertexAttrib(b.attribute(this.attributeName),4,WebGL2RenderingContext.UNSIGNED_BYTE,!1)}},{key:"disable",value:function(a){a.gl.disableVertexAttribArray(a.attribute(this.attributeName))}}]);return a}()},function(h,f,a){function q(a){a.addOutputBuffer("vec4","v4f_fragColor",null);a.setFragmentMain("v4f_fragColor = getValue0();")}f.a=q;f.b=function(a,b,c){b=void 0===b?q:b;c=void 0===c?1:c;return a.memoize.get("elementWiseTextureShader:"+c+":"+Object(p.a)(b),function(){var d=new n.a(a);d.addVarying("vec2",
-"vTexCoord");d.addUniform("sampler2D","uSampler",c);d.addInitializer(function(b){for(var d=[],e=0;e<c;++e)d[e]=e;a.uniform1iv(b.uniform("uSampler"),d)});for(var g=0;g<c;++g)d.addFragmentCode("\nvec4 getValue"+g+"() {\n  return texture(uSampler["+g+"], vTexCoord);\n}\n");d.addUniform("mat4","uProjectionMatrix");d.require(b);d.addAttribute("vec4","aVertexPosition");d.addAttribute("vec2","aTexCoord");d.setVertexMain("vTexCoord = aTexCoord; gl_Position = uProjectionMatrix * aVertexPosition;");return d.build()})};
-f.c=function(a){return a.memoize.get("trivialColorShader",function(){var b=new n.a(a);b.addVarying("vec4","vColor");b.addOutputBuffer("vec4","v4f_fragColor",null);b.setFragmentMain("v4f_fragColor = vColor;");b.addAttribute("vec4","aVertexPosition");b.addAttribute("vec4","aColor");b.addUniform("mat4","uProjectionMatrix");b.setVertexMain("vColor = aColor; gl_Position = uProjectionMatrix * aVertexPosition;");return b.build()})};var p=a(23),n=a(25)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
-}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a){for(var b=
-0,c=0;3>c;++c)0>a[c]&&(b+=1<<c);return b}a.d(f,"a",function(){return m});h=a(1);var b=a(2),c=a(20),e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=b.s.create(),l=b.s.create(),k=new Float32Array([0,0,0,1,0,0,0,1,0,1,1,0,0,0,1,1,0,1,0,1,1,1,1,1]);f.b=k;var t=function(a){function b(a){q(this,b);var d=p(this,
-(b.__proto__||Object.getPrototypeOf(b)).call(this));d.outputVertexIndices=d.registerDisposer(c.a.fromData(a,new Float32Array([0,1,2,3,4,5]),a.ARRAY_BUFFER,a.STATIC_DRAW));a=[0,1,2,4,5,3,6,7];for(var e=[0,1,2,5,3,4,6,7],g=[0,1,1,4,4,7,4,7,1,5,0,1,1,4,4,7,0,2,2,5,5,7,5,7,2,6,0,2,2,5,5,7,0,3,3,6,6,7,6,7,3,4,0,3,3,6,6,7],k=[0,1,2,3,4,5,6,7,1,4,5,0,3,7,2,6,2,6,0,5,7,3,1,4,3,0,6,4,1,2,7,5,4,3,7,1,0,6,5,2,5,2,1,7,6,0,4,3,6,7,3,2,5,4,0,1,7,5,4,6,2,1,3,0],l=[],m=0;8>m;++m)for(var f=0;f<g.length;++f)l.push(a[k[8*
-e[m]+g[f]]]);d.vertexIndices=new Int32Array(l);return d}n(b,a);e(b,null,[{key:"get",value:function(a){return a.memoize.get("SliceViewShaderBuffers",function(){return new b(a)})}}]);return b}(h.a),m=function(a){function c(a){q(this,c);var b=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));b.data=b.registerDisposer(t.get(a));return b}n(c,a);e(c,null,[{key:"get",value:function(a){return a.memoize.get("BoundingBoxCrossSectionRenderHelper",function(){return new c(a)})}}]);e(c,[{key:"defineShader",
-value:function(a){a.addUniform("highp vec3","uPlaneNormal");a.addUniform("highp float","uPlaneDistance");a.addUniform("highp ivec2","uVertexIndex",24);a.addUniform("highp vec3","uVertexBasePosition",8);a.addInitializer(function(a){a.gl.uniform3fv(a.uniform("uVertexBasePosition"),k)});a.addVertexCode("\nvec3 getBoundingBoxPlaneIntersectionVertexPosition(vec3 chunkSize, vec3 boxLower, vec3 lowerClipBound, vec3 upperClipBound, int vertexIndex) {\n  for (int e = 0; e < 4; ++e) {\n    highp ivec2 vidx = uVertexIndex[vertexIndex*4 + e];\n    highp vec3 v1 = max(lowerClipBound, min(upperClipBound, chunkSize * uVertexBasePosition[vidx.x] + boxLower));\n    highp vec3 v2 = max(lowerClipBound, min(upperClipBound, chunkSize * uVertexBasePosition[vidx.y] + boxLower));\n    highp vec3 vDir = v2 - v1;\n    highp float denom = dot(vDir, uPlaneNormal);\n    if (abs(denom) > 0.001) {\n      highp float lambda = (uPlaneDistance - dot(v1, uPlaneNormal)) / denom;\n      if ((lambda >= -0.001) && (lambda <= (1.0 + 0.001))) {\n        lambda = clamp(lambda, 0.0, 1.0);\n        highp vec3 position = v1 + lambda * vDir;\n        return position;\n      }\n    }\n  }\n  return vec3(0, 0, 0);\n}\n")}},
-{key:"computeVertexPositionDebug",value:function(a,c,e,g,l,m,f){var h=d(l);h=this.data.vertexIndices.subarray(48*h,48*(h+1));for(var t=[0,0],r=[b.s.create(),b.s.create()],n=b.s.create(),u=b.s.create(),v=function(a){return k.subarray(3*a,3*a+3)},p=0;4>p;++p){for(var q=0;2>q;++q)t[q]=h[2*(4*f+p)+q],b.s.multiply(r[q],a,v(t[q])),b.s.add(r[q],r[q],m),b.s.min(r[q],r[q],e),b.s.max(r[q],r[q],c);b.s.subtract(n,r[1],r[0]);q=b.s.dot(n,l);if(.001<Math.abs(q)){var w=(g-b.s.dot(r[0],l))/q;if(-.001<=w&&1.001>=w)return w=
-Math.max(0,Math.min(1,w)),b.s.scaleAndAdd(u,r[0],n,w),u;console.log("vertex "+f+", e = "+p+", skipped, deom = "+q+", "+("vDir = "+Object(b.t)(n)+", ")+("uPlaneNormal = "+Object(b.t)(l)+", ")+("lambda="+w))}else console.log("vertex "+f+", e = "+p+", skipped, deom = "+q+", "+("vDir = "+Object(b.t)(n)+", uPlaneNormal = "+Object(b.t)(l)))}}},{key:"setPlane",value:function(a,b,c){var e=a.gl;e.uniform3fv(a.uniform("uPlaneNormal"),b);e.uniform1f(a.uniform("uPlaneDistance"),c);b=d(b);e.uniform2iv(a.uniform("uVertexIndex"),
-this.data.vertexIndices.subarray(48*b,48*(b+1)))}},{key:"setViewportPlane",value:function(a,c,d,e){c=Object(b.p)(g,c,e);d=b.s.dot(b.s.transformMat4(l,d,e),c);this.setPlane(a,c,d)}}]);return c}(h.a)},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,
-b):a.__proto__=b)}a.d(f,"a",function(){return b});h=a(1);var p=a(101),n=a(52),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();f.b=p.b;var b=function(a){function b(a,c){c=void 0===c?1:c;if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var d=(b.__proto__||Object.getPrototypeOf(b)).call(this);
-if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");d=!d||"object"!==typeof d&&"function"!==typeof d?this:d;d.linesPerInstance=c;d.lineOffsetsBuffer=Object(n.a)(a,0,-1,1,1,c,1);d.quadHelper=d.registerDisposer(new p.a(a,c));return d}q(b,a);d(b,[{key:"defineShader",value:function(a){a.addAttribute("highp vec2","aLineOffset");a.addUniform("highp vec3","uLineParams");a.addVarying("highp float","vLineCoord");a.addVertexCode("\nvoid emitLine(mat4 projection, vec3 vertexA, vec3 vertexB) {\n  vec3 vertexPosition = mix(vertexA, vertexB, aLineOffset.x);\n  vec3 otherVertexPosition = mix(vertexB, vertexA, aLineOffset.x);\n\n  vec4 vertexPositionClip = projection * vec4(vertexPosition, 1.0);\n  vec4 otherVertexPositionClip = projection * vec4(otherVertexPosition, 1.0);\n\n  vec3 vertexPositionDevice = vertexPositionClip.xyz / vertexPositionClip.w;\n  vec3 otherVertexPositionDevice = otherVertexPositionClip.xyz / otherVertexPositionClip.w;\n\n  vec2 lineDirection = normalize(otherVertexPositionDevice.xy - vertexPositionDevice.xy);\n  vec2 lineNormal = vec2(lineDirection.y, -lineDirection.x);\n\n  gl_Position = vertexPositionClip;\n  gl_Position.xy += aLineOffset.y * (2.0 * aLineOffset.x - 1.0) * lineNormal * uLineParams.xy * 0.5 * gl_Position.w;\n  vLineCoord = aLineOffset.y;\n}\n");
-a.addFragmentCode("\nfloat getLineAlpha() {\n  return clamp((1.0 - abs(vLineCoord)) / uLineParams.z, 0.0, 1.0);\n}\n")}},{key:"draw",value:function(a,b,c,d,e){var g=a.attribute("aLineOffset");this.lineOffsetsBuffer.bindToVertexAttrib(g,2);c+=d;var k=a.gl;k.uniform3f(a.uniform("uLineParams"),2*c/b.viewportWidth,2*c/b.viewportHeight,d/c);this.quadHelper.draw(k,e);k.disableVertexAttribArray(g)}}]);return b}(h.a)},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return b});h=a(1);var p=a(20),n=a(141),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),b=function(a){function b(a){if(!(this instanceof
-b))throw new TypeError("Cannot call a class as a function");var c=(b.__proto__||Object.getPrototypeOf(b)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");c=!c||"object"!==typeof c&&"function"!==typeof c?this:c;c.gl=a;c.vertexBuffer=c.registerDisposer(p.a.fromData(a,new Float32Array([0,0,0,1,1,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,1,1]),a.ARRAY_BUFFER,a.STATIC_DRAW));c.colorBuffer=c.registerDisposer(p.a.fromData(a,new Float32Array([1,0,0,.5,1,0,
-0,.5,0,1,0,.5,0,1,0,.5,0,0,1,.5,0,0,1,.5]),a.ARRAY_BUFFER,a.STATIC_DRAW));c.trivialColorShader=c.registerDisposer(Object(n.c)(a));return c}q(b,a);d(b,[{key:"draw",value:function(a,b){b=void 0===b?!0:b;var c=this.trivialColorShader,d=this.gl;c.bind();d.uniformMatrix4fv(c.uniform("uProjectionMatrix"),!1,a);a=c.attribute("aVertexPosition");this.vertexBuffer.bindToVertexAttrib(a,4);c=c.attribute("aColor");this.colorBuffer.bindToVertexAttrib(c,4);b&&(d.colorMask(!1,!1,!1,!0),d.clearColor(0,0,0,0),d.clear(d.COLOR_BUFFER_BIT),
-d.colorMask(!0,!0,!0,!0),d.enable(d.BLEND),d.blendFunc(d.ONE_MINUS_DST_ALPHA,d.DST_ALPHA));d.lineWidth(1);d.drawArrays(d.LINES,0,6);b&&d.disable(d.BLEND);d.disableVertexAttribArray(a);d.disableVertexAttribArray(c)}}],[{key:"get",value:function(a){return a.memoize.get("SliceViewPanel:AxesLineHelper",function(){return new b(a)})}}]);return b}(h.a)},function(h,f,a){a.d(f,"a",function(){return p});var q=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=
-!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}(),p=function(){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.renderLayers=[null];this.pickData=[null];this.values=[0,0,0];this.nextPickID=1}q(a,[{key:"clear",value:function(){this.renderLayers.length=1;this.pickData.length=1;this.values.length=3;this.nextPickID=1}},{key:"registerUint64",value:function(a,b,c){return this.register(a,
-void 0===c?1:c,b.low,b.high)}},{key:"register",value:function(a,b,c,e,g){var d=this.renderLayers,k=this.values,f=this.nextPickID;this.nextPickID+=void 0===b?1:b;b=d.length;d[b]=a;a=3*b;k[a]=f;k[a+1]=void 0===c?0:c;k[a+2]=void 0===e?0:e;this.pickData[b]=void 0===g?null:g;return f}},{key:"setMouseState",value:function(a,b){for(var c=this.renderLayers,d=this.values,g=0,l=c.length-1;g<l;){var k=Math.ceil(g+(l-g)/2);d[3*k]>b?l=k-1:g=k}c=a.pickedRenderLayer=c[g];l=3*g;b=a.pickedOffset=b-d[l];k=a.pickedValue;
-k.low=d[l+1];k.high=d[l+2];a.pickedAnnotationId=void 0;a.pickedAnnotationLayer=void 0;null!==c&&c.updateMouseState(a,k,b,this.pickData[g])}}]);return a}()},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&
-b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return r});var n=a(102);h=a(147);var d=a(79),b=a(22),c=a(2),e=a(61),g=a(148),l=a(258),k=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),t=
-function v(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return v(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a(259);a(45);var m=c.s.create(),r=function(a){function f(a,k,h){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var t=q(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,a,k,h.visibility));t.viewer=h;t.mouseX=0;t.mouseY=
-0;t.mouseStateUpdater=t.updateMouseState.bind(t);t.inputEventMap=h.inputEventMap;k.classList.add("neuroglancer-rendered-data-panel");k.classList.add("neuroglancer-panel");k.classList.add("neuroglancer-noselect");t.registerDisposer(new d.a(k));t.registerDisposer(new e.b(k,t.inputEventMap));t.registerDisposer(new g.a(k,t.inputEventMap));t.registerEventListener(k,"mousemove",t.onMousemove.bind(t));t.registerEventListener(k,"mouseleave",t.onMouseout.bind(t));Object(b.c)(k,"snap",function(){t.navigationState.pose.snap()});
-Object(b.c)(k,"zoom-in",function(){t.navigationState.zoomBy(.5)});Object(b.c)(k,"zoom-out",function(){t.navigationState.zoomBy(2)});Object(b.c)(k,"highlight",function(){t.viewer.layerManager.invokeAction("highlight")});for(a={axis:0};3>a.axis;a={axis:a.axis},++a.axis){h=c.a[a.axis];for(var r={},p=$jscomp.makeIterator([-1,1]),v=p.next();!v.done;r={sign:r.sign,tempOffset:r.tempOffset},v=p.next())r.sign=v.value,v=0>r.sign?"-":"+",Object(b.c)(k,"rotate-relative-"+h+v,function(a,b){return function(){t.navigationState.pose.rotateRelative(c.e[a.axis],
-.1*b.sign)}}(a,r)),r.tempOffset=c.s.create(),Object(b.c)(k,""+h+v,function(a,b){return function(){var c=t.navigationState,d=a.tempOffset;d[0]=0;d[1]=0;d[2]=0;d[b.axis]=a.sign;c.pose.translateVoxelsRelative(d)}}(r,a))}Object(b.c)(k,"zoom-via-wheel",function(a){a=a.detail;t.onMousemove(a);t.zoomByMouse(Object(l.a)(a))});a={};h=$jscomp.makeIterator([1,10]);for(r=h.next();!r.done;a={amount:a.amount},r=h.next())a.amount=r.value,Object(b.c)(k,"z+"+a.amount+"-via-wheel",function(a){return function(b){var c=
-b.detail;b=t.navigationState;c=0!==c.deltaY?c.deltaY:c.deltaX;m[0]=0;m[1]=0;m[2]=(0<c?-1:1)*a.amount;b.pose.translateVoxelsRelative(m)}}(a));Object(b.c)(k,"move-to-mouse-position",function(){var a=t.viewer.mouseState;if(a.updateUnconditionally()){var b=t.navigationState.pose.position;c.s.copy(b.spatialCoordinates,a.position);b.changed.dispatch()}});Object(b.c)(k,"snap",function(){return t.navigationState.pose.snap()});Object(b.c)(k,"select-annotation",function(){var a=t.viewer;a=Object(n.a)(a.mouseState,
-a.layerManager);if(void 0!==a){var b=a.layer.layer;null!==b&&(t.viewer.selectedLayer.layer=a.layer,t.viewer.selectedLayer.visible=!0,b.tabs.value="annotations",b.selectedAnnotation.value={id:a.id,partIndex:a.partIndex})}});return t}p(f,a);k(f,[{key:"onMouseout",value:function(a){a=this.viewer.mouseState;a.updater=void 0;a.setActive(!1)}},{key:"onMousemove",value:function(a){var b=this.element;a.target===b&&(this.mouseX=a.offsetX-b.clientLeft,this.mouseY=a.offsetY-b.clientTop,b=this.viewer.mouseState,
-b.pageX=a.pageX,b.pageY=a.pageY,b.updater=this.mouseStateUpdater,b.triggerUpdate())}},{key:"disposed",value:function(){var a=this.viewer.mouseState;a.updater===this.mouseStateUpdater&&(a.updater=void 0,a.setActive(!1));t(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}}]);return f}(h.b)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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)}a.d(f,"b",function(){return l});a.d(f,"a",function(){return k});h=a(10);var d=a.n(h);h=a(1);var b=a(7),c=a(255),e=function(){function a(a,
-b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=function m(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return m(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},l=function(a){function b(a,c,d){q(this,
-b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.context=a;e.element=c;e.visibility=d;e.gl=a.gl;a.addPanel(e);return e}n(b,a);e(b,[{key:"scheduleRedraw",value:function(){this.visible&&this.context.scheduleRedraw()}},{key:"setGLViewport",value:function(){var a=this.element,b=a.getBoundingClientRect(),c=this.context.canvasRect,d=c.width/this.context.canvas.width*(a.clientLeft+b.left-c.left),e=a.clientWidth,g=a.clientHeight;b=c.height/this.context.canvas.height*(b.top-c.top+a.clientTop)+
-g;a=this.gl;a.enable(a.SCISSOR_TEST);b=this.context.canvas.height-b;a.viewport(d,b,e,g);a.scissor(d,b,e,g)}},{key:"disposed",value:function(){this.context.removePanel(this);g(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"visible",get:function(){return this.visibility.visible}}]);return b}(h.a),k=function(a){function g(a){q(this,g);var e=p(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));e.container=a;e.canvas=document.createElement("canvas");
-e.updateStarted=new b.a;e.updateFinished=new b.a;e.panels=new Set;e.updatePending=null;e.onResize=e.registerCancellable(d()(function(){e.scheduleRedraw();for(var a=$jscomp.makeIterator(e.panels),b=a.next();!b.done;b=a.next())b.value.onResize()},0));var k=e.canvas;a.style.position="relative";k.style.position="absolute";k.style.top="0px";k.style.left="0px";k.style.width="100%";k.style.height="100%";k.style.zIndex="0";a.appendChild(k);e.gl=Object(c.a)(k);e.registerEventListener(window,"resize",e.onResize.bind(e));
-return e}n(g,a);e(g,[{key:"isReady",value:function(){for(var a=$jscomp.makeIterator(this.panels),b=a.next();!b.done;b=a.next())if(b=b.value,b.visible&&!b.isReady())return!1;return!0}},{key:"makeCanvasOverlayElement",value:function(){var a=document.createElement("div");a.style.position="absolute";a.style.top="0px";a.style.left="0px";a.style.width="100%";a.style.height="100%";a.style.zIndex="2";this.container.appendChild(a);return a}},{key:"disposed",value:function(){null!=this.updatePending&&(cancelAnimationFrame(this.updatePending),
-this.updatePending=null)}},{key:"addPanel",value:function(a){this.panels.add(a)}},{key:"removePanel",value:function(a){this.panels.delete(a);a.dispose()}},{key:"scheduleRedraw",value:function(){null===this.updatePending&&(this.updatePending=requestAnimationFrame(this.update.bind(this)))}},{key:"draw",value:function(){this.updateStarted.dispatch();var a=this.gl,b=this.canvas;b.width=b.offsetWidth;b.height=b.offsetHeight;this.canvasRect=b.getBoundingClientRect();this.gl.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT|
-a.DEPTH_BUFFER_BIT);b=$jscomp.makeIterator(this.panels);for(var c=b.next();!c.done;c=b.next()){c=c.value;var d=c.element;c.visible&&0!==d.clientWidth&&0!==d.clientHeight&&0!==d.offsetWidth&&0!==d.offsetHeight&&(c.setGLViewport(),c.draw())}a.disable(a.SCISSOR_TEST);this.gl.clearColor(1,1,1,1);this.gl.colorMask(!1,!1,!1,!0);a.clear(a.COLOR_BUFFER_BIT);this.gl.colorMask(!0,!0,!0,!0);this.updateFinished.dispatch()}},{key:"update",value:function(){this.updatePending=null;this.draw()}}]);return g}(h.a)},
-function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,
-"a",function(){return b});h=a(1);var n=a(22),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),b=function(a){function b(a,c){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var d=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.target=a;d.eventMap=c;d.registerEventListener(a,
-"wheel",function(a){d.dispatch("wheel",a)});d.registerEventListener(a,"click",function(a){d.dispatch("click"+a.button,a)});d.registerEventListener(a,"dblclick",function(a){d.dispatch("dblclick"+a.button,a)});d.registerEventListener(a,"mousedown",function(a){d.dispatch("mousedown"+a.button,a)});d.registerEventListener(a,"mouseup",function(a){d.dispatch("mouseup"+a.button,a)});return d}p(b,a);d(b,[{key:"dispatch",value:function(a,b){Object(n.b)(a,b,this.eventMap)}}]);return b}(h.a)},function(h,f,a){f.a=
-function(a,f,h,d){f*=6;var b=Math.floor(f),c=f-b;f=d*(1-h);var e=d*(1-h*c);h=d*(1-h*(1-c));switch(b%6){case 0:a[0]=d;a[1]=h;a[2]=f;break;case 1:a[0]=e;a[1]=d;a[2]=f;break;case 2:a[0]=f;a[1]=d;a[2]=h;break;case 3:a[0]=f;a[1]=e;a[2]=d;break;case 4:a[0]=h;a[1]=f;a[2]=d;break;case 5:a[0]=d,a[1]=f,a[2]=e}return a};f.b=function(a,f,h,d){var b=Math.max(Math.max(f,h),d),c=Math.min(Math.min(f,h),d);a[2]=b;c===b?(a[0]=0,a[1]=0):(c=b-c,a[1]=c/b,a[0]=f===b?(h-d)/c:h===b?2+(d-f)/c:4+(f-h)/c,a[0]/=6,0>a[0]&&(a[0]+=
-1),1<a[0]&&--a[0]);return a}},function(h,f,a){h=new (a(151).a);f.a=h},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a){var c,d,e;return function(g,k){if(void 0!==d&&(void 0===c||void 0===g||c.generation!==g.generation))return void 0===c&&e.addConsumer(k),d;c=void 0;e=new b.c;return d=a(g,e).then(function(a){c=a;e=void 0;return a},function(a){e.isCanceled&&(d=e=void 0);throw a;})}}a.d(f,"b",function(){return g});f.c=function(a){var b=0;return d(function(c,
-d){return a(d).then(function(a){return{generation:++b,credentials:a}})})};a.d(f,"a",function(){return k});var b=a(32);h=a(1);var c=a(98),e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);
-return b}(h.a),l=function(){function a(){q(this,a);this.providers=new Map}e(a,[{key:"register",value:function(a,b){this.providers.set(a,b)}},{key:"getCredentialsProvider",value:function(a,b){var c=this.providers.get(a);if(void 0===c)throw Error("No registered credentials provider: "+JSON.stringify(a));return c(b)}}]);return a}(),k=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,new l))}n(b,a);e(b,[{key:"register",value:function(a,b){this.base.register(a,
-b)}}]);return b}(function(a){function b(a){q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.base=a;d.memoize=new c.b;return d}n(b,a);e(b,[{key:"getCredentialsProvider",value:function(a,b){var c=this;return this.memoize.get({key:a,parameters:b},function(){return c.registerDisposer(c.base.getCredentialsProvider(a,b).addRef())})}}]);return b}(h.a))},function(h,f,a){a.d(f,"c",function(){return q});f.a="/ocp/ca";f.b="/nd/sd";var q=function n(){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");
-};q.RPC_ID="ndstore/VolumeChunkSource"},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,
-b):a.__proto__=b)}function n(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function d(a,b,c){Object(E.t)(a);var d=Object(E.v)(a,"Base",function(a){return new B(a)});switch(d.typeName){case "uint8blk":case "grayscale8":var e=-1!==d.compressionName.indexOf("jpeg");return new M(a,b,d,e?r.c.JPEG:r.c.RAW,c);case "labels64":case "labelblk":return new M(a,b,d,r.c.COMPRESSED_SEGMENTATION,c);case "labelarray":case "labelmap":return new M(a,b,d,r.c.COMPRESSED_SEGMENTATIONARRAY,
-c);default:throw Error("DVID data type "+JSON.stringify(d.typeName)+" is not supported.");}}function b(a){try{for(var b=Object(E.u)(a,function(a){return new P(a)}),c=new Map,d=$jscomp.makeIterator(b),e=d.next();!e.done;e=d.next()){var g=$jscomp.makeIterator(e.value),k=g.next().value,l=g.next().value;c.set(k,l);for(var f=$jscomp.makeIterator(l.vnodes),m=f.next();!m.done;m=f.next()){var h=m.value;if(h!==k){var t=new P(l);c.set(h,t)}}}for(var r=$jscomp.makeIterator(c),n=r.next();!n.done;n=r.next()){var u=
-$jscomp.makeIterator(n.value),p=u.next().value;u.next().value.uuid=p}return c}catch(wa){throw Error("Failed to parse DVID repositories info: "+wa.message);}}function c(a,b){return a.memoize.getUncounted({type:"dvid:getServerInfo",baseUrls:b},function(){var a=Object(D.d)(Object(D.b)(b,"/api/repos/info","GET"),"json").then(function(a){return new N(a)}),c="repository info for DVID server "+b[0];x.a.forPromise(a,{initialMessage:"Retrieving "+c+".",delay:!0,errorPrefix:"Error retrieving "+c+": "});return a})}
-function e(a,b,c,d){return a.memoize.getUncounted({type:"dvid:getInstanceDetails",baseUrls:b,nodeKey:c,name:d.name},function(){var a=Object(D.d)(Object(D.b)(b,"/api/node/"+c+"/"+d.name+"/info","GET"),"json"),e="datainstance info for node "+c+" and instance "+d.name+" "+("on DVID server "+b[0]);x.a.forPromise(a,{initialMessage:"Retrieving "+e+".",delay:!0,errorPrefix:"Error retrieving "+e+": "});return a.then(function(a){a=Object(E.v)(a,"Extended",E.t);d.lowerVoxelBound=Object(E.v)(a,"MinPoint",function(a){return Object(E.d)(z.s.create(),
-a)});d.upperVoxelBound=Object(E.v)(a,"MaxPoint",function(a){return Object(E.d)(z.s.create(),a)});return d})})}function g(a,b,d,g){return c(a,b).then(function(c){c=c.getNode(d);if(void 0===c)throw Error("Invalid node: "+JSON.stringify(d)+".");c=c.dataInstances.get(g);if(!(c instanceof M))throw Error("Invalid data instance "+g+".");return e(a,b,d,c)}).then(function(c){return a.memoize.getUncounted({type:"dvid:MultiscaleVolumeChunkSource",baseUrls:b,nodeKey:d,dataInstanceKey:g},function(){return new S(a,
-b,d,g,c)})})}function l(a,b){var c=b.match(U);if(null===c)throw Error("Invalid DVID URL: "+JSON.stringify(b)+".");return g(a,[c[1]],c[2],c[3])}function k(a,b){return{offset:0,completions:Object(A.c)(b,a.dataInstances.values(),function(a){return a.name},function(a){return""+a.base.typeName})}}function t(a,b){var c=b.match(/^(?:([^\/]+)(?:\/([^\/]*))?)?$/);if(null===c)throw Error("Invalid DVID URL syntax.");if(void 0===c[2])return{offset:0,completions:Object(A.c)(b,a.repositories.values(),function(a){return a.uuid+
-"/"},function(a){return a.alias+": "+a.description})};b=c[1];a=a.getNode(b);return Object(A.a)(b.length+1,k(a,c[2]))}function m(a,b){a=a.match(/^((?:http|https):\/\/[^\/]+)\/(.*)$/);if(null===a)return Promise.reject(null);var d=a[1],e=a[2];return c(b,[d]).then(function(a){return Object(A.a)(d.length+1,t(a,e))})}Object.defineProperty(f,"__esModule",{value:!0});a.d(f,"getVolume",function(){return l});a.d(f,"volumeCompleter",function(){return m});a.d(f,"DataInstanceBaseInfo",function(){return B});a.d(f,
-"DataInstanceInfo",function(){return F});a.d(f,"VolumeDataInstanceInfo",function(){return M});f.parseDataInstance=d;a.d(f,"RepositoryInfo",function(){return P});f.parseRepositoriesInfo=b;a.d(f,"ServerInfo",function(){return N});f.getServerInfo=c;f.getDataInstanceDetails=e;a.d(f,"MultiscaleVolumeChunkSource",function(){return S});f.getShardedVolume=g;f.completeInstanceName=k;f.completeNodeAndInstance=t;a.d(f,"DVIDDataSource",function(){return Z});h=a(24);f=a(46);var r=a(272),u=a(54),v=a(104),w=a(26),
-y=a(33),x=a(31),A=a(62),z=a(2),D=a(63),E=a(4),G=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),C=new Map;C.set("uint8",w.a.UINT8);C.set("uint32",w.a.UINT32);C.set("uint64",w.a.UINT64);var B=function(){function a(b){n(this,a);this.obj=b;Object(E.t)(b);Object(E.v)(b,"TypeName",E.A)}G(a,[{key:"typeName",get:function(){return this.obj.TypeName}},
-{key:"compressionName",get:function(){return this.obj.Compression}}]);return a}(),F=function Q(a,b,c){n(this,Q);this.obj=a;this.name=b;this.base=c},L=function(a){function b(){n(this,b);return q(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}p(b,a);return b}(Object(h.f)(y.b,r.d)),J=function(a){function b(){n(this,b);return q(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}p(b,a);return b}(Object(h.f)(v.d,r.b)),O=function(a){function b(){n(this,b);return q(this,
-(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}p(b,a);return b}(Object(h.f)(u.c,r.a)),M=function(a){function b(a,c,d,e,g){n(this,b);d=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c,d));d.encoding=e;a=Object(E.v)(a,"Extended",E.t);var k=Object(E.v)(a,"Values",function(a){return Object(E.a)(a,E.t)});if(1>k.length)throw Error("Expected Extended.Values property to have length >= 1, but received: ${JSON.stringify(extendedValues)}.");d.numLevels=1;g=new Set(g);if(e===r.c.COMPRESSED_SEGMENTATIONARRAY)e=
-Object(E.v)(a,"MaxDownresLevel",E.z),d.numLevels=e+1;else for(;g.has(c+"_"+d.numLevels.toString());)d.numLevels+=1;d.meshSrc="";g.has(c+"_meshes")&&(d.meshSrc=c+"_meshes");d.skeletonSrc="";""!==d.meshSrc&&g.has(c+"_skeletons")&&(d.skeletonSrc=c+"_skeletons");d.dataType=Object(E.v)(k[0],"DataType",function(a){return Object(E.s)(a,C)});d.voxelSize=Object(E.v)(a,"VoxelSize",function(a){return Object(E.c)(z.s.create(),a,E.o)});d.numChannels=1;return d}p(b,a);G(b,[{key:"getSources",value:function(a,b,
-c){for(var d=this.encoding,e=[],g={},k=0;k<this.numLevels;g={volParameters:g.volParameters},++k){for(var l=z.s.scale(z.s.create(),this.voxelSize,Math.pow(2,k)),f=z.s.create(),m=z.s.create(),h=0;3>h;++h){var t=Math.floor(this.voxelSize[h]/l[h]*this.lowerVoxelBound[h]);f[h]=t-t%64;t=Math.ceil(this.voxelSize[h]/l[h]*(this.upperVoxelBound[h]+1));m[h]=t;0!==t%64&&(m[h]+=64-t%64)}h=b.dataInstanceKey;d!==r.c.COMPRESSED_SEGMENTATIONARRAY&&0<k&&(h+="_"+k.toString());g.volParameters={baseUrls:b.baseUrls,nodeKey:b.nodeKey,
-dataInstanceKey:h,dataScale:k.toString(),encoding:d};l=w.b.getDefaults({voxelSize:l,dataType:this.dataType,numChannels:this.numChannels,transform:z.k.fromTranslation(z.k.create(),z.s.multiply(z.s.create(),f,l)),baseVoxelOffset:f,upperVoxelBound:z.s.subtract(z.s.create(),m,f),volumeType:this.volumeType,volumeSourceOptions:c,compressedSegmentationBlockSize:d===r.c.COMPRESSED_SEGMENTATION||d===r.c.COMPRESSED_SEGMENTATIONARRAY?z.s.fromValues(8,8,8):void 0}).map(function(b){return function(c){return a.getChunkSource(L,
-{spec:c,parameters:b.volParameters})}}(g));e.push(l)}return e}},{key:"getMeshSource",value:function(a,b){return""!==this.meshSrc?a.getChunkSource(O,{parameters:{baseUrls:b.baseUrls,nodeKey:b.nodeKey,dataInstanceKey:this.meshSrc}}):null}},{key:"getSkeletonSource",value:function(a,b){return""!==this.skeletonSrc?a.getChunkSource(J,{parameters:{baseUrls:b.baseUrls,nodeKey:b.nodeKey,dataInstanceKey:this.skeletonSrc}}):null}},{key:"volumeType",get:function(){return this.encoding===r.c.COMPRESSED_SEGMENTATION||
-this.encoding===r.c.COMPRESSED_SEGMENTATIONARRAY?w.c.SEGMENTATION:w.c.IMAGE}}]);return b}(F),P=function aa(a){n(this,aa);this.errors=[];this.dataInstances=new Map;this.vnodes=new Set;if(a instanceof aa)this.alias=a.alias,this.description=a.description,this.errors=a.errors,this.dataInstances=a.dataInstances;else{Object(E.t)(a);this.alias=Object(E.v)(a,"Alias",E.A);this.description=Object(E.v)(a,"Description",E.A);for(var b=Object(E.v)(a,"DataInstances",E.t),c=Object.keys(b),e=$jscomp.makeIterator(c),
-g=e.next();!g.done;g=e.next()){g=g.value;try{this.dataInstances.set(g,d(b[g],g,c))}catch(Ka){g="Failed to parse data instance "+JSON.stringify(g)+": "+Ka.message,console.log(g),this.errors.push(g)}}a=Object(E.v)(a,"DAG",E.t);a=Object(E.v)(a,"Nodes",E.t);a=$jscomp.makeIterator(Object.keys(a));for(g=a.next();!g.done;g=a.next())this.vnodes.add(g.value)}},N=function(){function a(c){n(this,a);this.repositories=b(c)}G(a,[{key:"getNode",value:function(a){for(var b=[],c=$jscomp.makeIterator(this.repositories.keys()),
-d=c.next();!d.done;d=c.next())d=d.value,d.startsWith(a)&&b.push(d);if(1!==b.length)throw Error("Node key "+JSON.stringify(a)+" matches "+JSON.stringify(b)+" nodes.");return this.repositories.get(b[0])}}]);return a}(),S=function(){function a(b,c,d,e,g){n(this,a);this.chunkManager=b;this.baseUrls=c;this.nodeKey=d;this.dataInstanceKey=e;this.info=g}G(a,[{key:"getSources",value:function(a){return this.info.getSources(this.chunkManager,{baseUrls:this.baseUrls,nodeKey:this.nodeKey,dataInstanceKey:this.dataInstanceKey},
-a)}},{key:"getMeshSource",value:function(){var a=this.info.getMeshSource(this.chunkManager,{baseUrls:this.baseUrls,nodeKey:this.nodeKey,dataInstanceKey:this.dataInstanceKey});return null===a?this.info.getSkeletonSource(this.chunkManager,{baseUrls:this.baseUrls,nodeKey:this.nodeKey,dataInstanceKey:this.dataInstanceKey}):a}},{key:"dataType",get:function(){return this.info.dataType}},{key:"numChannels",get:function(){return this.info.numChannels}},{key:"volumeType",get:function(){return this.info.volumeType}}]);
-return a}(),U=/^((?:http|https):\/\/[^\/]+)\/([^\/]+)\/([^\/]+)$/,Z=function(a){function b(){n(this,b);return q(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}p(b,a);G(b,[{key:"getVolume",value:function(a,b){return l(a,b)}},{key:"volumeCompleter",value:function(a,b){return m(a,b)}},{key:"description",get:function(){return"DVID"}}]);return b}(f.a)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a){var d=Object(F.a)(a,F.t);if(1>d.length)throw Error("No stacks found for owner object.");a=new Map;var k=Object(F.v)(d[0],
-"stackId",c);d=$jscomp.makeIterator(d);for(var f=d.next();!f.done;f=d.next()){var m=f.value;f=Object(F.v)(m,"stackId",b);a:{var h=m;Object(F.t)(h);var t=Object(F.v)(h,"state",F.A);m=[];var r=C.s.create(),n=C.s.create();if(P.has(t)){r=t=Object(F.v)(h,"stats",F.t);Object(F.t)(r);r=Object(F.v)(r,"stackBounds",F.t);n=C.s.create();n[0]=Object(F.v)(r,"minX",F.p);n[1]=Object(F.v)(r,"minY",F.p);n[2]=Object(F.v)(r,"minZ",F.p);r=n;n=t;Object(F.t)(n);n=Object(F.v)(n,"stackBounds",F.t);var u=C.s.create();u[0]=
-Object(F.v)(n,"maxX",F.p)+1;u[1]=Object(F.v)(n,"maxY",F.p)+1;u[2]=Object(F.v)(n,"maxZ",F.p)+1;n=u;t.hasOwnProperty("channelNames")&&(m=e(t))}else if(!N.has(t)){m=void 0;break a}t=Object(F.v)(h,"currentVersion",g);h=Object(F.v)(h,"stackId",l);m={lowerVoxelBound:r,upperVoxelBound:n,voxelResolution:t,project:h,channels:m}}void 0!==m&&(h=m.project,r=a.get(h),void 0===r&&(r=new Map,a.set(h,{stacks:r}),r=a.get(h)),r.stacks.set(f,m))}return{owner:k,projects:a}}function b(a){Object(F.t)(a);return Object(F.v)(a,
-"stack",F.A)}function c(a){Object(F.t)(a);return Object(F.v)(a,"owner",F.A)}function e(a){Object(F.t)(a);return Object(F.v)(a,"channelNames",function(a){return Object(F.a)(a,F.A)})}function g(a){Object(F.t)(a);var b=C.s.create();try{b[0]=Object(F.v)(a,"stackResolutionX",F.p),b[1]=Object(F.v)(a,"stackResolutionY",F.p),b[2]=Object(F.v)(a,"stackResolutionZ",F.p)}catch(ka){b[0]=1,b[1]=1,b[2]=1}return b}function l(a){Object(F.t)(a);return Object(F.v)(a,"project",F.A)}function k(a,b){for(var c=0,d=0;2>
-d;d++)c<a.upperVoxelBound[d]&&(c=a.upperVoxelBound[d]);if(b>=c)return 1;for(a=0;c>b;)c/=2,a++;return a}function t(a,b,c){return a.memoize.getUncounted({type:"render:getOwnerInfo",hostnames:b,owner:c},function(){return Object(B.d)(Object(B.b)(b,"/render-ws/v1/owner/"+c+"/stacks"),"json").then(d)})}function m(a,b,c){var d=c.match(U);if(null===d)throw Error("Invalid volume path "+JSON.stringify(c));var e=d[1],g=d[2],k=d[3],l=d[4],f=Object(F.e)(d[5]||"");return a.memoize.getUncounted({type:"render:MultiscaleVolumeChunkSource",
-hostnames:b,path:c},function(){return t(a,b,e).then(function(c){return new S(a,b,c,k,g,l,f)})})}function r(a,b){var c=b.match(Z);if(null===c)throw Error("Invalid render volume path: "+JSON.stringify(b));b=c[1].split(",");return m(a,b,c[2])}function u(a,b,c){var d=c.match(/^(?:([^\/]+)(?:\/([^\/]*))?(?:\/([^\/]*))?(\/.*?)?)?$/);if(null===d||void 0===d[2])return Promise.reject(null);if(void 0===d[3]){var e=d[2]||"";return t(a,b,d[1]).then(function(a){a=Object(G.c)(e,a.projects,function(a){return a[0]+
-"/"},function(){});return{offset:d[1].length+1,completions:a}})}if(void 0===d[4]){var g=d[3]||"";return t(a,b,d[1]).then(function(a){a=a.projects.get(d[2]);if(void 0===a)return Promise.reject(null);a=Object(G.c)(g,a.stacks,function(a){return a[0]+"/"},function(a){return"("+a[1].project+")"});return{offset:d[1].length+d[2].length+2,completions:a}})}var k=d[4].substr(1)||"";return t(a,b,d[1]).then(function(a){a=a.projects.get(d[2]);if(void 0===a)return Promise.reject(null);a=a.stacks.get(d[3]);if(void 0===
-a)return Promise.reject(null);a=a.channels;if(0===a.length)return Promise.reject(null);a=Object(G.c)(k,a,function(a){return a},function(){});return{offset:d[1].length+d[2].length+d[3].length+3,completions:a}})}function v(a,b){var c=a.match(Z);if(null===c)return Promise.reject(null);a=c[1].split(",");return u(b,a,c[2]).then(function(a){return Object(G.a)(c[1].length+1,a)})}function w(a,b){var c=b.match(Z);if(null===c)throw Error("Invalid render point path: "+JSON.stringify(b));return y(a,[c[1]],c[2])}
-function y(a,b,c){var d=c.match(U);if(null===d)throw Error("Invalid point path "+JSON.stringify(c));var e=d[1],g=d[2],k=d[3],l=Object(F.e)(d[4]||"");return a.memoize.getUncounted({type:"render:MultiscaleVectorGraphicsChunkSource",hostnames:b,path:c},function(){return t(a,b,e).then(function(c){return new H(a,b,c,k,g,l)})})}Object.defineProperty(f,"__esModule",{value:!0});a.d(f,"getVolume",function(){return r});a.d(f,"volumeCompleter",function(){return v});a.d(f,"MultiscaleVolumeChunkSource",function(){return S});
-f.computeStackHierarchy=k;f.getOwnerInfo=t;f.getShardedVolume=m;f.stackAndProjectCompleter=u;a.d(f,"MultiscaleVectorGraphicsChunkSource",function(){return H});f.getPointMatches=w;f.getShardedPointMatches=y;a.d(f,"RenderDataSource",function(){return Q});h=a(24);f=a(46);var x=a(274),A=a(155),z=a(156),D=a(26),E=a(33),G=a(62),C=a(2),B=a(63),F=a(4),L=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,
-d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),J=new Set(["jpg"]),O=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);return b}(Object(h.f)(E.b,x.b)),M=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);return b}(Object(h.f)(z.b,x.a)),P=new Set(["COMPLETE","READ_ONLY"]),N=new Set(["LOADING"]),S=function(){function a(b,c,d,e,g,k,l){q(this,
-a);this.chunkManager=b;this.baseUrls=c;this.ownerInfo=d;this.project=g;this.parameters=l;b=d.projects.get(g);if(void 0===b)throw Error("Specified project "+JSON.stringify(g)+" does not exist for "+("specified owner "+JSON.stringify(d.owner)));if(void 0===e){e=Array.from(b.stacks.keys());if(1!==e.length)throw Error("Dataset contains multiple stacks: "+JSON.stringify(e));e=e[0]}d=b.stacks.get(e);if(void 0===d)throw Error("Specified stack "+JSON.stringify(e)+" is not one of the supported stacks: "+JSON.stringify(Array.from(b.stacks.keys())));
-this.stack=e;this.stackInfo=d;void 0!==k&&0<k.length&&(this.channel=k);this.minIntensity=Object(F.x)(l.minIntensity);this.maxIntensity=Object(F.x)(l.maxIntensity);this.maxTileSpecsToRender=Object(F.x)(l.maxTileSpecsToRender);this.filter=Object(F.w)(l.filter);this.minX=Object(F.x)(l.minX);this.minY=Object(F.x)(l.minY);this.minZ=Object(F.x)(l.minZ);this.maxX=Object(F.x)(l.maxX);this.maxY=Object(F.x)(l.maxY);this.maxZ=Object(F.x)(l.maxZ);void 0!==this.minX&&(d.lowerVoxelBound[0]=this.minX);void 0!==
-this.minY&&(d.lowerVoxelBound[1]=this.minY);void 0!==this.minZ&&(d.lowerVoxelBound[2]=this.minZ);void 0!==this.maxX&&(d.upperVoxelBound[0]=this.maxX);void 0!==this.maxY&&(d.upperVoxelBound[1]=this.maxY);void 0!==this.maxZ&&(d.upperVoxelBound[2]=this.maxZ);k=Object(F.y)(l.encoding);if(void 0===k)k="jpg";else if(!J.has(k))throw Error("Invalid encoding: "+JSON.stringify(k)+".");this.encoding=k;this.numLevels=Object(F.x)(l.numlevels);this.dims=C.s.create();l=Object(F.x)(l.tilesize);void 0===l&&(l=1024);
-this.dims[0]=l;this.dims[1]=l;this.dims[2]=1}L(a,[{key:"getSources",value:function(a){var b=[],c=this.numLevels;void 0===c&&(c=k(this.stackInfo,this.dims[0]));for(var d=C.s.create(),e=C.s.create(),g=0;3>g;g++)d[g]=this.stackInfo.lowerVoxelBound[g]*this.stackInfo.voxelResolution[g],e[g]=this.stackInfo.upperVoxelBound[g]*this.stackInfo.voxelResolution[g];for(g=0;g<c;g++){for(var l=C.s.clone(this.stackInfo.voxelResolution),f=C.s.fromValues(1,1,1),m=0;2>m;++m)l[m]*=Math.pow(2,g),f[m]=this.dims[m];m=C.s.create();
-for(var h=C.s.create(),t=0;3>t;t++)m[t]=Math.floor(this.stackInfo.voxelResolution[t]/l[t]*this.stackInfo.lowerVoxelBound[t]),h[t]=Math.ceil(this.stackInfo.voxelResolution[t]/l[t]*this.stackInfo.upperVoxelBound[t]);l=D.b.make({voxelSize:l,chunkDataSize:f,numChannels:this.numChannels,dataType:this.dataType,lowerClipBound:d,upperClipBound:e,lowerVoxelBound:m,upperVoxelBound:h,volumeSourceOptions:a});l=this.chunkManager.getChunkSource(O,{spec:l,parameters:{baseUrls:this.baseUrls,owner:this.ownerInfo.owner,
-project:this.stackInfo.project,stack:this.stack,channel:this.channel,minIntensity:this.minIntensity,maxIntensity:this.maxIntensity,maxTileSpecsToRender:this.maxTileSpecsToRender,filter:this.filter,dims:this.dims[0]+"_"+this.dims[1],level:g,encoding:this.encoding}});b.push([l])}return b}},{key:"getMeshSource",value:function(){return null}},{key:"dataType",get:function(){return D.a.UINT8}},{key:"numChannels",get:function(){return 3}},{key:"volumeType",get:function(){return D.c.IMAGE}}]);return a}(),
-U=/^([^\/?]+)(?:\/([^\/?]+))?(?:\/([^\/?]+))(?:\/([^\/?]*))?(?:\?(.*))?$/,Z=/^((?:(?:(?:http|https):\/\/[^,\/]+)[^\/?])+)\/(.*)$/,H=function(){function a(b,c,d,e,g,k){q(this,a);this.chunkManager=b;this.baseUrls=c;this.ownerInfo=d;this.project=g;this.parameters=k;b=d.projects.get(g);if(void 0===b)throw Error("Specified project "+JSON.stringify(g)+" does not exist for "+("specified owner "+JSON.stringify(d.owner)));if(void 0===e){e=Array.from(b.stacks.keys());if(1!==e.length)throw Error("Dataset contains multiple stacks: "+
-JSON.stringify(e));e=e[0]}d=b.stacks.get(e);if(void 0===d)throw Error("Specified stack "+JSON.stringify(e)+" is not one of the supported stacks: "+JSON.stringify(Array.from(b.stacks.keys())));this.stack=e;this.stackInfo=d;d=Object(F.y)(k.matchCollection);void 0===d&&(d=e);this.matchCollection=d;e=Object(F.x)(k.zoffset);void 0===e&&(e=1);this.zoffset=e;this.dims=C.s.create();k=Object(F.x)(k.tilesize);void 0===k&&(k=1024);this.dims[0]=k;this.dims[1]=k;this.dims[2]=1}L(a,[{key:"getSources",value:function(a){var b=
-this.stackInfo.voxelResolution,c=C.s.subtract(C.s.create(),this.stackInfo.upperVoxelBound,this.stackInfo.lowerVoxelBound);C.s.multiply(c,c,b);c[2]=b[2];a=A.a.make({voxelSize:b,chunkSize:c,lowerChunkBound:C.s.fromValues(0,0,this.stackInfo.lowerVoxelBound[2]),upperChunkBound:C.s.fromValues(1,1,this.stackInfo.upperVoxelBound[2]),vectorGraphicsSourceOptions:a});return[[this.chunkManager.getChunkSource(M,{spec:a,parameters:{baseUrls:this.baseUrls,owner:this.ownerInfo.owner,project:this.stackInfo.project,
-stack:this.stack,encoding:"points",matchCollection:this.matchCollection,zoffset:this.zoffset}})]]}}]);return a}(),Q=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);L(b,[{key:"getVolume",value:function(a,b){return r(a,b)}},{key:"volumeCompleter",value:function(a,b){return v(a,b)}},{key:"getVectorGraphicsSource",value:function(a,b){return w(a,b)}},{key:"description",get:function(){return"Render"}}]);return b}(f.a)},function(h,f,
-a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"b",function(){return b});a.d(f,"a",function(){return c});var p=a(39),n=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=
-!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),d=function g(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return g(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},b;(function(a){a[a.LINE=0]="LINE";a[a.POINT=1]="POINT"})(b||(b={}));var c=function(a){function b(a){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");
-a=(b.__proto__||Object.getPrototypeOf(b)).call(this,a);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}q(b,a);n(b,[{key:"toObject",value:function(){return d(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"toObject",this).call(this)}}],[{key:"make",value:function(a){return new b(Object.assign({},a,{transform:Object(p.k)(a.transform,a.vectorGraphicsSourceOptions)}))}},{key:"fromObject",
-value:function(a){return new b(a)}}]);return b}(p.i)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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)}a.d(f,"a",function(){return g});a.d(f,"b",function(){return k});h=a(44);f=a(76);var d=a(20),b=a(55),c=function m(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return m(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},e=function(){function a(a,
-b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=function(a){function c(a,d){d=void 0===d?{}:d;d=void 0===d.sourceOptions?{}:d.sourceOptions;q(this,c);var e=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,a.chunkManager,a.getSources(d)));e.shader=void 0;e.rpcId=null;e.shaderGetter=e.registerDisposer(new b.a(e.gl,function(a){return e.defineShader(a)},
-function(){return e.getShaderKey()}));return e}n(c,a);e(c,[{key:"defineShader",value:function(a){a.addFragmentCode("\nvoid emit(vec4 color) {\n  v4f_fragColor = color;\n}\nvoid emitRGBA(vec4 rgba) {\n  emit(vec4(rgba.rgb, rgba.a * uOpacity));\n}\nvoid emitRGB(vec3 rgb) {\n  emit(vec4(rgb, uOpacity));\n}\nvoid emitGrayscale(float value) {\n  emit(vec4(value, value, value, uOpacity));\n}\nvoid emitTransparent() {\n  emit(vec4(0.0, 0.0, 0.0, 0.0));\n}\n")}},{key:"beginSlice",value:function(a){a=this.shaderGetter.get();
-if(void 0!==a)return a.bind(),a}}]);return c}(f.a),l=function(a){function b(a,c){q(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));a.vertexPositions=c.vertexPositions;a.numPoints=Math.floor(a.vertexPositions.length/3);return a}n(b,a);e(b,[{key:"copyToGPU",value:function(a){c(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"copyToGPU",this).call(this,a);this.vertexBuffer=d.a.fromData(a,this.vertexPositions,a.ARRAY_BUFFER,a.STATIC_DRAW)}},{key:"freeGPUMemory",value:function(a){c(b.prototype.__proto__||
-Object.getPrototypeOf(b.prototype),"freeGPUMemory",this).call(this,a);this.vertexBuffer.dispose()}}]);return b}(h.b),k=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);e(b,[{key:"getChunk",value:function(a){return new l(this,a)}},{key:"vectorGraphicsCoordinatesInVoxels",get:function(){return!0}}]);return b}(h.c)},function(h,f,a){function q(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+
-typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}Object.defineProperty(f,"__esModule",{value:!0});a.d(f,"OpenConnectomeDataSource",function(){return d});var p=a(152),n=["http://openconnecto.me","http://www.openconnecto.me"],d=function(a){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var a=(b.__proto__||Object.getPrototypeOf(b)).call(this,
-"NDstore server hosted at openconnecto.me",n,p.a);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}q(b,a);return b}(a(106).SingleServerDataSource)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&
-"function"!==typeof b?a:b}function n(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 d(a,b){return a.getChunkSource(x,{parameters:b})}function b(a,b,c){return a.memoize.getUncounted({type:"precomputed:MultiscaleVolumeChunkSource",baseUrls:b,
-path:c},function(){return Object(u.d)(Object(u.b)(b,c+"/info"),"json").then(function(d){return new z(a,b,c,d)})})}function c(a,b){var c=$jscomp.makeIterator(Object(u.c)(b));b=c.next().value;c=c.next().value;return d(a,{baseUrls:b,path:c,lod:0})}function e(a,c){var d=$jscomp.makeIterator(Object(u.c)(c));c=d.next().value;d=d.next().value;return b(a,c,d)}Object.defineProperty(f,"__esModule",{value:!0});a.d(f,"getMeshSource",function(){return c});a.d(f,"getVolume",function(){return e});a.d(f,"MultiscaleVolumeChunkSource",
-function(){return z});f.getShardedMeshSource=d;f.getShardedVolume=b;a.d(f,"PrecomputedDataSource",function(){return D});var g=a(28);h=a(24);f=a(46);var l=a(277),k=a(54),t=a(26),m=a(33),r=a(2),u=a(63),v=a(4),w=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),y=function(a){function b(){q(this,b);return p(this,
-(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);return b}(Object(h.f)(m.b,l.c)),x=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);return b}(Object(h.f)(k.c,l.a)),A=function G(a){q(this,G);Object(v.t)(a);this.resolution=Object(v.v)(a,"resolution",function(a){return Object(v.c)(r.s.create(),a,v.o)});this.voxelOffset=Object(v.v)(a,"voxel_offset",function(a){return Object(v.d)(r.s.create(),a)});this.size=Object(v.v)(a,
-"size",function(a){return Object(v.c)(r.s.create(),a,v.z)});this.chunkSizes=Object(v.v)(a,"chunk_sizes",function(a){return Object(v.a)(a,function(a){return Object(v.c)(r.s.create(),a,v.z)})});if(0===this.chunkSizes.length)throw Error("No chunk sizes specified.");(this.encoding=Object(v.v)(a,"encoding",function(a){return Object(v.m)(a,l.b)}))===l.b.COMPRESSED_SEGMENTATION&&(this.compressedSegmentationBlockSize=Object(v.v)(a,"compressed_segmentation_block_size",function(a){return Object(v.c)(r.s.create(),
-a,v.z)}));this.key=Object(v.v)(a,"key",v.A)},z=function(){function a(b,c,d,e){q(this,a);this.chunkManager=b;this.baseUrls=c;this.path=d;Object(v.t)(e);this.dataType=Object(v.v)(e,"data_type",function(a){return Object(v.m)(a,t.a)});this.numChannels=Object(v.v)(e,"num_channels",v.z);this.volumeType=Object(v.v)(e,"type",function(a){return Object(v.m)(a,t.c)});this.mesh=Object(v.v)(e,"mesh",v.y);this.scales=Object(v.v)(e,"scales",function(a){return Object(v.a)(a,function(a){return new A(a)})})}w(a,[{key:"getMeshSource",
-value:function(){var a=this.mesh;return void 0===a?null:d(this.chunkManager,{baseUrls:this.baseUrls,path:this.path+"/"+a,lod:0})}},{key:"getSources",value:function(a){var b=this;return this.scales.map(function(c){return t.b.getDefaults({voxelSize:c.resolution,dataType:b.dataType,numChannels:b.numChannels,transform:r.k.fromTranslation(r.k.create(),r.s.multiply(r.s.create(),c.resolution,c.voxelOffset)),upperVoxelBound:c.size,volumeType:b.volumeType,chunkDataSizes:c.chunkSizes,baseVoxelOffset:c.voxelOffset,
-compressedSegmentationBlockSize:c.compressedSegmentationBlockSize,volumeSourceOptions:a}).map(function(a){return b.chunkManager.getChunkSource(y,{spec:a,parameters:{baseUrls:b.baseUrls,path:b.path+"/"+c.key,encoding:c.encoding}})})})}},{key:"getStaticAnnotations",value:function(){var a=this.scales[0],b=new g.b(r.k.fromScaling(r.k.create(),a.resolution));b.readonly=!0;b.add(Object(g.i)(a.voxelOffset,r.s.add(r.s.create(),a.voxelOffset,a.size)));return b}}]);return a}(),D=function(a){function b(){q(this,
-b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);w(b,[{key:"getVolume",value:function(a,b){return e(a,b)}},{key:"getMeshSource",value:function(a,b){return c(a,b)}},{key:"description",get:function(){return"Precomputed file-backed data source"}}]);return b}(f.a)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a,b,d){return a.rpc.promiseInvoke(c.a,{chunkManager:a.addCounterpartRef(),url:b},d)}function b(a,b){return a.memoize.getUncounted({type:"nifti/getVolume",
-url:b},function(){return d(a,b,l.e).then(function(c){return new r(a,b,c)})})}Object.defineProperty(f,"__esModule",{value:!0});a.d(f,"getVolume",function(){return b});a.d(f,"MultiscaleVolumeChunkSource",function(){return r});a.d(f,"NiftiDataSource",function(){return u});h=a(24);f=a(46);var c=a(279),e=a(26),g=a(33),l=a(32),k=a(2),t=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,
-d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),m=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);return b}(Object(h.f)(g.b,c.b)),r=function(){function a(b,c,d){q(this,a);this.chunkManager=b;this.url=c;this.info=d}t(a,[{key:"getSources",value:function(a){var b=this.info;a=e.b.withDefaultCompression({volumeType:b.volumeType,chunkDataSize:b.volumeSize,dataType:b.dataType,voxelSize:b.voxelSize,numChannels:b.numChannels,
-upperVoxelBound:b.volumeSize,transform:Object(k.q)(k.k.create(),b.qoffset,b.quatern,k.g,b.qfac),volumeSourceOptions:a});return[[this.chunkManager.getChunkSource(m,{spec:a,parameters:{url:this.url}})]]}},{key:"getMeshSource",value:function(){return null}},{key:"numChannels",get:function(){return this.info.numChannels}},{key:"dataType",get:function(){return this.info.dataType}},{key:"volumeType",get:function(){return this.info.volumeType}}]);return a}(),u=function(a){function c(){q(this,c);return p(this,
-(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}n(c,a);t(c,[{key:"getVolume",value:function(a,c){return b(a,c)}},{key:"description",get:function(){return"Single NIfTI file"}}]);return c}(f.a)},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a){return Object(e.b)(void 0===a?"void main() {\n  emitGrayscale(toNormalized(getDataValue()));\n}\n":a)}f.c=n;a.d(f,"b",function(){return t});h=a(161);var d=a(56),b=a(162),c=a(4),e=a(55),g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;
-"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),l=function r(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return r(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};f.a="//NEUROGLANCER_IMAGE_RENDERLAYER_FRAGMENT_MAIN_START";var k=a(105),t=function(a){function e(a,c){c=void 0===c?{}:c;if(!(this instanceof
-e))throw new TypeError("Cannot call a class as a function");var g=q(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a,c)),k=c;a=void 0===k.opacity?Object(d.a)(.5):k.opacity;c=void 0===k.blendMode?Object(b.c)():k.blendMode;k=void 0===k.fragmentMain?n():k.fragmentMain;g.fragmentMain=k;g.opacity=a;g.blendMode=c;g.registerDisposer(a.changed.add(function(){g.redrawNeeded.dispatch()}));g.registerDisposer(k.changed.add(function(){g.shaderGetter.invalidateShader();g.redrawNeeded.dispatch()}));return g}
-p(e,a);g(e,[{key:"getShaderKey",value:function(){return"volume.ImageRenderLayer:"+JSON.stringify(this.fragmentMain.value)}},{key:"defineShader",value:function(a){l(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"defineShader",this).call(this,a);a.addUniform("highp float","uOpacity");a.addFragmentCode("\nvoid emitRGBA(vec4 rgba) {\n  emit(vec4(rgba.rgb, rgba.a * uOpacity));\n}\nvoid emitRGB(vec3 rgb) {\n  emit(vec4(rgb, uOpacity));\n}\nvoid emitGrayscale(float value) {\n  emit(vec4(value, value, value, uOpacity));\n}\nvoid emitTransparent() {\n  emit(vec4(0.0, 0.0, 0.0, 0.0));\n}\n");
-a.addFragmentCode(k);a.setFragmentMainFunction("//NEUROGLANCER_IMAGE_RENDERLAYER_FRAGMENT_MAIN_START\n"+this.fragmentMain.value)}},{key:"beginSlice",value:function(a){a=l(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"beginSlice",this).call(this,a);if(void 0!==a)return this.gl.uniform1f(a.uniform("uOpacity"),this.opacity.value),a}},{key:"setGLBlendMode",value:function(a,d){var e=Object(c.m)(this.blendMode.value,b.b);if(e===b.b.ADDITIVE||0<d)a.enable(a.BLEND),b.a.get(e)(a)}}]);return e}(h.a)},
-function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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)}a.d(f,"a",function(){return u});var d=a(30),b=a(39);h=a(142);f=a(76);var c=a(2),e=a(55),g=a(21),l=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),k=function w(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,
-b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return w(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},t=c.k.create(),m=c.s.create(),r=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);l(b,[{key:"defineShader",value:function(a){k(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);a.addAttribute("highp float","aVertexIndexFloat");a.addUniform("highp vec3",
-"uTranslation");a.addUniform("highp mat4","uProjectionMatrix");a.addUniform("highp vec3","uChunkDataSize");a.addUniform("highp vec3","uVoxelSize");a.addUniform("highp vec3","uLowerClipBound");a.addUniform("highp vec3","uUpperClipBound");a.addVarying("highp vec3","vChunkPosition");a.setVertexMain("\nvec3 chunkSize = uChunkDataSize * uVoxelSize;\nvec3 position = getBoundingBoxPlaneIntersectionVertexPosition(chunkSize, uTranslation, uLowerClipBound, uUpperClipBound, int(aVertexIndexFloat));\ngl_Position = uProjectionMatrix * vec4(position, 1.0);\nvChunkPosition = (position - uTranslation) / uVoxelSize +\n    0.001 * abs(uPlaneNormal);\n");
-a.addFragmentCode("\nvec3 getPositionWithinChunk () {\n  return floor(min(vChunkPosition, uChunkDataSize - 1.0));\n}\n")}},{key:"computeVerticesDebug",value:function(a,b,d,e,g,k,l,f){a=c.s.multiply(c.s.create(),a,b);for(var m=c.s.create(),h=c.s.create(),t=c.s.fromValues(Math.abs(k[0]),Math.abs(k[1]),Math.abs(k[2])),r=0;6>r;++r){var n=this.computeVertexPositionDebug(a,d,e,g,k,l,r);if(void 0===n){console.log("no intersection found");break}c.s.transformMat4(m,n,f);c.s.sub(h,n,l);c.s.divide(h,h,b);c.s.scaleAndAdd(h,
-h,t,.001);console.log("vertex "+r+", at "+m+", vChunkPosition = "+h)}}},{key:"beginSlice",value:function(a,b){a=b.attribute("aVertexIndexFloat");this.data.outputVertexIndices.bindToVertexAttrib(a,1)}},{key:"endSlice",value:function(a,b){b=b.attribute("aVertexIndexFloat");a.disableVertexAttribArray(b)}},{key:"beginSource",value:function(a,b,d,e,g,k){this.setViewportPlane(b,d.viewportAxes[2],d.centerDataPosition,k.invTransform);a.uniformMatrix4fv(b.uniform("uProjectionMatrix"),!1,c.k.multiply(t,e,k.transform));
-a.uniform3fv(b.uniform("uVoxelSize"),g.voxelSize);a.uniform3fv(b.uniform("uLowerClipBound"),g.lowerClipBound);a.uniform3fv(b.uniform("uUpperClipBound"),g.upperClipBound)}},{key:"setupChunkDataSize",value:function(a,b,c){a.uniform3fv(b.uniform("uChunkDataSize"),c)}},{key:"drawChunk",value:function(a,b,c){a.uniform3fv(b.uniform("uTranslation"),c);a.drawArrays(a.TRIANGLE_FAN,0,6)}}],[{key:"get",value:function(a){return a.memoize.get("volume.VolumeSliceVertexComputationManager",function(){return new b(a)})}}]);
-return b}(h.a),u=function(a){function k(a,d){d=void 0===d?{}:d;q(this,k);var g=d,l=void 0===g.sourceOptions?{}:g.sourceOptions;g=g.shaderError;var f=p(this,(k.__proto__||Object.getPrototypeOf(k)).call(this,a.chunkManager,a.getSources(l),d));a=f.gl;f.shaderGetter=f.registerDisposer(new e.a(a,function(a){return f.defineShader(a)},function(){return f.getShaderKey()+"/"+f.chunkFormat.shaderKey},g));f.vertexComputationManager=r.get(a);d=Object(b.m)(f)[0][0];a=d.chunkLayout;d=d.source.spec;l=f.boundingBox=
-new c.b(c.s.fromValues(Infinity,Infinity,Infinity),c.s.fromValues(-Infinity,-Infinity,-Infinity));g=c.s.create();for(var h=0;8>h;++h){for(var t=0;3>t;++t)m[t]=h&1<<t?d.upperClipBound[t]:d.lowerClipBound[t];a.localSpatialToGlobal(g,m);c.s.min(l.lower,l.lower,g);c.s.max(l.upper,l.upper,g)}return f}n(k,a);l(k,[{key:"getValueAt",value:function(a){for(var c=$jscomp.makeIterator(Object(b.m)(this)),d=c.next();!d.done;d=c.next()){d=$jscomp.makeIterator(d.value);for(var e=d.next();!e.done;e=d.next())if(e=
-e.value,e=e.source.getValueAt(a,e.chunkLayout),null!=e)return e}return null}},{key:"getShaderKey",value:function(){return this.chunkFormat.shaderKey}},{key:"defineShader",value:function(a){this.vertexComputationManager.defineShader(a);a.addOutputBuffer("vec4","v4f_fragData0",0);a.addFragmentCode("\nvoid emit(vec4 color) {\n  v4f_fragData0 = color;\n}\n");this.chunkFormat.defineShader(a);a.addFragmentCode("\n"+Object(g.a)(this.dataType)+" getDataValue() { return getDataValue(0); }\n")}},{key:"beginSlice",
-value:function(a){a=this.gl;var b=this.shaderGetter.get();if(void 0!==b)return b.bind(),this.vertexComputationManager.beginSlice(a,b),b}},{key:"endSlice",value:function(a){this.vertexComputationManager.endSlice(this.gl,a)}},{key:"draw",value:function(a){var b=a.visibleLayers.get(this);if(0!==b.length){var e=this.gl,g=this.beginSlice(a);if(void 0!==g){var k=c.s.create(),l=this.vertexComputationManager,f=this.chunkFormat;f.beginDrawing(e,g);var m={};b=$jscomp.makeIterator(b);for(var h=b.next();!h.done;m=
-{chunkDataSize:m.chunkDataSize},h=b.next()){h=h.value;var t=h.chunkLayout,r=h.source;h=r.chunks;var n=t.size;m.chunkDataSize=void 0;var p=a.visibleChunks.get(t);if(p){l.beginSource(e,g,a,a.dataToDevice,r.spec,t);t=r.chunkFormat;t.beginSource(e,g);r=function(a){return function(b){a.chunkDataSize=b;l.setupChunkDataSize(e,g,a.chunkDataSize)}}(m);p=$jscomp.makeIterator(p);for(var u=p.next();!u.done;u=p.next())if((u=h.get(u.value))&&u.state===d.d.GPU_MEMORY){var q=u.chunkDataSize;q!==m.chunkDataSize&&
-r(q);c.s.multiply(k,n,u.chunkGridPosition);t.bindChunk(e,g,u);l.drawChunk(e,g,k)}}}f.endDrawing(e,g);this.endSlice(g)}}}},{key:"dataType",get:function(){return this.sources[0][0].spec.dataType}},{key:"chunkFormat",get:function(){return this.sources[0][0].chunkFormat}}]);return k}(f.a)},function(h,f,a){function q(a){if(Object(n.m)(a,d))return Object(n.A)(a);throw Error();}a.d(f,"b",function(){return d});f.c=function(a){return new p.c(void 0===a?"default":a,q)};var p=a(9),n=a(4),d;(function(a){a[a.DEFAULT=
-0]="DEFAULT";a[a.ADDITIVE=1]="ADDITIVE"})(d||(d={}));h=new Map;f.a=h;h.set(d.DEFAULT,function(a){a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA)});h.set(d.ADDITIVE,function(a){a.blendFunc(a.SRC_ALPHA,a.ONE)})},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,
-b):a.__proto__=b)}function p(a){return function(a){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var a=(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}q(e,a);l(e,[{key:"restoreState",value:function(a){var l=this;k(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"restoreState",
-this).call(this,a);a=this.volumePath=Object(g.v)(a,"source",g.y);void 0!==a&&(this.multiscaleSource=Object(b.d)(this.manager.dataSourceProvider,this.manager.chunkManager,a,this.volumeOptions)).then(function(a){l.wasDisposed||(a=a.getStaticAnnotations&&a.getStaticAnnotations(),void 0!==a&&(l.annotationLayerState.value=new n.b(Object.assign({transform:l.transform,source:a,role:d.g.DEFAULT_ANNOTATION},Object(c.b)(l)))))})}},{key:"toJSON",value:function(){var a=k(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),
-"toJSON",this).call(this);a.source=this.volumePath;return a}}]);return e}(a)}f.a=function(a){return p(Object(c.a)(Object(e.a)(a)))};var n=a(73),d=a(18),b=a(27),c=a(108),e=a(111),g=a(4),l=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),k=function m(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,
-b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return m(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}}},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function p(a){if(void 0===
-a[3]||1===a[3]){for(var c="#",d=0;3>d;++d)c+=Object(b.c)(Math.min(255,Math.max(0,Math.round(255*a[d]))));return c}c="rgba(";for(d=0;3>d;++d)0!==d&&(c+=", "),c+=Math.min(255,Math.max(0,Math.round(255*a[d])));return c+=", "+Object(n.a)(a[3])+")"}a.d(f,"a",function(){return e});h=a(9);var n=a(165),d=a(2),b=a(166),c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,
-c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),e=function(a){function b(a){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var c=(b.__proto__||Object.getPrototypeOf(b)).call(this,d.s.clone(a));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.defaultValue=a;return c}q(b,a);c(b,[{key:"toString",value:function(){return p(this.value)}},{key:"toJSON",value:function(){if(!d.s.equals(this.value,
-this.defaultValue))return p(this.value)}},{key:"reset",value:function(){this.value=d.s.clone(this.defaultValue)}},{key:"restoreState",value:function(a){if(void 0===a)this.reset();else{var b=this.value;try{if("string"!==typeof a)throw Error("Expected string, but received "+JSON.stringify(a)+".");var c=document.createElement("canvas").getContext("2d");c.fillStyle=a;var e=c.fillStyle,g=e.match(/^rgba\(([0-9]+), ([0-9]+), ([0-9]+), (0(?:\.[0-9]+)?)\)$/);if(null!==g)var k=[parseInt(g[1],10),parseInt(g[2],
-10),parseInt(g[3],10),parseFloat(g[4])];else{var l=e.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/);if(null!==l)k=[parseInt(l[1],16),parseInt(l[2],16),parseInt(l[3],16),1];else throw Error("Invalid serialized color: "+JSON.stringify(e)+".");}a=k;var f=d.u.fromValues(a[0]/255,a[1]/255,a[2]/255,a[3])}catch(x){throw Error("Failed to parse color specification: "+x.message);}f=f.subarray(0,3);d.s.equals(b,f)||(this.value=f)}}}]);return b}(h.f)},function(h,f,a){f.a=function(a){a=q[0]=a;for(var f=0;9>
-f;++f){var d=a.toFixed(f);q[0]=parseFloat(d);if(q[0]===a)return d}return a.toString()};var q=new Float32Array(1)},function(h,f,a){function q(a){return("0"+a.toString(16)).slice(-2)}f.c=q;f.b=function(a){return Array.prototype.map.call(a,q).join("")};f.a=function(a){if(!/^(?:[0-9a-fA-F]{2})*$/.test(a))throw Error("Invalid hex-encoded string");for(var f=a.length/2,d=new Uint8Array(f),b=0;b<f;++b)d[b]=parseInt(a.substr(2*b,2),16);return d}},function(h,f,a){function q(a){var b=Object(n.d)(a);return(a/
-b.lengthInNanometers).toPrecision(3)+"\u202f"+b.unit}f.c=function(a){return"("+Math.floor(a[0])+", "+Math.floor(a[1])+", "+Math.floor(a[2])+")"};f.b=function(a){for(var b="",c=0;3>c;++c)0!==c&&(b+=" \u00d7 "),b+=Math.round(Math.abs(a[c]));return b};f.d=q;f.a=function(a,b,c){for(var d="",g=p.s.create(),l=0;3>l;++l){p.s.set(g,0,0,0);g[l]=b[l]-a[l];var k=Object(p.p)(g,g,c);k=p.s.length(k);0!==l&&(d+=" \u00d7 ");d+=q(k)}a=Math.abs(Object(p.l)(p.s.subtract(g,b,a)));c=p.i.determinant(p.i.fromMat4(p.i.create(),
-c));d+="  [";c*=a;a=Object(n.e)(c);c=(c/Math.pow(a.lengthInNanometers,3)).toPrecision(6)+"\u202f"+a.unit+"\u00b3";return d+c+"]"};var p=a(2),n=a(53)},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,
-{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return g});h=a(1);var n=a(8),d=a(7),b=a(14),c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),e=function k(a,b,c){null===a&&(a=Function.prototype);var d=
-Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return k(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a(45);a(288);var g=function(a){function g(){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var a=q(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));a.element=document.createElement("form");a.label=document.createElement("label");a.input=document.createElement("input");a.valuesEntered=
-new d.b;var b=a.element,c=a.label,e=a.input;b.className="uint64-entry neuroglancer-noselect";b.appendChild(c);c.appendChild(e);a.registerEventListener(b,"submit",function(b){b.preventDefault();b=a.validateInput();void 0!==b&&(a.input.value="",a.input.classList.remove("valid-input","invalid-input"),a.valuesEntered.dispatch(b))});a.registerEventListener(b,"input",function(){""===a.input.value?a.input.classList.remove("valid-input","invalid-input"):a.validateInput()?a.input.classList.remove("invalid-input"):
-a.input.classList.add("invalid-input")});return a}p(g,a);c(g,[{key:"validateInput",value:function(){var a=this.input.value;a=a.replace(/[\s,\(\)\[\]\{\};]+/g," ");a=a.trim();var c=a.split(" ");if(0!==c.length){a=[];c=$jscomp.makeIterator(c);for(var d=c.next();!d.done;d=c.next()){d=d.value;var e=new b.a;if(!e.tryParseString(d))return;a.push(e)}return a}}},{key:"disposed",value:function(){Object(n.b)(this.element);e(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",this).call(this)}}]);
-return g}(h.a)},function(h,f){},function(h,f){},function(h,f){},function(h,f){},function(h,f,a){f.a=function(a){return new q.c(void 0===a?1:a,p.n)};var q=a(9),p=a(4)},function(h,f,a){f.a=function(a){a=void 0===a?q.s.create():a;return new b(a,a)};var q=a(2),p=a(4),n=a(7),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);
-return b}}(),b=function(){function a(b,c){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.value_=b;this.defaultValue=c;this.changed=new n.a}d(a,[{key:"toJSON",value:function(){if(this.value_!==this.defaultValue)return this.value_.toString()}},{key:"restoreState",value:function(a){try{this.value=Object(p.k)(a.split(","))}catch(g){this.value=this.defaultValue}}},{key:"reset",value:function(){this.value=this.defaultValue}},{key:"value",get:function(){return this.value_},
-set:function(a){a!==this.value_&&(this.value_=a,this.changed.dispatch())}}]);return a}()},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});
-b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}a.d(f,"a",function(){return r});var d=a(66),b=a(115),c=a(113),e=a(64);h=a(161);var g=a(21),l=function v(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return v(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},k=
-function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),t=new Float32Array(8),m=function(){function a(b){n(this,a);this.disjointSets=b;this.generation=Number.NaN;this.hashMap=new d.a}k(a,[{key:"update",value:function(){var a=this.disjointSets,b=a.generation;if(this.generation!==b){this.generation=b;b=this.hashMap;
-b.clear();a=$jscomp.makeIterator(a.mappings());for(var c=a.next();!c.done;c=a.next()){var d=$jscomp.makeIterator(c.value);c=d.next().value;d=d.next().value;b.set(c,d)}}}}]);return a}(),r=function(a){function d(a,g){n(this,d);var k=q(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,{sourceOptions:g.volumeSourceOptions,transform:g.objectToDataTransform}));k.displayState=g;k.segmentColorShaderManager=new c.b("segmentColorHash");k.hashTableManager=new b.c("visibleSegments");k.gpuHashTable=b.a.get(k.gl,
-k.displayState.visibleSegments.hashTable);k.hashTableManagerHighlighted=new b.c("highlightedSegments");k.gpuHashTableHighlighted=b.a.get(k.gl,k.displayState.highlightedSegments.hashTable);k.equivalencesShaderManager=new b.b("equivalences");k.equivalencesHashMap=new m(k.displayState.segmentEquivalences.disjointSets);k.gpuEquivalencesHashTable=b.a.get(k.gl,k.equivalencesHashMap.hashMap);Object(e.g)(g,k);k.registerDisposer(g.selectedAlpha.changed.add(function(){k.redrawNeeded.dispatch()}));k.registerDisposer(g.hideSegmentZero.changed.add(function(){k.redrawNeeded.dispatch();
-k.shaderGetter.invalidateShader()}));k.hasEquivalences=0!==k.displayState.segmentEquivalences.size;g.segmentEquivalences.changed.add(function(){var a=0!==k.displayState.segmentEquivalences.size;a!==k.hasEquivalences&&(k.hasEquivalences=a,k.shaderGetter.invalidateShader())});k.registerDisposer(g.notSelectedAlpha.changed.add(function(){k.redrawNeeded.dispatch()}));return k}p(d,a);k(d,[{key:"getShaderKey",value:function(){return"sliceview.SegmentationRenderLayer/"+this.hasEquivalences+"/"+this.displayState.hideSegmentZero.value}},
-{key:"defineShader",value:function(a){l(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"defineShader",this).call(this,a);this.hashTableManager.defineShader(a);this.hashTableManagerHighlighted.defineShader(a);a.addFragmentCode("\nuint64_t getUint64DataValue() {\n  return toUint64(getDataValue());\n}\n");this.hasEquivalences?(this.equivalencesShaderManager.defineShader(a),a.addFragmentCode("\nuint64_t getMappedObjectId() {\n  uint64_t value = getUint64DataValue();\n  uint64_t mappedValue;\n  if ("+
-this.equivalencesShaderManager.getFunctionName+"(value, mappedValue)) {\n    return mappedValue;\n  }\n  return value;\n}\n")):a.addFragmentCode("\nuint64_t getMappedObjectId() {\n  return getUint64DataValue();\n}\n");this.segmentColorShaderManager.defineShader(a);a.addUniform("highp vec4","uSelectedSegment",2);a.addUniform("highp float","uShowAllSegments");a.addUniform("highp float","uSelectedAlpha");a.addUniform("highp float","uNotSelectedAlpha");a.addUniform("highp float","uSaturation");a.addFragmentCode(g.q);
-var b="\n  uint64_t value = getMappedObjectId();\n\n  float alpha = uSelectedAlpha;\n  float saturation = uSaturation;\n";this.displayState.hideSegmentZero.value&&(b+="\n  if (value.low == vec4(0,0,0,0) && value.high == vec4(0,0,0,0)) {\n    emit(vec4(vec4(0, 0, 0, 0)));\n    return;\n  }\n");b+="\n  bool has = uShowAllSegments > 0.0 ? true : "+this.hashTableManager.hasFunctionName+"(value);\n  if (uSelectedSegment[0] == unnormalizeUint8(value.low) &&\n      uSelectedSegment[1] == unnormalizeUint8(value.high)) {\n    saturation = has ? 0.5 : 0.75;\n  } else if (!has) {\n    alpha = uNotSelectedAlpha;\n  }\n  vec3 rgb = segmentColorHash(value);\n  ";
-b+="\n  if("+this.hashTableManagerHighlighted.hasFunctionName+"(value)) {\n    rgb = vec3(0.2,0.2,2.0);\n    saturation = 1.0;\n  };\n";a.setFragmentMain(b+"\n  emit(vec4(mix(vec3(1.0,1.0,1.0), rgb, saturation), alpha));\n")}},{key:"beginSlice",value:function(a){a=l(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"beginSlice",this).call(this,a);if(void 0!==a){var b=this.gl,c=this.displayState,e=this.displayState,g=e.segmentSelectionState;e=e.visibleSegments;if(g.hasSelectedSegment){var k=
-g.selectedSegment;g=k.low;k=k.high;for(var f=0;4>f;++f)t[f]=g>>8*f&255,t[4+f]=k>>8*f&255}else t.fill(0);b.uniform1f(a.uniform("uSelectedAlpha"),this.displayState.selectedAlpha.value);b.uniform1f(a.uniform("uSaturation"),this.displayState.saturation.value);b.uniform1f(a.uniform("uNotSelectedAlpha"),this.displayState.notSelectedAlpha.value);b.uniform4fv(a.uniform("uSelectedSegment"),t);b.uniform1f(a.uniform("uShowAllSegments"),e.hashTable.size?0:1);this.hashTableManager.enable(b,a,this.gpuHashTable);
-this.hashTableManagerHighlighted.enable(b,a,this.gpuHashTableHighlighted);this.hasEquivalences&&(this.equivalencesHashMap.update(),this.equivalencesShaderManager.enable(b,a,this.gpuEquivalencesHashTable));this.segmentColorShaderManager.enable(b,a,c.segmentColorHash);return a}}},{key:"endSlice",value:function(a){var b=this.gl;this.hashTableManager.disable(b,a);this.hashTableManagerHighlighted.disable(b,a);l(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"endSlice",this).call(this,a)}}]);
-return d}(h.a)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a){return a.split(/[^a-zA-Z0-9]+/).filter(function(a){return a}).join("_")}function b(a){var b=new Set,c=[];a=$jscomp.makeIterator(a);for(var e=a.next();!e.done;e=a.next()){e=d(e.value);for(var g="",k=0;b.has(e+g);)g=""+ ++k;c.push(e+g)}return c}function c(a){return new v.a({fragmentMain:a.displayState.fragmentMain,shaderError:a.displayState.shaderError,fragmentMainStartLine:k.a})}function e(a){return new z(a.displayState.attributeNames,
-function(){return a.meshSource&&a.meshSource.info.vertexAttributes})}Object.defineProperty(f,"__esModule",{value:!0});a.d(f,"SingleMeshUserLayer",function(){return A});h=a(10);var g=a.n(h);h=a(18);f=a(27);var l=a(47),k=a(116),t=a(111),m=a(1),r=a(8),u=a(4),v=a(112),w=a(40),y=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,
-d);return b}}(),x=function C(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return C(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a(304);var A=function(a){function c(a,d){q(this,c);var e=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,a,d));e.manager=a;e.displayState=new k.b;e.displayState.objectToDataTransform=e.transform;e.parameters={meshSourceUrl:Object(u.v)(d,
-"source",u.A),attributeSourceUrls:Object(u.v)(d,"vertexAttributeSources",function(a){return void 0!==a?Object(u.a)(a,u.A):[]})};e.displayState.fragmentMain.restoreState(d.shader);e.userSpecifiedAttributeNames=Object(u.v)(d,"vertexAttributeNames",function(a){if(void 0!==a)return Object(u.a)(a,function(a){if(a=Object(u.y)(a))return a})});Object(k.f)(a.chunkManager,e.parameters).then(function(a){if(!e.wasDisposed){e.meshSource=a;var c=e.defaultAttributeNames=b(a.info.vertexAttributes.map(function(a){return a.name})),
-d=e.userSpecifiedAttributeNames;void 0!==d&&d.length===c.length?(c=d,e.userSpecifiedAttributeNames=void 0):c=Array.from(c);e.displayState.attributeNames.value=c;e.addRenderLayer(new k.c(a,e.displayState));e.isReady=!0}});e.registerDisposer(e.displayState.fragmentMain.changed.add(function(){e.specificationChanged.dispatch()}));e.registerDisposer(e.displayState.attributeNames.changed.add(function(){e.specificationChanged.dispatch()}));e.tabs.add("rendering",{label:"Rendering",order:-100,getter:function(){return new D(e)}});
-e.tabs.default="rendering";return e}n(c,a);y(c,[{key:"toJSON",value:function(){var a=x(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"toJSON",this).call(this);a.type="mesh";var b=this.parameters.attributeSourceUrls;a.source=this.parameters.meshSourceUrl;b&&(a.vertexAttributeSources=b);a.shader=this.displayState.fragmentMain.toJSON();if(void 0===this.meshSource)b=this.userSpecifiedAttributeNames;else{b=this.defaultAttributeNames;for(var d=this.displayState.attributeNames.value,e=!0,g=d.length,
-k=0;k<g;++k)if(d[k]!==b[k]){e=!1;break}b=e?void 0:Array.from(d)}a.vertexAttributeNames=b;return a}}]);return c}(Object(t.a)(h.i)),z=function(a){function b(a,c){q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.attributeNames=a;d.getAttributeInfo=c;d.element=document.createElement("div");d.debouncedValueUpdater=g()(function(){d.updateAttributeNames()},500);d.element.className="neuroglancer-single-mesh-attribute-widget";d.updateInputElements();d.registerDisposer(a.changed.add(function(){d.updateInputElements()}));
-return d}n(b,a);y(b,[{key:"updateInputElements",value:function(){var a=this.attributeNames,b=this.attributeNameElements;if(void 0===b){var c=this.getAttributeInfo();if(void 0===c)return;b=this.attributeNameElements=[];for(var d=void 0,e=a.value.length,g=this.element,l=0;l<e;++l){var f=c[l],m=f.source;if(m!==d&&void 0!==m){d=m;var h=document.createElement("div");h.className="neuroglancer-single-mesh-source-header";h.textContent=m;g.appendChild(h)}m=document.createElement("div");m.className="neuroglancer-single-mesh-attribute";
-h=document.createElement("input");h.title=f.name;this.registerEventListener(h,"input",this.debouncedValueUpdater);h.type="text";m.textContent=Object(k.e)(f);m.appendChild(h);if(void 0!==f.min&&void 0!==f.max){var t=document.createElement("span");t.className="neuroglancer-single-mesh-attribute-range";t.textContent="["+f.min.toPrecision(6)+", "+f.max.toPrecision(6)+"]";m.appendChild(t)}b[l]=h;g.appendChild(m)}}a.value.forEach(function(a,c){b[c].value=a||""})}},{key:"disposed",value:function(){Object(r.b)(this.element)}},
-{key:"updateAttributeNames",value:function(){var a=this.attributeNames.value,b=this.attributeNameElements,c=!1;a.forEach(function(d,e){var g=b[e].value;g||(g=void 0);g!==d&&(c=!0,a[e]=g)});c&&this.attributeNames.changed.dispatch()}}]);return b}(m.a),D=function(a){function b(a){q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.layer=a;d.attributeWidget=d.registerDisposer(e(d.layer));d.codeWidget=d.registerDisposer(c(d.layer));a=d.element;a.classList.add("neuroglancer-single-mesh-dropdown");
-var g=document.createElement("div");g.className="neuroglancer-single-mesh-dropdown-top-row";var k=document.createElement("div");k.style.flex="1";var l=document.createElement("a"),f=document.createElement("button");f.type="button";f.textContent="?";f.className="help-link";l.appendChild(f);l.title="Documentation on single mesh layer rendering";l.target="_blank";l.href="https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/image_layer_rendering.md";f=document.createElement("button");
-f.innerHTML="&square;";f.className="maximize-button";f.title="Show larger editor view";d.registerEventListener(f,"click",function(){new E(d.layer)});g.appendChild(k);g.appendChild(f);g.appendChild(l);a.appendChild(g);a.appendChild(d.attributeWidget.element);a.appendChild(d.codeWidget.element);d.codeWidget.textEditor.refresh();d.visibility.changed.add(function(){d.visible&&d.codeWidget.textEditor.refresh()});return d}n(b,a);return b}(w.b),E=function(a){function b(a){q(this,b);var d=p(this,(b.__proto__||
-Object.getPrototypeOf(b)).call(this));d.layer=a;d.attributeWidget=d.registerDisposer(e(d.layer));d.codeWidget=d.registerDisposer(c(d.layer));d.content.classList.add("neuroglancer-single-mesh-layer-shader-overlay");d.content.appendChild(d.attributeWidget.element);d.content.appendChild(d.codeWidget.element);d.codeWidget.textEditor.refresh();return d}n(b,a);return b}(l.a);Object(f.e)("mesh",A)},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}a.d(f,"d",function(){return n});f.c="single_mesh/SingleMeshLayer";f.a="single_mesh/getSingleMeshInfo";f.b="";var n=function(a){function b(){p(this,b);var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!a||"object"!==typeof a&&"function"!==typeof a?this:a}q(b,a);return b}(function b(){p(this,b)});n.RPC_ID="single_mesh/SingleMeshSource"},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,
-{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a){return encodeURI(a).replace(/[!'()*;,]/g,function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()})}a.d(f,"a",function(){return l});h=a(10);var d=a.n(h),b=a(9);h=a(1);var c=a(4),e=a(67),g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,
-d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),l=function(a){function k(a,c){c=void 0===c?200:c;if(!(this instanceof k))throw new TypeError("Cannot call a class as a function");var e=q(this,(k.__proto__||Object.getPrototypeOf(k)).call(this));e.root=a;e.parseError=new b.f(void 0);e.registerEventListener(window,"hashchange",function(){return e.updateFromUrlHash()});var g=d()(function(){return e.setUrlHash()},c);e.registerDisposer(a.changed.add(g));e.registerDisposer(function(){return g.cancel()});
-return e}p(k,a);g(k,[{key:"setUrlHash",value:function(){var a=Object(e.b)(this.root);a.generation!==this.prevStateGeneration&&(this.prevStateGeneration=a.generation,a=n(JSON.stringify(a.value)),a!==this.prevStateString&&(this.prevStateString=a,"{}"===decodeURIComponent(a)?history.replaceState(null,"","#"):history.replaceState(null,"","#!"+a)))}},{key:"updateFromUrlHash",value:function(){try{var a=location.href.replace(/^[^#]+/,"");if(""===a||"#"===a||"#!"===a)a="#!{}";if(a.startsWith("#!+")){a=a.slice(3);
-a=decodeURIComponent(a);var b=Object(c.h)(a);Object(c.t)(b);this.root.restoreState(b);this.prevStateString=void 0}else if(a.startsWith("#!")){a=a.slice(2);a=decodeURIComponent(a);if(a===this.prevStateString)return;this.prevStateString=a;this.root.reset();var d=Object(c.h)(a);Object(c.t)(d);this.root.restoreState(d)}else throw Error('URL hash is expected to be of the form "#!{...}" or "#!+{...}".');this.parseError.value=void 0}catch(v){this.parseError.value=v}}}]);return k}(h.a)},function(h,f,a){function q(a,
-b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return b});h=a(1);var p=a(7),n=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,
-d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),d=function e(a,b,d){null===a&&(a=Function.prototype);var g=Object.getOwnPropertyDescriptor(a,b);if(void 0===g){if(a=Object.getPrototypeOf(a),null!==a)return e(a,b,d)}else{if("value"in g)return g.value;b=g.get;return void 0===b?void 0:b.call(d)}},b=function(a){function b(a,d,e){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var g=(b.__proto__||Object.getPrototypeOf(b)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-g=!g||"object"!==typeof g&&"function"!==typeof g?this:g;g.register=a;g.unregister=d;g.changed=new p.a;void 0===e?g.map=new Map:(g.map=new Map(e),g.map.forEach(g.register));return g}q(b,a);$jscomp.initSymbol();$jscomp.initSymbolIterator();n(b,[{key:"set",value:function(a,b){var d=this.map,e=d.get(a);void 0!==e&&this.unregister(e,a);d.set(a,b);this.register(b,a);this.changed.dispatch();return this}},{key:"delete",value:function(a){var b=this.map.get(a);return void 0!==b?(this.unregister(b,a),this.changed.dispatch(),
-!0):!1}},{key:"has",value:function(a){return this.map.has(a)}},{key:Symbol.iterator,value:function(){$jscomp.initSymbol();$jscomp.initSymbolIterator();return this.map[Symbol.iterator]()}},{key:"clear",value:function(){var a=this.map;0<a.size&&(a.forEach(this.unregister),a.clear(),this.changed.dispatch())}},{key:"values",value:function(){return this.map.values()}},{key:"keys",value:function(){return this.map.keys()}},{key:"disposed",value:function(){this.map.forEach(this.unregister);this.map.clear();
-d(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"size",get:function(){return this.map.size}}]);return b}(h.a)},function(h,f,a){var q=a(2);a.d(f,"h",function(){return q.s});a.d(f,"i",function(){return q.u});a.d(f,"f",function(){return q.n});a.d(f,"d",function(){return q.k});var p=a(312);a.d(f,"b",function(){return p.b});a.d(f,"a",function(){return p.a});var n=a(191);a.d(f,"e",function(){return n.b});var d=a(121);a.d(f,"c",function(){return d.c});a.d(f,
-"g",function(){return d.d})},function(h,f,a){f.a=function(a){if(!window.getSelection().isCollapsed)return!0;a=a.target.tagName;return"TEXTAREA"===a||"INPUT"===a?!0:!1};f.b=function(a,f){f=void 0===f?"text/plain":f;var d=!1,b=Object(q.c)(document,"copy",function(b){b.clipboardData.setData(f,a);d=!0;b.stopPropagation();b.preventDefault()},!0);try{document.execCommand("copy")}finally{b()}return d};var q=a(1)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
-}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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)}a.d(f,"a",function(){return g});
-a.d(f,"b",function(){return l});h=a(33);a=a(1);var d=function t(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return t(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&
-a(b.prototype,c);d&&a(b,d);return b}}();$jscomp.initSymbol();var c=Symbol("SingleTextureVolumeChunk.textureUnit");$jscomp.initSymbol();var e=Symbol("SingleTextureVolumeChunk.textureLayout"),g=function(a){function d(a){q(this,d);var b=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.shaderKey=a;return b}n(d,a);b(d,[{key:"defineShader",value:function(a){a.addTextureSampler2D("uVolumeChunkSampler",c)}},{key:"beginDrawing",value:function(a,b){var d=b.textureUnit(c);a.activeTexture(a.TEXTURE0+
-d);b[e]=null}},{key:"endDrawing",value:function(a,b){a.bindTexture(a.TEXTURE_2D,null);b[e]=null}},{key:"bindChunk",value:function(a,b,c){var d=c.textureLayout;b[e]!==d&&(b[e]=d,this.setupTextureLayout(a,b,d));a.bindTexture(a.TEXTURE_2D,c.texture)}},{key:"beginSource",value:function(a,b){}}]);return d}(a.a),l=function(a){function c(a,b){q(this,c);a=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,a,b));a.texture=null;a.data=b.data;return a}n(c,a);b(c,[{key:"copyToGPU",value:function(a){d(c.prototype.__proto__||
-Object.getPrototypeOf(c.prototype),"copyToGPU",this).call(this,a);var b=this.texture=a.createTexture();a.bindTexture(a.TEXTURE_2D,b);this.setTextureData(a);a.bindTexture(a.TEXTURE_2D,null)}},{key:"freeGPUMemory",value:function(a){d(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"freeGPUMemory",this).call(this,a);a.deleteTexture(this.texture);this.texture=null;this.textureLayout.dispose();this.textureLayout=null}}]);return c}(h.a)},function(h,f,a){f.a=function(a,f,h,d,b,c){for(var e=0,g=
-0,l=1,k=1,t=0;3>t;++t){var m=b[t],r=d[t],n=m%r;e+=Math.floor(m/r)*l;l*=Math.ceil(h[t]/r);g+=n*k;k*=r}d=f+2*e;h=a[d];d=a[d+1];b=h&16777215;h=h>>24&255;0<h&&(b+=c*(a[(f+d&16777215)+Math.floor(g*h/32)]>>g*h%32&(1<<h)-1));return b}},function(h,f,a){f.b=function(a,f){return function(h){h.style.flex=a;f(h)}};f.a=function(a,f){return function(h){h.style.display="flex";h.style.flexDirection=a;for(var d=$jscomp.makeIterator(f),b=d.next();!b.done;b=d.next()){b=b.value;var c=h.ownerDocument.createElement("div");
-h.appendChild(c);b(c)}}}},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,
-b):a.__proto__=b)}a.d(f,"a",function(){return k});var n=a(27);h=a(47);var d=a(26),b=a(32),c=a(186),e=a(326),g=a(331),l=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();a(332);var k=function(a){function k(a,b){if(!(this instanceof k))throw new TypeError("Cannot call a class as a function");var d=q(this,(k.__proto__||
-Object.getPrototypeOf(k)).call(this));d.manager=a;d.existingLayer=b;d.statusElement=document.createElement("div");d.submitElement=document.createElement("button");d.namePromptElement=document.createElement("label");d.nameInputElement=document.createElement("input");d.volumeCancellationSource=void 0;d.sourceValid=!1;d.nameValid=!0;var l=d.content;l.classList.add("add-layer-overlay");var f=document.createElement("form");f.className="source-form";d.registerEventListener(f,"submit",function(a){a.preventDefault();
-d.validateSource(!0)});var m=document.createElement("label");m.textContent="Source:";a=d.sourceInput=d.registerDisposer(new e.a({completer:function(a,b){return d.manager.dataSourceProvider.volumeCompleter(a,d.manager.chunkManager,b).then(function(a){return{completions:a.completions,makeElement:e.b,offset:a.offset,showSingleResult:!0}})},delay:0}));a.element.classList.add("add-layer-source");a.inputElement.addEventListener("blur",function(){d.validateSource(!1)});d.submitElement.disabled=!0;a.inputChanged.add(function(){var a=
-d.volumeCancellationSource;void 0!==a&&(a.cancel(),d.volumeCancellationSource=void 0);d.sourceValid=!1;d.submitElement.disabled=!0;d.statusElement.textContent=""});f.appendChild(m);f.appendChild(a.element);Object(c.a)(m,a.inputElement);m=Object(g.a)();f.appendChild(m);l.appendChild(f);var h=d.statusElement,t=d.namePromptElement,r=d.nameInputElement;f=d.submitElement;h.className="dialog-status";m=document.createElement("form");m.className="name-form";t.textContent="Name:";r.className="add-layer-name";
-r.autocomplete="off";r.spellcheck=!1;r.type="text";d.registerEventListener(r,"input",function(){d.validateName()});f.type="submit";Object(c.a)(t,r);m.appendChild(t);m.appendChild(r);m.appendChild(f);l.appendChild(m);l.appendChild(h);void 0!==b?(void 0!==b.sourceUrl?(a.value=b.sourceUrl,d.validateSource()):d.sourceValid=!0,a.disabled=!0,r.value=b.name,d.validateName(),f.textContent="Save",r.focus()):(b=d.manager.layerManager.managedLayers,0<b.length&&(b=b[b.length-1],b instanceof n.b&&(b=b.sourceUrl,
-void 0!==b&&(l=d.manager.dataSourceProvider.findSourceGroup(b),a.value=b.substring(0,l),a.inputElement.setSelectionRange(0,l)))),a.inputElement.focus(),f.textContent="Add Layer");d.registerEventListener(m,"submit",function(a){a.preventDefault();d.submit()});return d}p(k,a);l(k,[{key:"isNameValid",value:function(){var a=this.nameInputElement.value;if(""===a)return!1;a=this.manager.layerManager.getLayerByName(a);return void 0===a||a===this.existingLayer}},{key:"submit",value:function(){this.sourceValid&&
-this.isNameValid()&&(this.existingLayer?(this.existingLayer.name=this.nameInputElement.value,this.manager.layerManager.layersChanged.dispatch()):this.manager.add(this.manager.getLayer(this.nameInputElement.value,this.sourceInput.value)),this.dispose())}},{key:"validateName",value:function(){var a=this.nameInputElement;(this.nameValid=this.isNameValid())?(a.classList.add("valid-input"),a.classList.remove("invalid-input")):(a.classList.remove("valid-input"),a.classList.add("invalid-input"));this.validityChanged()}},
-{key:"validityChanged",value:function(){this.submitElement.disabled=!(this.nameValid&&this.sourceValid)}},{key:"validateSource",value:function(a){var c=this;a=void 0===a?!1:a;var e=this.sourceInput.value;if(""!==e){try{var g=this.manager.dataSourceProvider.suggestLayerName(e),k=this.nameInputElement;if(""===this.nameInputElement.value){var l=this.manager.layerManager.getUniqueLayerName(g);k.value=l;k.setSelectionRange(0,l.length);this.validateName()}a&&k.focus()}catch(z){this.setError(z.message);
-return}this.setInfo("Validating volume source...");var f=this.volumeCancellationSource=new b.b;this.manager.dataSourceProvider.getVolume(this.manager.chunkManager,e,void 0,f).then(function(a){f.isCanceled||(c.volumeCancellationSource=void 0,c.sourceValid=!0,c.setInfo(d.c[a.volumeType].toLowerCase()+": "+(a.numChannels+"-channel "+d.a[a.dataType].toLowerCase())),c.validityChanged())}).catch(function(a){f.isCanceled||(c.volumeCancellationSource=void 0,c.setError(a.message))})}}},{key:"setInfo",value:function(a){this.statusElement.className=
-"dialog-status dialog-status-info";this.statusElement.textContent=a}},{key:"setError",value:function(a){this.statusElement.className="dialog-status dialog-status-error";this.statusElement.textContent=a}}]);return k}(h.a)},function(h,f,a){f.a=function(a,f){""===f.id&&(f.id="unique-id-for-association-"+q++);a.setAttribute("for",f.id)};var q=0},function(h,f,a){f.a=function(a){var f=-1;return Object.assign(function(){-1===f&&(f=requestAnimationFrame(function(){f=-1;a()}))},{flush:function(){-1!==f&&(f=
--1,a())},cancel:function(){-1!==f&&(cancelAnimationFrame(f),f=-1)}})}},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function p(a,b){var c=document.documentElement.scrollTop+Math.min(document.documentElement.clientHeight-
-a.offsetHeight,b.clientY);a.style.left=document.documentElement.scrollLeft+Math.min(document.documentElement.clientWidth-a.offsetWidth,b.clientX)+"px";a.style.top=c+"px";a.style.visibility=null}a.d(f,"a",function(){return e});var n=a(1),d=a(8),b=a(7),c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();a(338);
-var e=function(a){function e(a){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var c=(e.__proto__||Object.getPrototypeOf(e)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");c=!c||"object"!==typeof c&&"function"!==typeof c?this:c;c.element=document.createElement("div");c.parentDisposers=new Map;c.disabledValue=!1;c.opened=new b.a;c.closed=new b.a;var d=c.element;d.className="neuroglancer-context-menu";d.style.visibility=
-"hidden";d.tabIndex=-1;document.body.appendChild(d);void 0!==a&&c.registerParent(a);return c}q(e,a);c(e,[{key:"registerParent",value:function(a){var b=this,c=this.parentDisposers;c.has(a)||c.set(a,Object(n.c)(a,"contextmenu",function(a){b.show(a);a.stopPropagation();a.preventDefault()}))}},{key:"show",value:function(a){var b=this;if(!this.disabledValue){this.hide();var c=this.element,d=Object(n.c)(document,"mousedown",function(a){a.target instanceof Node&&!c.contains(a.target)&&b.hide()},!0),e=Object(n.c)(document,
-"keydown",function(a){"Escape"===a.code&&b.hide()},!0);c.style.display=null;c.style.visibility="hidden";this.opened.dispatch();p(c,a);this.menuDisposer=function(){e();d();c.style.display="none"}}}},{key:"unregisterParent",value:function(a){var b=this.parentDisposers,c=b.get(a);void 0!==c&&(c(),b.delete(a))}},{key:"disposed",value:function(){for(var a=this.parentDisposers,b=$jscomp.makeIterator(a.values()),c=b.next();!c.done;c=b.next())c=c.value,c();a.clear();Object(d.b)(this.element)}},{key:"hide",
-value:function(){void 0!==this.menuDisposer&&(this.menuDisposer(),this.menuDisposer=void 0,this.closed.dispatch())}},{key:"disabled",get:function(){return this.disabledValue},set:function(a){this.disabledValue!==a&&(this.disabledValue=a)&&this.hide()}},{key:"open",get:function(){return void 0!==this.menuDisposer}}]);return e}(n.a)},function(h,f,a){f.a=function(a,d){var b=Object(q.c)(a,"drop",function(a){a.preventDefault();if(-1!==a.dataTransfer.types.indexOf(p.d)){var b=JSON.parse(a.dataTransfer.getData(p.d));
-d.restoreState(b);a.stopPropagation()}}),c=Object(q.c)(a,"dragover",function(a){-1!==a.dataTransfer.types.indexOf(p.d)&&(a.dataTransfer.dropEffect="link",a.preventDefault(),a.stopPropagation())});return function(){c();b()}};var q=a(1),p=a(120)},function(h,f,a){(function(a){function f(b,e,g,l){function c(a){var c=f(b,e);if(!c||c.to.line-c.from.line<m)return null;for(var d=b.findMarksAt(c.from),g=0;g<d.length;++g)if(d[g].__isFold&&"fold"!==l){if(!a)return null;c.cleared=!0;d[g].clear()}return c}if(g&&
-g.call){var f=g;g=null}else f=d(b,g,"rangeFinder");"number"==typeof e&&(e=a.Pos(e,0));var m=d(b,g,"minFoldSize"),r=c(!0);if(d(b,g,"scanUp"))for(;!r&&e.line>b.firstLine();)e=a.Pos(e.line-1,0),r=c(!1);if(r&&!r.cleared&&"unfold"!==l){var n=h(b,g);a.on(n,"mousedown",function(b){p.clear();a.e_preventDefault(b)});var p=b.markText(r.from,r.to,{replacedWith:n,clearOnEnter:d(b,g,"clearOnEnter"),__isFold:!0});p.on("clear",function(c,d){a.signal(b,"unfold",b,c,d)});a.signal(b,"fold",b,r.from,r.to)}}function h(a,
-b){a=d(a,b,"widget");"string"==typeof a?(b=document.createTextNode(a),a=document.createElement("span"),a.appendChild(b),a.className="CodeMirror-foldmarker"):a&&(a=a.cloneNode(!0));return a}function d(a,d,g){return d&&void 0!==d[g]?d[g]:(a=a.options.foldOptions)&&void 0!==a[g]?a[g]:b[g]}a.newFoldFunction=function(a,b){return function(c,d){f(c,d,{rangeFinder:a,widget:b})}};a.defineExtension("foldCode",function(a,b,d){f(this,a,b,d)});a.defineExtension("isFolded",function(a){a=this.findMarksAt(a);for(var b=
-0;b<a.length;++b)if(a[b].__isFold)return!0});a.commands.toggleFold=function(a){a.foldCode(a.getCursor())};a.commands.fold=function(a){a.foldCode(a.getCursor(),null,"fold")};a.commands.unfold=function(a){a.foldCode(a.getCursor(),null,"unfold")};a.commands.foldAll=function(b){b.operation(function(){for(var c=b.firstLine(),d=b.lastLine();c<=d;c++)b.foldCode(a.Pos(c,0),null,"fold")})};a.commands.unfoldAll=function(b){b.operation(function(){for(var c=b.firstLine(),d=b.lastLine();c<=d;c++)b.foldCode(a.Pos(c,
-0),null,"unfold")})};a.registerHelper("fold","combine",function(){var a=Array.prototype.slice.call(arguments,0);return function(b,c){for(var d=0;d<a.length;++d){var e=a[d](b,c);if(e)return e}}});a.registerHelper("fold","auto",function(a,b){for(var c=a.getHelpers(b,"fold"),d=0;d<c.length;d++){var e=c[d](a,b);if(e)return e}});var b={rangeFinder:a.fold.auto,widget:"\u2194",minFoldSize:0,scanUp:!1,clearOnEnter:!0};a.defineOption("foldOptions",null);a.defineExtension("foldOption",function(a,b){return d(this,
-a,b)})})(a(48))},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=
-b)}a.d(f,"a",function(){return w});var n=a(2),d=a(80),b=a(22),c=a(82),e=a(360),g=a(29),l=a(192),k=a(35),t=a(9),m=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),r=function x(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==
-a)return x(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},u=n.s.create(),v=n.k.create();f.b="perpspectiveRenderEvent";var w=function(a){function f(a,g,m,h){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var r=q(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,a,g,m));r.config=h;r.planarSlices=new Set;r.transparentPlaneRenderHelper=r.registerDisposer(e.b.get(r.gl,c.c));r.scaleBarWidget=r.registerDisposer(new l.a);Object(b.c)(g,
-"nehuba-translate-via-mouse-drag",function(a){Object(d.a)(a.detail,function(a,b,c){if(r.config.layout.useNehubaPerspective.enableShiftDrag){a=r.width;var d=r.height,e=r.viewer.navigationState.position,g=e.spatialCoordinates;n.s.transformMat4(u,g,r.projectionMat);u[0]=2*b/a;u[1]=-2*c/d;n.s.transformMat4(g,u,r.inverseProjectionMat);e.changed.dispatch()}})});a=h.layout.useNehubaPerspective.removePerspectiveSlicesBackground;r.nehubaSliceViewRenderHelper=r.registerDisposer(e.a.get(r.gl,c.c,a&&a.mode||
-"none"));r.registerDisposer(r.visibility.changed.add(function(){return Array.from(r.sliceViews.keys()).forEach(function(a){return a.visibility.value=r.visibility.value})}));a=r.scaleBarWidget.element;r.registerDisposer(new k.a(Object(t.g)(function(a,b){return a&&b},m.showScaleBar,m.orthographicProjection),a));g.appendChild(a);return r}p(f,a);m(f,[{key:"updateProjectionMatrix",value:function(){r(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"updateProjectionMatrix",this).call(this);this.config.layout.useNehubaPerspective.centerToOrigin&&
-(n.k.translate(this.projectionMat,this.projectionMat,this.navigationState.position.spatialCoordinates),n.k.invert(this.inverseProjectionMat,this.projectionMat))}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.planarSlices),b=a.next();!b.done;b=a.next())b.value.dispose();this.planarSlices.clear();r(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}},{key:"draw",value:function(){for(var a=$jscomp.makeIterator(this.sliceViews.keys()),b=a.next();!b.done;b=
-a.next())b.value.visibility.value=this.config.layout.useNehubaPerspective.disablePerspectiveSlicesPreloading?this.viewer.showSliceViews.value&&this.visibility.visible?g.b.VISIBLE:g.b.IGNORED:this.visibility.value;if(this.navigationState.valid){this.onResize();a=this.width;var d=this.height;if(0!==a&&0!==d){b=this.viewer.showSliceViews.value;for(var e=$jscomp.makeIterator(this.sliceViews),k=e.next();!k.done;k=e.next()){k=$jscomp.makeIterator(k.value);var l=k.next().value;(k.next().value||b)&&l.updateRendering()}e=
-$jscomp.makeIterator(this.planarSlices);for(b=e.next();!b.done;b=e.next())b.value.updateRendering();b=this.gl;this.offscreenFramebuffer.bind(a,d);b.disable(b.SCISSOR_TEST);e=this.config.layout.useNehubaPerspective;e=e.perspectiveBackground||e.perspectiveSlicesBackground||this.viewer.crossSectionBackgroundColor.value;this.gl.clearColor(e[0],e[1],e[2],1);b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);b.enable(b.DEPTH_TEST);e=this.projectionMat;this.updateProjectionMatrix();k=n.s.create();Object(n.p)(k,
-n.e[2],this.modelViewMat);n.s.normalize(k,k);l=this.pickIDs;l.clear();e={dataToDevice:e,lightDirection:k,ambientLighting:.2,directionalLighting:.8,pickIDs:l,emitter:c.c,emitColor:!0,emitPickID:!0,alreadyEmittedPickID:!1,viewportWidth:a,viewportHeight:d,extra:{config:this.config,showSliceViewsCheckboxValue:this.viewer.showSliceViews.value,slicesPose:this.viewer.slicesNavigationState.pose,perspectiveNavigationState:this.viewer.navigationState,meshesLoaded:-1,meshFragmentsLoaded:-1,crossSectionBackground:this.viewer.crossSectionBackgroundColor.value}};
-k=this.visibleLayerTracker.getVisibleLayers();for(var f=l=!1,m=$jscomp.makeIterator(k),h=m.next();!h.done;h=m.next())h=h.value,h.isTransparent?l=!0:h.isAnnotation?f=!0:h.draw(e);this.config.layout.useNehubaPerspective.waitForMesh&&!e.extra.meshRendered||this.drawSliceViews(e);if(f){b.enable(WebGL2RenderingContext.BLEND);b.depthFunc(WebGL2RenderingContext.LEQUAL);b.blendFunc(WebGL2RenderingContext.SRC_ALPHA,WebGL2RenderingContext.ONE_MINUS_SRC_ALPHA);b.drawBuffers([b.COLOR_ATTACHMENT0,b.NONE,b.NONE]);
-e.emitPickID=!1;f=$jscomp.makeIterator(k);for(h=f.next();!h.done;h=f.next())h=h.value,h.isAnnotation&&h.draw(e);b.depthFunc(WebGL2RenderingContext.LESS);b.disable(WebGL2RenderingContext.BLEND);b.drawBuffers([b.COLOR_ATTACHMENT0,b.COLOR_ATTACHMENT1,b.COLOR_ATTACHMENT2]);e.emitPickID=!0}h=this.config.layout.useNehubaPerspective.disableAxisLinesInPerspective;this.viewer.showAxisLines.value&&!h&&this.drawAxisLines();if(l){b.depthMask(!1);b.enable(WebGL2RenderingContext.BLEND);l=this.transparentConfiguration;
-l.bind(a,d);this.gl.clearColor(0,0,0,1);b.clear(WebGL2RenderingContext.COLOR_BUFFER_BIT);e.emitter=c.d;b.blendFuncSeparate(WebGL2RenderingContext.ONE,WebGL2RenderingContext.ONE,WebGL2RenderingContext.ZERO,WebGL2RenderingContext.ONE_MINUS_SRC_ALPHA);e.emitPickID=!1;f=$jscomp.makeIterator(k);for(h=f.next();!h.done;h=f.next())h=h.value,h.isTransparent&&h.draw(e);b.disable(WebGL2RenderingContext.DEPTH_TEST);this.offscreenFramebuffer.bindSingle(c.a.COLOR);b.blendFunc(WebGL2RenderingContext.ONE_MINUS_SRC_ALPHA,
-WebGL2RenderingContext.SRC_ALPHA);this.transparencyCopyHelper.draw(l.colorBuffers[0].texture,l.colorBuffers[1].texture);b.depthMask(!0);b.disable(WebGL2RenderingContext.BLEND);b.enable(WebGL2RenderingContext.DEPTH_TEST);this.offscreenFramebuffer.bind(a,d)}b.drawBuffers([b.NONE,b.COLOR_ATTACHMENT1,b.COLOR_ATTACHMENT2]);e.emitter=c.c;e.emitPickID=!0;e.emitColor=!1;b.enable(WebGL2RenderingContext.POLYGON_OFFSET_FILL);b.polygonOffset(-1,-1);d=$jscomp.makeIterator(k);for(h=d.next();!h.done;h=d.next())k=
-h.value,e.alreadyEmittedPickID=!k.isTransparent&&!k.isAnnotation,k.draw(e);b.disable(WebGL2RenderingContext.POLYGON_OFFSET_FILL);this.viewer.showScaleBar.value&&this.viewer.orthographicProjection.value&&(d=this.scaleBarWidget.dimensions,d.targetLengthInPixels=Math.min(a/4,100),d.nanometersPerPixel=this.nanometersPerPixel,this.scaleBarWidget.update());this.offscreenFramebuffer.unbind();this.setGLViewport();this.offscreenCopyHelper.draw(this.offscreenFramebuffer.colorBuffers[c.a.COLOR].texture);a=new CustomEvent("perpspectiveRenderEvent",
-{bubbles:!0,detail:{meshesLoaded:e.extra.meshesLoaded,meshFragmentsLoaded:e.extra.meshFragmentsLoaded,lastLoadedMeshId:e.extra.lastMeshId}});this.element.dispatchEvent(a)}}}},{key:"drawSliceViews",value:function(a){var b=this.config.layout.useNehubaPerspective,c=this.sliceViewRenderHelper,d=this.nehubaSliceViewRenderHelper,e=this.transparentPlaneRenderHelper,g=a.lightDirection,k=a.ambientLighting,l=a.directionalLighting;a=a.dataToDevice;var f=this.viewer.showSliceViews.value;if(!b.hideImages){var m=
-b.removePerspectiveSlicesBackground;c=m?d:c;for(var h=$jscomp.makeIterator(this.sliceViews),t=h.next();!t.done;t=h.next()){var r=$jscomp.makeIterator(t.value);t=r.next().value;if((r.next().value||f)&&0!==t.width&&0!==t.height&&t.hasValidViewport){r=Math.abs(n.s.dot(g,t.viewportAxes[2]));r=k+r*l;var p=v;n.k.identity(p);p[0]=t.width/2;p[5]=-t.height/2;n.k.multiply(p,t.viewportToData,p);n.k.multiply(p,a,p);var q=n.u.create(),u=b.perspectiveSlicesBackground||this.viewer.crossSectionBackgroundColor.value;
-q[0]=u[0];q[1]=u[1];q[2]=u[2];q[3]=1;d.setDiscardColor(m&&m.color||q);c.draw(t.offscreenFramebuffer.colorBuffers[0].texture,p,n.u.fromValues(r,r,r,1),q,0,0,1,1)}}}if(b.drawSubstrates&&f)for(d=b.fixedZoomPerspectiveSlices&&b.fixedZoomPerspectiveSlices.sliceViewportSizeMultiplier||1,g=$jscomp.makeIterator(this.sliceViews.keys()),k=g.next();!k.done;k=g.next()){c=k.value;k=v;n.k.identity(k);k[0]=c.width/2/d;k[5]=-c.height/2/d;n.k.multiply(k,c.viewportToData,k);l=n.k.clone(a);m=n.s.clone(this.navigationState.position.spatialCoordinates);
-c=n.s.clone(c.viewportAxes[2]);h=this.viewer.slicesNavigationState.pose.orientation.orientation;t=n.n.invert(n.n.create(),h);n.s.transformQuat(c,c,t);n.s.transformQuat(m,m,t);t=n.s.create();for(r=0;3>r;r++)t[r]=0===Math.round(c[r])?-m[r]:0;n.s.transformQuat(t,t,h);n.k.translate(l,l,t);n.k.multiply(k,l,k);l=b.drawSubstrates.color||n.u.fromValues(0,0,1,.2);e.draw(k,l,{factor:3,units:1})}if(b.drawZoomLevels&&f&&(f=b.drawZoomLevels.cutOff)&&this.viewer.slicesNavigationState.zoomFactor.value<f)for(f=$jscomp.makeIterator(this.planarSlices),
-k=f.next();!k.done;k=f.next())g=k.value,d=v,n.k.identity(d),d[0]=g.width/2,d[5]=-g.height/2,n.k.multiply(d,g.viewportToData,d),n.k.multiply(d,a,d),g=b.drawZoomLevels.color||n.u.fromValues(1,0,0,.2),e.draw(d,g,{factor:-1,units:1})}},{key:"zoomByMouse",value:function(a){r(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"zoomByMouse",this).call(this,a);if(a=this.config.layout.useNehubaPerspective.restrictZoomLevel)a.minZoom&&this.navigationState.zoomFactor.value<a.minZoom&&(this.navigationState.zoomFactor.value=
-a.minZoom),a.maxZoom&&this.navigationState.zoomFactor.value>a.maxZoom&&(this.navigationState.zoomFactor.value=a.maxZoom)}}]);return f}(c.b)},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return b});
-h=a(1);var p=a(53),n=a(8),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();a(361);var b=function(a){function b(a){a=void 0===a?new p.a:a;if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var c=(b.__proto__||Object.getPrototypeOf(b)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-c=!c||"object"!==typeof c&&"function"!==typeof c?this:c;c.dimensions=a;c.element=document.createElement("div");c.textNode=document.createTextNode("");c.barElement=document.createElement("div");a=c.element;var d=c.textNode,e=c.barElement;a.className="scale-bar-container";a.appendChild(d);a.appendChild(e);e.className="scale-bar";return c}q(b,a);d(b,[{key:"update",value:function(){var a=this.dimensions;a.update()&&(this.textNode.textContent=a.physicalLength+" "+a.physicalUnit,this.barElement.style.width=
-a.lengthInPixels+"px")}},{key:"disposed",value:function(){Object(n.b)(this.element)}}]);return b}(h.a)},function(h,f,a){function q(a){if(!a[m]){a.registerDisposer(a.layerManager.layersChanged.add(function(){for(var b=!1,c=new g.b(g.s.fromValues(Infinity,Infinity,Infinity),g.s.fromValues(-Infinity,-Infinity,-Infinity)),d=$jscomp.makeIterator(a.layerManager.managedLayers),e=d.next();!e.done;e=d.next())if(e=e.value.layer,null!=e){e=$jscomp.makeIterator(e.renderLayers);for(var k=e.next();!k.done;k=e.next())k=
-k.value.boundingBox,null!=k&&(g.s.min(c.lower,c.lower,k.lower),g.s.max(c.upper,c.upper,k.upper),b=!0)}b&&(a.navigationState.position[t]=c);b&&(a.navigationState.pose[t]=c);b&&a.navigationState.position.changed.dispatch()}));var b=a.navigationState.position,c=b.changed.dispatch;b.changed.dispatch=function(){var a=b[t];if(a){var d=b.spatialCoordinates;g.s.min(d,d,a.upper);g.s.max(d,d,a.lower)}c()};a[m]=!0}}function p(a){d(a,function(a){a=a.displayState;a.segmentColorHash instanceof k.a||(a.segmentColorHash=
-k.a.from(a.segmentColorHash))})}function n(a,b){var c=a.display.onResize;a.display.onResize=function(){if(b.dedebounceUpdates){this.scheduleRedraw();for(var a=$jscomp.makeIterator(this.panels),d=a.next();!d.done;d=a.next())d.value.onResize()}else c.call(this)}}function d(a,c){b(a,c);var d=a.layerManager;d.registerDisposer(d.layersChanged.add(function(){b(a,c)}))}function b(a,b){a.layerManager.managedLayers.map(function(a){return a.layer}).filter(function(a){return!!a}).filter(function(a){return a instanceof
-l.SegmentationUserLayer}).map(function(a){return a}).forEach(function(a){b(a)})}function c(a,b){$jscomp.initSymbol();var c=Symbol("customEvent");a.addEventListener("wheel",function(a){if(!a[c]&&b.zoomWithoutCtrl){a.stopImmediatePropagation();a.stopPropagation();a.preventDefault();var d=new Proxy(a,{get:function(a,b){if("ctrlKey"===b)return!a[b];b=a[b];return"function"===typeof b?b.bind(a):b}});d=new WheelEvent(a.type,d);d[c]=!0;a.target.dispatchEvent(d)}},!0)}function e(a,b){a.addEventListener("mousedown",
-function(a){b.rightClickWithCtrl&&2===a.button&&!a.ctrlKey&&(a.stopImmediatePropagation(),a.stopPropagation(),a.preventDefault())},!0)}f.a=function(a,b){b.restrictUserNavigation&&q(a);b.globals&&b.globals.useCustomSegmentColors&&p(a);b.globals&&b.globals.useNehubaLayout&&(a.inputEventBindings.sliceView.set("at:shift+mousedown0",{action:"nehuba-rotate-via-mouse-drag",stopPropagation:!0}),b.layout&&b.layout.useNehubaPerspective&&a.inputEventBindings.perspectiveView.set("at:shift+mousedown0",{action:"nehuba-translate-via-mouse-drag",
-stopPropagation:!0}));b.dedebounceUpdates&&n(a,b)};f.b=function(a,b){c(a,b);e(a,b)};f.e=q;f.d=function(a){a.displayState.segmentSelectionState.set(null);a.displayState.segmentSelectionState.set=function(){}};f.c=function(a){a.displayState.segmentSelectionState.isSelected=function(){return!1}};var g=a(2),l=a(65),k=a(122);$jscomp.initSymbol();var t=Symbol("bbox");$jscomp.initSymbol();var m=Symbol("hooked")},function(h,f,a){h.exports=a(364)},function(h,f,a){f.isObject=function(a){return null!=a&&"object"===
-typeof a}},function(h,f,a){var q=this&&this.__extends||function(a,f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(d){a.call(this);this.errors=d;d=Error.call(this,d?d.length+" errors occurred during unsubscription:\n  "+d.map(function(a,c){return c+1+") "+a.toString()}).join("\n  "):"");this.name=d.name="UnsubscriptionError";this.stack=d.stack;this.message=d.message}q(f,
-a);return f}(Error);f.UnsubscriptionError=h},function(h,f,a){f.empty={closed:!0,next:function(a){},error:function(a){throw a;},complete:function(){}}},function(h,f,a){var q=this&&this.__extends||function(a,f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(d,b){a.call(this);this.subject=d;this.subscriber=b;this.closed=!1}q(f,a);f.prototype.unsubscribe=function(){if(!this.closed){this.closed=
-!0;var a=this.subject,b=a.observers;this.subject=null;!b||0===b.length||a.isStopped||a.closed||(a=b.indexOf(this.subscriber),-1!==a&&b.splice(a,1))}};return f}(a(11).Subscription);f.SubjectSubscription=h},function(h,f,a){f.isArrayLike=function(a){return a&&"number"===typeof a.length}},function(h,f,a){f.isPromise=function(a){return a&&"function"!==typeof a.subscribe&&"function"===typeof a.then}},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&
-(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(36),n=a(199),d=a(200),b=a(202),c=a(387),e=a(38),g=a(388),l=a(68),k=a(0),t=a(127),m=a(87);h=function(a){function f(b,c){a.call(this,null);this.ish=b;this.scheduler=c}q(f,a);f.create=function(a,h){if(null!=a){if("function"===typeof a[m.observable])return a instanceof k.Observable&&!h?a:new f(a,h);if(p.isArray(a))return new e.ArrayObservable(a,h);if(d.isPromise(a))return new b.PromiseObservable(a,h);if("function"===
-typeof a[l.iterator]||"string"===typeof a)return new c.IteratorObservable(a,h);if(n.isArrayLike(a))return new g.ArrayLikeObservable(a,h)}throw new TypeError((null!==a&&typeof a||a)+" is not observable");};f.prototype._subscribe=function(a){var b=this.ish,c=this.scheduler;return null==c?b[m.observable]().subscribe(a):b[m.observable]().subscribe(new t.ObserveOnSubscriber(a,c,0))};return f}(k.Observable);f.FromObservable=h},function(h,f,a){function q(a){var b=a.value;a=a.subscriber;a.closed||(a.next(b),
-a.complete())}function p(a){var b=a.err;a=a.subscriber;a.closed||a.error(b)}var n=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)},d=a(16);h=function(a){function b(b,c){a.call(this);this.promise=b;this.scheduler=c}n(b,a);b.create=function(a,c){return new b(a,c)};b.prototype._subscribe=function(a){var b=this,c=this.promise,e=this.scheduler;if(null==e)this._isScalar?
-a.closed||(a.next(this.value),a.complete()):c.then(function(c){b.value=c;b._isScalar=!0;a.closed||(a.next(c),a.complete())},function(b){a.closed||a.error(b)}).then(null,function(a){d.root.setTimeout(function(){throw a;})});else if(this._isScalar){if(!a.closed)return e.schedule(q,0,{value:this.value,subscriber:a})}else c.then(function(c){b.value=c;b._isScalar=!0;a.closed||a.add(e.schedule(q,0,{value:c,subscriber:a}))},function(b){a.closed||a.add(e.schedule(p,0,{err:b,subscriber:a}))}).then(null,function(a){d.root.setTimeout(function(){throw a;
-})})};return b}(a(0).Observable);f.PromiseObservable=h},function(h,f,a){function q(){for(var a=[],e=0;e<arguments.length;e++)a[e-0]=arguments[e];e=Number.POSITIVE_INFINITY;var g=null,l=a[a.length-1];b.isScheduler(l)?(g=a.pop(),1<a.length&&"number"===typeof a[a.length-1]&&(e=a.pop())):"number"===typeof l&&(e=a.pop());return null===g&&1===a.length&&a[0]instanceof p.Observable?a[0]:(new n.ArrayObservable(a,g)).lift(new d.MergeAllOperator(e))}var p=a(0),n=a(38),d=a(90),b=a(37);f.merge=function(){for(var a=
-[],b=0;b<arguments.length;b++)a[b-0]=arguments[b];return this.lift.call(q.apply(void 0,[this].concat(a)))};f.mergeStatic=q},function(h,f,a){function q(){for(var a=[],b=0;b<arguments.length;b++)a[b-0]=arguments[b];if(1===a.length)if(n.isArray(a[0]))a=a[0];else return a[0];return(new d.ArrayObservable(a)).lift(new c)}var p=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,
-new c)},n=a(36),d=a(38);h=a(5);var b=a(6);f.race=function(){for(var a=[],b=0;b<arguments.length;b++)a[b-0]=arguments[b];1===a.length&&n.isArray(a[0])&&(a=a[0]);return this.lift.call(q.apply(void 0,[this].concat(a)))};f.raceStatic=q;var c=function(){function a(){}a.prototype.call=function(a,b){return b.subscribe(new e(a))};return a}();f.RaceOperator=c;var e=function(a){function c(b){a.call(this,b);this.hasFirst=!1;this.observables=[];this.subscriptions=[]}p(c,a);c.prototype._next=function(a){this.observables.push(a)};
-c.prototype._complete=function(){var a=this.observables,c=a.length;if(0===c)this.destination.complete();else{for(var d=0;d<c&&!this.hasFirst;d++){var e=a[d];e=b.subscribeToResult(this,e,e,d);this.subscriptions&&this.subscriptions.push(e);this.add(e)}this.observables=null}};c.prototype.notifyNext=function(a,b,c,d,e){if(!this.hasFirst){this.hasFirst=!0;for(a=0;a<this.subscriptions.length;a++)a!==c&&(d=this.subscriptions[a],d.unsubscribe(),this.remove(d));this.subscriptions=null}this.destination.next(b)};
-return c}(h.OuterSubscriber);f.RaceSubscriber=e},function(h,f,a){f.noop=function(){}},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(201),n=a(36);h=a(5);var d=a(6);f.onErrorResumeNext=function(){for(var a=[],c=0;c<arguments.length;c++)a[c-0]=arguments[c];1===a.length&&n.isArray(a[0])&&(a=a[0]);return this.lift(new b(a))};f.onErrorResumeNextStatic=
-function(){for(var a=[],c=0;c<arguments.length;c++)a[c-0]=arguments[c];1===a.length&&n.isArray(a[0])&&(a=a[0]);c=a.shift();return(new p.FromObservable(c,null)).lift(new b(a))};var b=function(){function a(a){this.nextSources=a}a.prototype.call=function(a,b){return b.subscribe(new c(a,this.nextSources))};return a}(),c=function(a){function b(b,c){a.call(this,b);this.destination=b;this.nextSources=c}q(b,a);b.prototype.notifyError=function(a,b){this.subscribeToNextSource()};b.prototype.notifyComplete=
-function(a){this.subscribeToNextSource()};b.prototype._error=function(a){this.subscribeToNextSource()};b.prototype._complete=function(){this.subscribeToNextSource()};b.prototype.subscribeToNextSource=function(){var a=this.nextSources.shift();a?this.add(d.subscribeToResult(this,a)):this.destination.complete()};return b}(h.OuterSubscriber)},function(h,f,a){function q(a,b){void 0===b&&(b=null);return new r({method:"GET",url:a,headers:b})}function p(a,b,c){return new r({method:"POST",url:a,body:b,headers:c})}
-function n(a,b){return new r({method:"DELETE",url:a,headers:b})}function d(a,b,c){return new r({method:"PUT",url:a,body:b,headers:c})}function b(a,b,c){return new r({method:"PATCH",url:a,body:b,headers:c})}function c(a,b){return(new r({method:"GET",url:a,responseType:"json",headers:b})).lift(new m.MapOperator(function(a,b){return a.response},null))}var e=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):
-(c.prototype=b.prototype,new c)},g=a(16),l=a(17),k=a(13);h=a(0);var t=a(3),m=a(129);f.ajaxGet=q;f.ajaxPost=p;f.ajaxDelete=n;f.ajaxPut=d;f.ajaxPatch=b;f.ajaxGetJSON=c;var r=function(a){function k(b){a.call(this);var c={async:!0,createXHR:function(){if(this.crossDomain)if(g.root.XMLHttpRequest)var a=new g.root.XMLHttpRequest;else if(g.root.XDomainRequest)a=new g.root.XDomainRequest;else throw Error("CORS is not supported by your browser");else if(g.root.XMLHttpRequest)a=new g.root.XMLHttpRequest;else{var b=
-void 0;try{for(var c=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],d=0;3>d;d++)try{b=c[d];new g.root.ActiveXObject(b);break}catch(L){}a=new g.root.ActiveXObject(b)}catch(L){throw Error("XMLHttpRequest is not supported by your browser");}}return a},crossDomain:!1,withCredentials:!1,headers:{},method:"GET",responseType:"json",timeout:0};if("string"===typeof b)c.url=b;else for(var d in b)b.hasOwnProperty(d)&&(c[d]=b[d]);this.request=c}e(k,a);k.prototype._subscribe=function(a){return new u(a,
-this.request)};k.create=function(){var a=function(a){return new k(a)};a.get=q;a.post=p;a.delete=n;a.put=d;a.patch=b;a.getJSON=c;return a}();return k}(h.Observable);f.AjaxObservable=r;var u=function(a){function b(b,c){a.call(this,b);this.request=c;this.done=!1;b=c.headers=c.headers||{};c.crossDomain||b["X-Requested-With"]||(b["X-Requested-With"]="XMLHttpRequest");"Content-Type"in b||g.root.FormData&&c.body instanceof g.root.FormData||"undefined"===typeof c.body||(b["Content-Type"]="application/x-www-form-urlencoded; charset=UTF-8");
-c.body=this.serializeBody(c.body,c.headers["Content-Type"]);this.send()}e(b,a);b.prototype.next=function(a){this.done=!0;var b=this.destination;a=new v(a,this.xhr,this.request);b.next(a)};b.prototype.send=function(){var a=this.request,b=this.request,c=b.user,d=b.method,e=b.url,g=b.async,f=b.password,m=b.headers;b=b.body;var h=l.tryCatch(a.createXHR).call(a);if(h===k.errorObject)this.error(k.errorObject.e);else{this.xhr=h;this.setupEvents(h,a);c=c?l.tryCatch(h.open).call(h,d,e,g,c,f):l.tryCatch(h.open).call(h,
-d,e,g);if(c===k.errorObject)return this.error(k.errorObject.e),null;g&&(h.timeout=a.timeout,h.responseType=a.responseType);"withCredentials"in h&&(h.withCredentials=!!a.withCredentials);this.setHeaders(h,m);c=b?l.tryCatch(h.send).call(h,b):l.tryCatch(h.send).call(h);if(c===k.errorObject)return this.error(k.errorObject.e),null}return h};b.prototype.serializeBody=function(a,b){if(!a||"string"===typeof a||g.root.FormData&&a instanceof g.root.FormData)return a;if(b){var c=b.indexOf(";");-1!==c&&(b=b.substring(0,
-c))}switch(b){case "application/x-www-form-urlencoded":return Object.keys(a).map(function(b){return encodeURI(b)+"="+encodeURI(a[b])}).join("&");case "application/json":return JSON.stringify(a);default:return a}};b.prototype.setHeaders=function(a,b){for(var c in b)b.hasOwnProperty(c)&&a.setRequestHeader(c,b[c])};b.prototype.setupEvents=function(a,b){function c(a){var b=c.subscriber,d=c.progressSubscriber,e=c.request;d&&d.error(a);b.error(new y(this,e))}function d(a){var b=d.subscriber,c=d.progressSubscriber,
-e=d.request;if(4===this.readyState){var g=1223===this.status?204:this.status,k="text"===this.responseType?this.response||this.responseText:this.response;0===g&&(g=k?200:0);200<=g&&300>g?(c&&c.complete(),b.next(a),b.complete()):(c&&c.error(a),b.error(new w("ajax error "+g,this,e)))}}var e=b.progressSubscriber;a.ontimeout=c;c.request=b;c.subscriber=this;c.progressSubscriber=e;if(a.upload&&"withCredentials"in a){if(e){var k=function(a){k.progressSubscriber.next(a)};g.root.XDomainRequest?a.onprogress=
-k:a.upload.onprogress=k;k.progressSubscriber=e}var l=function(a){var b=l.progressSubscriber,c=l.subscriber,d=l.request;b&&b.error(a);c.error(new w("ajax error",this,d))};a.onerror=l;l.request=b;l.subscriber=this;l.progressSubscriber=e}a.onreadystatechange=d;d.subscriber=this;d.progressSubscriber=e;d.request=b};b.prototype.unsubscribe=function(){var b=this.xhr;!this.done&&b&&4!==b.readyState&&"function"===typeof b.abort&&b.abort();a.prototype.unsubscribe.call(this)};return b}(t.Subscriber);f.AjaxSubscriber=
-u;var v=function(){return function(a,b,c){this.originalEvent=a;this.xhr=b;this.request=c;this.status=b.status;this.responseType=b.responseType||c.responseType;switch(this.responseType){case "json":this.response="response"in b?b.responseType?b.response:JSON.parse(b.response||b.responseText||"null"):JSON.parse(b.responseText||"null");break;case "xml":this.response=b.responseXML;break;default:this.response="response"in b?b.response:b.responseText}}}();f.AjaxResponse=v;var w=function(a){function b(b,
-c,d){a.call(this,b);this.message=b;this.xhr=c;this.request=d;this.status=c.status}e(b,a);return b}(Error);f.AjaxError=w;var y=function(a){function b(b,c){a.call(this,"ajax timeout",b,c)}e(b,a);return b}(w);f.AjaxTimeoutError=y},function(h,f,a){h=a(441);a=a(442);f.queue=new a.QueueScheduler(h.QueueAction)},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,
-new b)},p=a(6);h=a(5);f.mergeMap=function(a,c,d){void 0===d&&(d=Number.POSITIVE_INFINITY);"number"===typeof c&&(d=c,c=null);return this.lift(new n(a,c,d))};var n=function(){function a(a,b,d){void 0===d&&(d=Number.POSITIVE_INFINITY);this.project=a;this.resultSelector=b;this.concurrent=d}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.project,this.resultSelector,this.concurrent))};return a}();f.MergeMapOperator=n;var d=function(a){function b(b,c,d,k){void 0===k&&(k=Number.POSITIVE_INFINITY);
-a.call(this,b);this.project=c;this.resultSelector=d;this.concurrent=k;this.hasCompleted=!1;this.buffer=[];this.index=this.active=0}q(b,a);b.prototype._next=function(a){this.active<this.concurrent?this._tryNext(a):this.buffer.push(a)};b.prototype._tryNext=function(a){var b=this.index++;try{var c=this.project(a,b)}catch(k){this.destination.error(k);return}this.active++;this._innerSub(c,a,b)};b.prototype._innerSub=function(a,b,c){this.add(p.subscribeToResult(this,a,b,c))};b.prototype._complete=function(){this.hasCompleted=
-!0;0===this.active&&0===this.buffer.length&&this.destination.complete()};b.prototype.notifyNext=function(a,b,c,d,f){this.resultSelector?this._notifyResultSelector(a,b,c,d):this.destination.next(b)};b.prototype._notifyResultSelector=function(a,b,c,d){try{var e=this.resultSelector(a,b,c,d)}catch(m){this.destination.error(m);return}this.destination.next(e)};b.prototype.notifyComplete=function(a){var b=this.buffer;this.remove(a);this.active--;0<b.length?this._next(b.shift()):0===this.active&&this.hasCompleted&&
-this.destination.complete()};return b}(h.OuterSubscriber);f.MergeMapSubscriber=d},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(5);var p=a(6);f.mergeMapTo=function(a,c,d){void 0===d&&(d=Number.POSITIVE_INFINITY);"number"===typeof c&&(d=c,c=null);return this.lift(new n(a,c,d))};var n=function(){function a(a,b,d){void 0===d&&(d=Number.POSITIVE_INFINITY);
-this.ish=a;this.resultSelector=b;this.concurrent=d}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.ish,this.resultSelector,this.concurrent))};return a}();f.MergeMapToOperator=n;var d=function(a){function b(b,c,d,k){void 0===k&&(k=Number.POSITIVE_INFINITY);a.call(this,b);this.ish=c;this.resultSelector=d;this.concurrent=k;this.hasCompleted=!1;this.buffer=[];this.index=this.active=0}q(b,a);b.prototype._next=function(a){if(this.active<this.concurrent){var b=this.resultSelector,c=this.index++,
-d=this.ish,e=this.destination;this.active++;this._innerSub(d,e,b,a,c)}else this.buffer.push(a)};b.prototype._innerSub=function(a,b,c,d,f){this.add(p.subscribeToResult(this,a,d,f))};b.prototype._complete=function(){this.hasCompleted=!0;0===this.active&&0===this.buffer.length&&this.destination.complete()};b.prototype.notifyNext=function(a,b,c,d,f){f=this.destination;this.resultSelector?this.trySelectResult(a,b,c,d):f.next(b)};b.prototype.trySelectResult=function(a,b,c,d){var e=this.resultSelector,g=
-this.destination;try{var k=e(a,b,c,d)}catch(u){g.error(u);return}g.next(k)};b.prototype.notifyError=function(a){this.destination.error(a)};b.prototype.notifyComplete=function(a){var b=this.buffer;this.remove(a);this.active--;0<b.length?this._next(b.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()};return b}(h.OuterSubscriber);f.MergeMapToSubscriber=d},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&
-(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);var p=a(17),n=a(13);f.distinctUntilChanged=function(a,b){return this.lift(new d(a,b))};var d=function(){function a(a,b){this.compare=a;this.keySelector=b}a.prototype.call=function(a,c){return c.subscribe(new b(a,this.compare,this.keySelector))};return a}(),b=function(a){function b(b,c,d){a.call(this,b);this.keySelector=d;this.hasKey=!1;"function"===typeof c&&(this.compare=c)}q(b,a);b.prototype.compare=function(a,
-b){return a===b};b.prototype._next=function(a){var b=a;if(this.keySelector&&(b=p.tryCatch(this.keySelector)(a),b===n.errorObject))return this.destination.error(n.errorObject.e);var c=!1;if(this.hasKey){if(c=p.tryCatch(this.compare)(this.key,b),c===n.errorObject)return this.destination.error(n.errorObject.e)}else this.hasKey=!0;!1===!!c&&(this.key=b,this.destination.next(a))};return b}(h.Subscriber)},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&
-(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);f.filter=function(a,b){return this.lift(new p(a,b))};var p=function(){function a(a,c){this.predicate=a;this.thisArg=c}a.prototype.call=function(a,c){return c.subscribe(new n(a,this.predicate,this.thisArg))};return a}(),n=function(a){function b(b,d,g){a.call(this,b);this.predicate=d;this.thisArg=g;this.count=0}q(b,a);b.prototype._next=function(a){try{var b=this.predicate.call(this.thisArg,a,this.count++)}catch(g){this.destination.error(g);
-return}b&&this.destination.next(a)};return b}(h.Subscriber)},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);f.find=function(a,b){if("function"!==typeof a)throw new TypeError("predicate is not a function");return this.lift(new p(a,this,!1,b))};var p=function(){function a(a,c,d,g){this.predicate=a;this.source=c;this.yieldIndex=d;this.thisArg=
-g}a.prototype.call=function(a,c){return c.subscribe(new n(a,this.predicate,this.source,this.yieldIndex,this.thisArg))};return a}();f.FindValueOperator=p;var n=function(a){function b(b,d,g,l,k){a.call(this,b);this.predicate=d;this.source=g;this.yieldIndex=l;this.thisArg=k;this.index=0}q(b,a);b.prototype.notifyComplete=function(a){var b=this.destination;b.next(a);b.complete()};b.prototype._next=function(a){var b=this.predicate,c=this.thisArg,d=this.index++;try{b.call(c||this,a,d,this.source)&&this.notifyComplete(this.yieldIndex?
-d:a)}catch(k){this.destination.error(k)}};b.prototype._complete=function(){this.notifyComplete(this.yieldIndex?-1:void 0)};return b}(h.Subscriber);f.FindValueSubscriber=n},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(12);var p=a(0),n=a(3),d=a(11);a=function(a){function e(b,c){a.call(this);this.source=b;this.subjectFactory=c;this._refCount=
-0;this._isComplete=!1}q(e,a);e.prototype._subscribe=function(a){return this.getSubject().subscribe(a)};e.prototype.getSubject=function(){var a=this._subject;if(!a||a.isStopped)this._subject=this.subjectFactory();return this._subject};e.prototype.connect=function(){var a=this._connection;a||(this._isComplete=!1,a=this._connection=new d.Subscription,a.add(this.source.subscribe(new b(this.getSubject(),this))),a.closed?(this._connection=null,a=d.Subscription.EMPTY):this._connection=a);return a};e.prototype.refCount=
-function(){return this.lift(new c(this))};return e}(p.Observable);f.ConnectableObservable=a;a=a.prototype;f.connectableObservableDescriptor={operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:a._subscribe},_isComplete:{value:a._isComplete,writable:!0},getSubject:{value:a.getSubject},connect:{value:a.connect},refCount:{value:a.refCount}};var b=function(a){function b(b,c){a.call(this,b);this.connectable=c}q(b,
-a);b.prototype._error=function(b){this._unsubscribe();a.prototype._error.call(this,b)};b.prototype._complete=function(){this.connectable._isComplete=!0;this._unsubscribe();a.prototype._complete.call(this)};b.prototype._unsubscribe=function(){var a=this.connectable;if(a){this.connectable=null;var b=a._connection;a._refCount=0;a._subject=null;a._connection=null;b&&b.unsubscribe()}};return b}(h.SubjectSubscriber),c=function(){function a(a){this.connectable=a}a.prototype.call=function(a,b){var c=this.connectable;
-c._refCount++;a=new e(a,c);b=b.subscribe(a);a.closed||(a.connection=c.connect());return b};return a}(),e=function(a){function b(b,c){a.call(this,b);this.connectable=c}q(b,a);b.prototype._unsubscribe=function(){var a=this.connectable;if(a){this.connectable=null;var b=a._refCount;0>=b?this.connection=null:(a._refCount=b-1,1<b?this.connection=null:(b=this.connection,a=a._connection,this.connection=null,!a||b&&a!==b||a.unsubscribe()))}else this.connection=null};return b}(n.Subscriber)},function(h,f,a){var q=
-this&&this.__extends||function(a,d){function b(){this.constructor=a}for(var c in d)d.hasOwnProperty(c)&&(a[c]=d[c]);a.prototype=null===d?Object.create(d):(b.prototype=d.prototype,new b)};h=a(12);var p=a(88);a=function(a){function d(b){a.call(this);this._value=b}q(d,a);Object.defineProperty(d.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0});d.prototype._subscribe=function(b){var c=a.prototype._subscribe.call(this,b);c&&!c.closed&&b.next(this._value);return c};
-d.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new p.ObjectUnsubscribedError;return this._value};d.prototype.next=function(b){a.prototype.next.call(this,this._value=b)};return d}(h.Subject);f.BehaviorSubject=a},function(h,f,a){h=a(593);a=a(597);f.asap=new a.AsapScheduler(h.AsapAction)},function(h,f,a){(function(h){function p(a,c){this._id=a;this._clearFn=c}var n="undefined"!==typeof h&&h||"undefined"!==typeof self&&self||window,d=Function.prototype.apply;
-f.setTimeout=function(){return new p(d.call(setTimeout,n,arguments),clearTimeout)};f.setInterval=function(){return new p(d.call(setInterval,n,arguments),clearInterval)};f.clearTimeout=f.clearInterval=function(a){a&&a.close()};p.prototype.unref=p.prototype.ref=function(){};p.prototype.close=function(){this._clearFn.call(n,this._id)};f.enroll=function(a,c){clearTimeout(a._idleTimeoutId);a._idleTimeout=c};f.unenroll=function(a){clearTimeout(a._idleTimeoutId);a._idleTimeout=-1};f._unrefActive=f.active=
-function(a){clearTimeout(a._idleTimeoutId);var b=a._idleTimeout;0<=b&&(a._idleTimeoutId=setTimeout(function(){a._onTimeout&&a._onTimeout()},b))};a(595);f.setImmediate="undefined"!==typeof self&&self.setImmediate||"undefined"!==typeof h&&h.setImmediate||this&&this.setImmediate;f.clearImmediate="undefined"!==typeof self&&self.clearImmediate||"undefined"!==typeof h&&h.clearImmediate||this&&this.clearImmediate}).call(f,a(74))},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=
-a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(5);var p=a(6);f.defaultThrottleConfig={leading:!0,trailing:!1};f.throttle=function(a,c){void 0===c&&(c=f.defaultThrottleConfig);return this.lift(new n(a,c.leading,c.trailing))};var n=function(){function a(a,b,d){this.durationSelector=a;this.leading=b;this.trailing=d}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.durationSelector,this.leading,this.trailing))};
-return a}(),d=function(a){function b(b,c,d,k){a.call(this,b);this.destination=b;this.durationSelector=c;this._leading=d;this._trailing=k;this._hasTrailingValue=!1}q(b,a);b.prototype._next=function(a){if(this.throttled)this._trailing&&(this._hasTrailingValue=!0,this._trailingValue=a);else{var b=this.tryDurationSelector(a);b&&this.add(this.throttled=p.subscribeToResult(this,b));this._leading&&(this.destination.next(a),this._trailing&&(this._hasTrailingValue=!0,this._trailingValue=a))}};b.prototype.tryDurationSelector=
-function(a){try{return this.durationSelector(a)}catch(g){return this.destination.error(g),null}};b.prototype._unsubscribe=function(){var a=this.throttled;this._trailingValue=null;this._hasTrailingValue=!1;a&&(this.remove(a),this.throttled=null,a.unsubscribe())};b.prototype._sendTrailing=function(){var a=this.destination,b=this._trailing,c=this._trailingValue,d=this._hasTrailingValue;this.throttled&&b&&d&&(a.next(c),this._trailingValue=null,this._hasTrailingValue=!1)};b.prototype.notifyNext=function(a,
-b,c,d,f){this._sendTrailing();this._unsubscribe()};b.prototype.notifyComplete=function(){this._sendTrailing();this._unsubscribe()};return b}(h.OuterSubscriber)},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);var p=a(19);f.timeInterval=function(a){void 0===a&&(a=p.async);return this.lift(new d(a))};var n=function(){return function(a,
-b){this.value=a;this.interval=b}}();f.TimeInterval=n;var d=function(){function a(a){this.scheduler=a}a.prototype.call=function(a,c){return c.subscribe(new b(a,this.scheduler))};return a}(),b=function(a){function b(b,c){a.call(this,b);this.scheduler=c;this.lastTime=0;this.lastTime=c.now()}q(b,a);b.prototype._next=function(a){var b=this.scheduler.now(),c=b-this.lastTime;this.lastTime=b;this.destination.next(new n(a,c))};return b}(h.Subscriber)},function(h,f,a){var q=this&&this.__extends||function(a,
-f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(){var d=a.call(this,"Timeout has occurred");this.name=d.name="TimeoutError";this.stack=d.stack;this.message=d.message}q(f,a);return f}(Error);f.TimeoutError=h},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):
-(c.prototype=b.prototype,new c)};h=a(3);var p=a(19);f.timestamp=function(a){void 0===a&&(a=p.async);return this.lift(new d(a))};var n=function(){return function(a,b){this.value=a;this.timestamp=b}}();f.Timestamp=n;var d=function(){function a(a){this.scheduler=a}a.prototype.call=function(a,c){return c.subscribe(new b(a,this.scheduler))};return a}(),b=function(a){function b(b,c){a.call(this,b);this.scheduler=c}q(b,a);b.prototype._next=function(a){var b=this.scheduler.now();this.destination.next(new n(a,
-b))};return b}(h.Subscriber)},function(h,f,a){var q=a(223);h=function(){function a(){this.subscriptions=[]}a.prototype.logSubscribedFrame=function(){this.subscriptions.push(new q.SubscriptionLog(this.scheduler.now()));return this.subscriptions.length-1};a.prototype.logUnsubscribedFrame=function(a){var d=this.subscriptions;d[a]=new q.SubscriptionLog(d[a].subscribedFrame,this.scheduler.now())};return a}();f.SubscriptionLoggable=h},function(h,f,a){h=function(){return function(a,f){void 0===f&&(f=Number.POSITIVE_INFINITY);
-this.subscribedFrame=a;this.unsubscribedFrame=f}}();f.SubscriptionLog=h},function(h,f,a){f.applyMixins=function(a,f){for(var h=0,d=f.length;h<d;h++)for(var b=f[h],c=Object.getOwnPropertyNames(b.prototype),e=0,g=c.length;e<g;e++){var l=c[e];a.prototype[l]=b.prototype[l]}}},function(h,f,a){var q=this&&this.__extends||function(a,d){function b(){this.constructor=a}for(var c in d)d.hasOwnProperty(c)&&(a[c]=d[c]);a.prototype=null===d?Object.create(d):(b.prototype=d.prototype,new b)};h=a(70);a=function(a){function d(b,
-c){var d=this;void 0===b&&(b=p);void 0===c&&(c=Number.POSITIVE_INFINITY);a.call(this,b,function(){return d.frame});this.maxFrames=c;this.frame=0;this.index=-1}q(d,a);d.prototype.flush=function(){for(var a=this.actions,c=this.maxFrames,d,g;(g=a.shift())&&(this.frame=g.delay)<=c&&!(d=g.execute(g.state,g.delay)););if(d){for(;g=a.shift();)g.unsubscribe();throw d;}};d.frameTimeFactor=10;return d}(a(71).AsyncScheduler);f.VirtualTimeScheduler=a;var p=function(a){function d(b,c,d){void 0===d&&(d=b.index+=
-1);a.call(this,b,c);this.scheduler=b;this.work=c;this.index=d;this.active=!0;this.index=b.index=d}q(d,a);d.prototype.schedule=function(b,c){void 0===c&&(c=0);if(!this.id)return a.prototype.schedule.call(this,b,c);this.active=!1;var e=new d(this.scheduler,this.work);this.add(e);return e.schedule(b,c)};d.prototype.requestAsyncId=function(a,c,e){void 0===e&&(e=0);this.delay=a.frame+e;a=a.actions;a.push(this);a.sort(d.sortActions);return!0};d.prototype.recycleAsyncId=function(a,c,d){};d.prototype._execute=
-function(b,c){if(!0===this.active)return a.prototype._execute.call(this,b,c)};d.sortActions=function(a,c){return a.delay===c.delay?a.index===c.index?0:a.index>c.index?1:-1:a.delay>c.delay?1:-1};return d}(h.AsyncAction);f.VirtualAction=p},function(h,f,a){a(131);a(267);a(270);a(106);a(271);a(153);a(273);a(154);a(275);a(157);a(276);a(158);a(278);a(159);a(280);a(281);a(282);a(107);a(294);a(65);a(176);a(305);h.exports=a(309)},function(h,f,a){a(34)},function(h,f,a){a(34)},function(h,f,a){function q(a,b,
-c){var d=b[0],g=b[1],l=b[2],k=b[3],f=b[4],h=b[5],r=b[6],n=b[7],p=b[8],q=b[9],y=b[10],x=b[11],A=b[12],z=b[13],D=b[14];b=b[15];var E=c[0],G=c[1],C=c[2],B=c[3];a[0]=E*d+G*f+C*p+B*A;a[1]=E*g+G*h+C*q+B*z;a[2]=E*l+G*r+C*y+B*D;a[3]=E*k+G*n+C*x+B*b;E=c[4];G=c[5];C=c[6];B=c[7];a[4]=E*d+G*f+C*p+B*A;a[5]=E*g+G*h+C*q+B*z;a[6]=E*l+G*r+C*y+B*D;a[7]=E*k+G*n+C*x+B*b;E=c[8];G=c[9];C=c[10];B=c[11];a[8]=E*d+G*f+C*p+B*A;a[9]=E*g+G*h+C*q+B*z;a[10]=E*l+G*r+C*y+B*D;a[11]=E*k+G*n+C*x+B*b;E=c[12];G=c[13];C=c[14];B=c[15];
-a[12]=E*d+G*f+C*p+B*A;a[13]=E*g+G*h+C*q+B*z;a[14]=E*l+G*r+C*y+B*D;a[15]=E*k+G*n+C*x+B*b;return a}function p(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];a[3]=b[3]-c[3];a[4]=b[4]-c[4];a[5]=b[5]-c[5];a[6]=b[6]-c[6];a[7]=b[7]-c[7];a[8]=b[8]-c[8];a[9]=b[9]-c[9];a[10]=b[10]-c[10];a[11]=b[11]-c[11];a[12]=b[12]-c[12];a[13]=b[13]-c[13];a[14]=b[14]-c[14];a[15]=b[15]-c[15];return a}Object.defineProperty(f,"__esModule",{value:!0});f.create=function(){var a=new n.a(16);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=
-0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.clone=function(a){var b=new n.a(16);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return b};f.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=
-b[15];return a};f.fromValues=function(a,b,c,e,g,l,k,f,h,r,p,q,w,y,x,A){var d=new n.a(16);d[0]=a;d[1]=b;d[2]=c;d[3]=e;d[4]=g;d[5]=l;d[6]=k;d[7]=f;d[8]=h;d[9]=r;d[10]=p;d[11]=q;d[12]=w;d[13]=y;d[14]=x;d[15]=A;return d};f.set=function(a,b,c,e,g,l,k,f,h,r,n,p,q,y,x,A,z){a[0]=b;a[1]=c;a[2]=e;a[3]=g;a[4]=l;a[5]=k;a[6]=f;a[7]=h;a[8]=r;a[9]=n;a[10]=p;a[11]=q;a[12]=y;a[13]=x;a[14]=A;a[15]=z;return a};f.identity=function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=
-0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.transpose=function(a,b){if(a===b){var c=b[1],d=b[2],g=b[3],l=b[6],k=b[7],f=b[11];a[1]=b[4];a[2]=b[8];a[3]=b[12];a[4]=c;a[6]=b[9];a[7]=b[13];a[8]=d;a[9]=l;a[11]=b[14];a[12]=g;a[13]=k;a[14]=f}else a[0]=b[0],a[1]=b[4],a[2]=b[8],a[3]=b[12],a[4]=b[1],a[5]=b[5],a[6]=b[9],a[7]=b[13],a[8]=b[2],a[9]=b[6],a[10]=b[10],a[11]=b[14],a[12]=b[3],a[13]=b[7],a[14]=b[11],a[15]=b[15];return a};f.invert=function(a,b){var c=b[0],d=b[1],g=b[2],l=b[3],k=b[4],f=b[5],h=b[6],r=
-b[7],n=b[8],p=b[9],q=b[10],y=b[11],x=b[12],A=b[13],z=b[14];b=b[15];var D=c*f-d*k,E=c*h-g*k,G=c*r-l*k,C=d*h-g*f,B=d*r-l*f,F=g*r-l*h,L=n*A-p*x,J=n*z-q*x,O=n*b-y*x,M=p*z-q*A,P=p*b-y*A,N=q*b-y*z,S=D*N-E*P+G*M+C*O-B*J+F*L;if(!S)return null;S=1/S;a[0]=(f*N-h*P+r*M)*S;a[1]=(g*P-d*N-l*M)*S;a[2]=(A*F-z*B+b*C)*S;a[3]=(q*B-p*F-y*C)*S;a[4]=(h*O-k*N-r*J)*S;a[5]=(c*N-g*O+l*J)*S;a[6]=(z*G-x*F-b*E)*S;a[7]=(n*F-q*G+y*E)*S;a[8]=(k*P-f*O+r*L)*S;a[9]=(d*O-c*P-l*L)*S;a[10]=(x*B-A*G+b*D)*S;a[11]=(p*G-n*B-y*D)*S;a[12]=
-(f*J-k*M-h*L)*S;a[13]=(c*M-d*J+g*L)*S;a[14]=(A*E-x*C-z*D)*S;a[15]=(n*C-p*E+q*D)*S;return a};f.adjoint=function(a,b){var c=b[0],d=b[1],g=b[2],l=b[3],k=b[4],f=b[5],h=b[6],r=b[7],n=b[8],p=b[9],q=b[10],y=b[11],x=b[12],A=b[13],z=b[14];b=b[15];a[0]=f*(q*b-y*z)-p*(h*b-r*z)+A*(h*y-r*q);a[1]=-(d*(q*b-y*z)-p*(g*b-l*z)+A*(g*y-l*q));a[2]=d*(h*b-r*z)-f*(g*b-l*z)+A*(g*r-l*h);a[3]=-(d*(h*y-r*q)-f*(g*y-l*q)+p*(g*r-l*h));a[4]=-(k*(q*b-y*z)-n*(h*b-r*z)+x*(h*y-r*q));a[5]=c*(q*b-y*z)-n*(g*b-l*z)+x*(g*y-l*q);a[6]=-(c*
-(h*b-r*z)-k*(g*b-l*z)+x*(g*r-l*h));a[7]=c*(h*y-r*q)-k*(g*y-l*q)+n*(g*r-l*h);a[8]=k*(p*b-y*A)-n*(f*b-r*A)+x*(f*y-r*p);a[9]=-(c*(p*b-y*A)-n*(d*b-l*A)+x*(d*y-l*p));a[10]=c*(f*b-r*A)-k*(d*b-l*A)+x*(d*r-l*f);a[11]=-(c*(f*y-r*p)-k*(d*y-l*p)+n*(d*r-l*f));a[12]=-(k*(p*z-q*A)-n*(f*z-h*A)+x*(f*q-h*p));a[13]=c*(p*z-q*A)-n*(d*z-g*A)+x*(d*q-g*p);a[14]=-(c*(f*z-h*A)-k*(d*z-g*A)+x*(d*h-g*f));a[15]=c*(f*q-h*p)-k*(d*q-g*p)+n*(d*h-g*f);return a};f.determinant=function(a){var b=a[0],c=a[1],d=a[2],g=a[3],l=a[4],k=a[5],
-f=a[6],h=a[7],r=a[8],n=a[9],p=a[10],q=a[11],y=a[12],x=a[13],A=a[14];a=a[15];return(b*k-c*l)*(p*a-q*A)-(b*f-d*l)*(n*a-q*x)+(b*h-g*l)*(n*A-p*x)+(c*f-d*k)*(r*a-q*y)-(c*h-g*k)*(r*A-p*y)+(d*h-g*f)*(r*x-n*y)};f.multiply=q;f.translate=function(a,b,c){var d=c[0],g=c[1];c=c[2];if(b===a)a[12]=b[0]*d+b[4]*g+b[8]*c+b[12],a[13]=b[1]*d+b[5]*g+b[9]*c+b[13],a[14]=b[2]*d+b[6]*g+b[10]*c+b[14],a[15]=b[3]*d+b[7]*g+b[11]*c+b[15];else{var l=b[0];var k=b[1];var f=b[2];var h=b[3];var r=b[4];var n=b[5];var p=b[6];var q=b[7];
-var y=b[8];var x=b[9];var A=b[10];var z=b[11];a[0]=l;a[1]=k;a[2]=f;a[3]=h;a[4]=r;a[5]=n;a[6]=p;a[7]=q;a[8]=y;a[9]=x;a[10]=A;a[11]=z;a[12]=l*d+r*g+y*c+b[12];a[13]=k*d+n*g+x*c+b[13];a[14]=f*d+p*g+A*c+b[14];a[15]=h*d+q*g+z*c+b[15]}return a};f.scale=function(a,b,c){var d=c[0],g=c[1];c=c[2];a[0]=b[0]*d;a[1]=b[1]*d;a[2]=b[2]*d;a[3]=b[3]*d;a[4]=b[4]*g;a[5]=b[5]*g;a[6]=b[6]*g;a[7]=b[7]*g;a[8]=b[8]*c;a[9]=b[9]*c;a[10]=b[10]*c;a[11]=b[11]*c;a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a};f.rotate=
-function(a,b,c,e){var d=e[0],l=e[1];e=e[2];var k=Math.sqrt(d*d+l*l+e*e);if(Math.abs(k)<n.b)return null;k=1/k;d*=k;l*=k;e*=k;var f=Math.sin(c);var h=Math.cos(c);var r=1-h;c=b[0];k=b[1];var p=b[2];var q=b[3];var w=b[4];var y=b[5];var x=b[6];var A=b[7];var z=b[8];var D=b[9];var E=b[10];var G=b[11];var C=d*d*r+h;var B=l*d*r+e*f;var F=e*d*r-l*f;var L=d*l*r-e*f;var J=l*l*r+h;var O=e*l*r+d*f;var M=d*e*r+l*f;d=l*e*r-d*f;l=e*e*r+h;a[0]=c*C+w*B+z*F;a[1]=k*C+y*B+D*F;a[2]=p*C+x*B+E*F;a[3]=q*C+A*B+G*F;a[4]=c*
-L+w*J+z*O;a[5]=k*L+y*J+D*O;a[6]=p*L+x*J+E*O;a[7]=q*L+A*J+G*O;a[8]=c*M+w*d+z*l;a[9]=k*M+y*d+D*l;a[10]=p*M+x*d+E*l;a[11]=q*M+A*d+G*l;b!==a&&(a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);return a};f.rotateX=function(a,b,c){var d=Math.sin(c);c=Math.cos(c);var g=b[4],l=b[5],k=b[6],f=b[7],h=b[8],r=b[9],n=b[10],p=b[11];b!==a&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[4]=g*c+h*d;a[5]=l*c+r*d;a[6]=k*c+n*d;a[7]=f*c+p*d;a[8]=h*c-g*d;a[9]=r*c-l*d;a[10]=n*
-c-k*d;a[11]=p*c-f*d;return a};f.rotateY=function(a,b,c){var d=Math.sin(c);c=Math.cos(c);var g=b[0],l=b[1],k=b[2],f=b[3],h=b[8],r=b[9],n=b[10],p=b[11];b!==a&&(a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[0]=g*c-h*d;a[1]=l*c-r*d;a[2]=k*c-n*d;a[3]=f*c-p*d;a[8]=g*d+h*c;a[9]=l*d+r*c;a[10]=k*d+n*c;a[11]=f*d+p*c;return a};f.rotateZ=function(a,b,c){var d=Math.sin(c);c=Math.cos(c);var g=b[0],l=b[1],k=b[2],f=b[3],h=b[4],r=b[5],n=b[6],p=b[7];b!==a&&(a[8]=b[8],a[9]=
-b[9],a[10]=b[10],a[11]=b[11],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[0]=g*c+h*d;a[1]=l*c+r*d;a[2]=k*c+n*d;a[3]=f*c+p*d;a[4]=h*c-g*d;a[5]=r*c-l*d;a[6]=n*c-k*d;a[7]=p*c-f*d;return a};f.fromTranslation=function(a,b){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=b[0];a[13]=b[1];a[14]=b[2];a[15]=1;return a};f.fromScaling=function(a,b){a[0]=b[0];a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b[1];a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=b[2];a[11]=0;a[12]=0;a[13]=0;a[14]=
-0;a[15]=1;return a};f.fromRotation=function(a,b,c){var d=c[0],g=c[1];c=c[2];var l=Math.sqrt(d*d+g*g+c*c);if(Math.abs(l)<n.b)return null;l=1/l;d*=l;g*=l;c*=l;l=Math.sin(b);b=Math.cos(b);var k=1-b;a[0]=d*d*k+b;a[1]=g*d*k+c*l;a[2]=c*d*k-g*l;a[3]=0;a[4]=d*g*k-c*l;a[5]=g*g*k+b;a[6]=c*g*k+d*l;a[7]=0;a[8]=d*c*k+g*l;a[9]=g*c*k-d*l;a[10]=c*c*k+b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.fromXRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b;a[6]=c;a[7]=
-0;a[8]=0;a[9]=-c;a[10]=b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.fromYRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=0;a[2]=-c;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=c;a[9]=0;a[10]=b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.fromZRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=c;a[2]=0;a[3]=0;a[4]=-c;a[5]=b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.fromRotationTranslation=function(a,b,c){var d=
-b[0],g=b[1],l=b[2],k=b[3],f=d+d,h=g+g,r=l+l;b=d*f;var n=d*h;d*=r;var p=g*h;g*=r;l*=r;f*=k;h*=k;k*=r;a[0]=1-(p+l);a[1]=n+k;a[2]=d-h;a[3]=0;a[4]=n-k;a[5]=1-(b+l);a[6]=g+f;a[7]=0;a[8]=d+h;a[9]=g-f;a[10]=1-(b+p);a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a};f.getTranslation=function(a,b){a[0]=b[12];a[1]=b[13];a[2]=b[14];return a};f.getScaling=function(a,b){var c=b[0],d=b[1],g=b[2],l=b[4],k=b[5],f=b[6],h=b[8],r=b[9];b=b[10];a[0]=Math.sqrt(c*c+d*d+g*g);a[1]=Math.sqrt(l*l+k*k+f*f);a[2]=Math.sqrt(h*
-h+r*r+b*b);return a};f.getRotation=function(a,b){var c=b[0]+b[5]+b[10];0<c?(c=2*Math.sqrt(c+1),a[3]=.25*c,a[0]=(b[6]-b[9])/c,a[1]=(b[8]-b[2])/c,a[2]=(b[1]-b[4])/c):b[0]>b[5]&b[0]>b[10]?(c=2*Math.sqrt(1+b[0]-b[5]-b[10]),a[3]=(b[6]-b[9])/c,a[0]=.25*c,a[1]=(b[1]+b[4])/c,a[2]=(b[8]+b[2])/c):b[5]>b[10]?(c=2*Math.sqrt(1+b[5]-b[0]-b[10]),a[3]=(b[8]-b[2])/c,a[0]=(b[1]+b[4])/c,a[1]=.25*c,a[2]=(b[6]+b[9])/c):(c=2*Math.sqrt(1+b[10]-b[0]-b[5]),a[3]=(b[1]-b[4])/c,a[0]=(b[8]+b[2])/c,a[1]=(b[6]+b[9])/c,a[2]=.25*
-c);return a};f.fromRotationTranslationScale=function(a,b,c,e){var d=b[0],l=b[1],k=b[2],f=b[3],h=d+d,r=l+l,n=k+k;b=d*h;var p=d*r;d*=n;var q=l*r;l*=n;k*=n;h*=f;r*=f;f*=n;n=e[0];var y=e[1];e=e[2];a[0]=(1-(q+k))*n;a[1]=(p+f)*n;a[2]=(d-r)*n;a[3]=0;a[4]=(p-f)*y;a[5]=(1-(b+k))*y;a[6]=(l+h)*y;a[7]=0;a[8]=(d+r)*e;a[9]=(l-h)*e;a[10]=(1-(b+q))*e;a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a};f.fromRotationTranslationScaleOrigin=function(a,b,c,e,g){var d=b[0],k=b[1],f=b[2],h=b[3],r=d+d,n=k+k,p=f+
-f;b=d*r;var q=d*n;d*=p;var y=k*n;k*=p;f*=p;r*=h;n*=h;h*=p;p=e[0];var x=e[1];e=e[2];var A=g[0],z=g[1];g=g[2];a[0]=(1-(y+f))*p;a[1]=(q+h)*p;a[2]=(d-n)*p;a[3]=0;a[4]=(q-h)*x;a[5]=(1-(b+f))*x;a[6]=(k+r)*x;a[7]=0;a[8]=(d+n)*e;a[9]=(k-r)*e;a[10]=(1-(b+y))*e;a[11]=0;a[12]=c[0]+A-(a[0]*A+a[4]*z+a[8]*g);a[13]=c[1]+z-(a[1]*A+a[5]*z+a[9]*g);a[14]=c[2]+g-(a[2]*A+a[6]*z+a[10]*g);a[15]=1;return a};f.fromQuat=function(a,b){var c=b[0],d=b[1],g=b[2];b=b[3];var l=c+c,k=d+d,f=g+g;c*=l;var h=d*l;d*=k;var r=g*l,n=g*k;
-g*=f;l*=b;k*=b;b*=f;a[0]=1-d-g;a[1]=h+b;a[2]=r-k;a[3]=0;a[4]=h-b;a[5]=1-c-g;a[6]=n+l;a[7]=0;a[8]=r+k;a[9]=n-l;a[10]=1-c-d;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.frustum=function(a,b,c,e,g,l,k){var d=1/(c-b),f=1/(g-e),h=1/(l-k);a[0]=2*l*d;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=2*l*f;a[6]=0;a[7]=0;a[8]=(c+b)*d;a[9]=(g+e)*f;a[10]=(k+l)*h;a[11]=-1;a[12]=0;a[13]=0;a[14]=k*l*2*h;a[15]=0;return a};f.perspective=function(a,b,c,e,g){b=1/Math.tan(b/2);var d=1/(e-g);a[0]=b/c;a[1]=0;a[2]=0;a[3]=0;a[4]=
-0;a[5]=b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=(g+e)*d;a[11]=-1;a[12]=0;a[13]=0;a[14]=2*g*e*d;a[15]=0;return a};f.perspectiveFromFieldOfView=function(a,b,c,e){var d=Math.tan(b.upDegrees*Math.PI/180),l=Math.tan(b.downDegrees*Math.PI/180),k=Math.tan(b.leftDegrees*Math.PI/180);b=Math.tan(b.rightDegrees*Math.PI/180);var f=2/(k+b),h=2/(d+l);a[0]=f;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=h;a[6]=0;a[7]=0;a[8]=-((k-b)*f*.5);a[9]=(d-l)*h*.5;a[10]=e/(c-e);a[11]=-1;a[12]=0;a[13]=0;a[14]=e*c/(c-e);a[15]=0;return a};f.ortho=
-function(a,b,c,e,g,l,k){var d=1/(b-c),f=1/(e-g),h=1/(l-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]=(b+c)*d;a[13]=(g+e)*f;a[14]=(k+l)*h;a[15]=1;return a};f.lookAt=function(a,b,c,e){var d=b[0],l=b[1];b=b[2];var k=e[0];var f=e[1];var h=e[2];var r=c[0];e=c[1];var p=c[2];if(Math.abs(d-r)<n.b&&Math.abs(l-e)<n.b&&Math.abs(b-p)<n.b)return mat4.identity(a);c=d-r;e=l-e;r=b-p;var q=1/Math.sqrt(c*c+e*e+r*r);c*=q;e*=q;r*=q;p=f*r-h*e;h=h*c-k*r;k=k*e-f*
-c;(q=Math.sqrt(p*p+h*h+k*k))?(q=1/q,p*=q,h*=q,k*=q):k=h=p=0;f=e*k-r*h;var w=r*p-c*k;var y=c*h-e*p;(q=Math.sqrt(f*f+w*w+y*y))?(q=1/q,f*=q,w*=q,y*=q):y=w=f=0;a[0]=p;a[1]=f;a[2]=c;a[3]=0;a[4]=h;a[5]=w;a[6]=e;a[7]=0;a[8]=k;a[9]=y;a[10]=r;a[11]=0;a[12]=-(p*d+h*l+k*b);a[13]=-(f*d+w*l+y*b);a[14]=-(c*d+e*l+r*b);a[15]=1;return a};f.targetTo=function(a,b,c,e){var d=b[0],l=b[1];b=b[2];var k=e[0],f=e[1],h=e[2];e=d-c[0];var r=l-c[1];c=b-c[2];var n=e*e+r*r+c*c;0<n&&(n=1/Math.sqrt(n),e*=n,r*=n,c*=n);n=f*c-h*r;h=
-h*e-k*c;k=k*r-f*e;a[0]=n;a[1]=h;a[2]=k;a[3]=0;a[4]=r*k-c*h;a[5]=c*n-e*k;a[6]=e*h-r*n;a[7]=0;a[8]=e;a[9]=r;a[10]=c;a[11]=0;a[12]=d;a[13]=l;a[14]=b;a[15]=1;return a};f.str=function(a){return"mat4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+a[12]+", "+a[13]+", "+a[14]+", "+a[15]+")"};f.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],
-2)+Math.pow(a[7],2)+Math.pow(a[8],2)+Math.pow(a[9],2)+Math.pow(a[10],2)+Math.pow(a[11],2)+Math.pow(a[12],2)+Math.pow(a[13],2)+Math.pow(a[14],2)+Math.pow(a[15],2))};f.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];a[4]=b[4]+c[4];a[5]=b[5]+c[5];a[6]=b[6]+c[6];a[7]=b[7]+c[7];a[8]=b[8]+c[8];a[9]=b[9]+c[9];a[10]=b[10]+c[10];a[11]=b[11]+c[11];a[12]=b[12]+c[12];a[13]=b[13]+c[13];a[14]=b[14]+c[14];a[15]=b[15]+c[15];return a};f.subtract=p;f.multiplyScalar=function(a,b,c){a[0]=
-b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;a[4]=b[4]*c;a[5]=b[5]*c;a[6]=b[6]*c;a[7]=b[7]*c;a[8]=b[8]*c;a[9]=b[9]*c;a[10]=b[10]*c;a[11]=b[11]*c;a[12]=b[12]*c;a[13]=b[13]*c;a[14]=b[14]*c;a[15]=b[15]*c;return a};f.multiplyScalarAndAdd=function(a,b,c,e){a[0]=b[0]+c[0]*e;a[1]=b[1]+c[1]*e;a[2]=b[2]+c[2]*e;a[3]=b[3]+c[3]*e;a[4]=b[4]+c[4]*e;a[5]=b[5]+c[5]*e;a[6]=b[6]+c[6]*e;a[7]=b[7]+c[7]*e;a[8]=b[8]+c[8]*e;a[9]=b[9]+c[9]*e;a[10]=b[10]+c[10]*e;a[11]=b[11]+c[11]*e;a[12]=b[12]+c[12]*e;a[13]=b[13]+c[13]*e;a[14]=
-b[14]+c[14]*e;a[15]=b[15]+c[15]*e;return a};f.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]&&a[9]===b[9]&&a[10]===b[10]&&a[11]===b[11]&&a[12]===b[12]&&a[13]===b[13]&&a[14]===b[14]&&a[15]===b[15]};f.equals=function(a,b){var c=a[0],d=a[1],g=a[2],l=a[3],k=a[4],f=a[5],h=a[6],r=a[7],p=a[8],q=a[9],w=a[10],y=a[11],x=a[12],A=a[13],z=a[14];a=a[15];var D=b[0],E=b[1],G=b[2],C=b[3],B=b[4],F=b[5],L=b[6],J=b[7],
-O=b[8],M=b[9],P=b[10],N=b[11],S=b[12],U=b[13],Z=b[14];b=b[15];return Math.abs(c-D)<=n.b*Math.max(1,Math.abs(c),Math.abs(D))&&Math.abs(d-E)<=n.b*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(g-G)<=n.b*Math.max(1,Math.abs(g),Math.abs(G))&&Math.abs(l-C)<=n.b*Math.max(1,Math.abs(l),Math.abs(C))&&Math.abs(k-B)<=n.b*Math.max(1,Math.abs(k),Math.abs(B))&&Math.abs(f-F)<=n.b*Math.max(1,Math.abs(f),Math.abs(F))&&Math.abs(h-L)<=n.b*Math.max(1,Math.abs(h),Math.abs(L))&&Math.abs(r-J)<=n.b*Math.max(1,Math.abs(r),
-Math.abs(J))&&Math.abs(p-O)<=n.b*Math.max(1,Math.abs(p),Math.abs(O))&&Math.abs(q-M)<=n.b*Math.max(1,Math.abs(q),Math.abs(M))&&Math.abs(w-P)<=n.b*Math.max(1,Math.abs(w),Math.abs(P))&&Math.abs(y-N)<=n.b*Math.max(1,Math.abs(y),Math.abs(N))&&Math.abs(x-S)<=n.b*Math.max(1,Math.abs(x),Math.abs(S))&&Math.abs(A-U)<=n.b*Math.max(1,Math.abs(A),Math.abs(U))&&Math.abs(z-Z)<=n.b*Math.max(1,Math.abs(z),Math.abs(Z))&&Math.abs(a-b)<=n.b*Math.max(1,Math.abs(a),Math.abs(b))};var n=a(34);f.mul=q;f.sub=p},function(h,
-f,a){function q(){var a=new c.a(4);a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a}function p(a,b,c){c*=.5;var d=Math.sin(c);a[0]=d*b[0];a[1]=d*b[1];a[2]=d*b[2];a[3]=Math.cos(c);return a}function n(a,b,c){var d=b[0],e=b[1],g=b[2];b=b[3];var k=c[0],l=c[1],f=c[2];c=c[3];a[0]=d*c+b*k+e*f-g*l;a[1]=e*c+b*l+g*k-d*f;a[2]=g*c+b*f+d*l-e*k;a[3]=b*c-d*k-e*l-g*f;return a}function d(a,b,c,d){var e=b[0],g=b[1],k=b[2];b=b[3];var l=c[0],f=c[1],h=c[2];c=c[3];var m=e*l+g*f+k*h+b*c;0>m&&(m=-m,l=-l,f=-f,h=-h,c=-c);if(1E-6<1-m){var r=
-Math.acos(m);var t=Math.sin(r);m=Math.sin((1-d)*r)/t;d=Math.sin(d*r)/t}else m=1-d;a[0]=m*e+d*l;a[1]=m*g+d*f;a[2]=m*k+d*h;a[3]=m*b+d*c;return a}function b(a,b){var c=b[0]+b[4]+b[8];if(0<c)c=Math.sqrt(c+1),a[3]=.5*c,c=.5/c,a[0]=(b[5]-b[7])*c,a[1]=(b[6]-b[2])*c,a[2]=(b[1]-b[3])*c;else{var d=0;b[4]>b[0]&&(d=1);b[8]>b[3*d+d]&&(d=2);var e=(d+1)%3,g=(d+2)%3;c=Math.sqrt(b[3*d+d]-b[3*e+e]-b[3*g+g]+1);a[d]=.5*c;c=.5/c;a[3]=(b[3*e+g]-b[3*g+e])*c;a[e]=(b[3*e+d]+b[3*d+e])*c;a[g]=(b[3*g+d]+b[3*d+g])*c}return a}
-Object.defineProperty(f,"__esModule",{value:!0});f.create=q;f.identity=function(a){a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a};f.setAxisAngle=p;f.getAxisAngle=function(a,b){var c=2*Math.acos(b[3]),d=Math.sin(c/2);0!=d?(a[0]=b[0]/d,a[1]=b[1]/d,a[2]=b[2]/d):(a[0]=1,a[1]=0,a[2]=0);return c};f.multiply=n;f.rotateX=function(a,b,c){c*=.5;var d=b[0],e=b[1],g=b[2];b=b[3];var k=Math.sin(c);c=Math.cos(c);a[0]=d*c+b*k;a[1]=e*c+g*k;a[2]=g*c-e*k;a[3]=b*c-d*k;return a};f.rotateY=function(a,b,c){c*=.5;var d=b[0],e=b[1],
-g=b[2];b=b[3];var k=Math.sin(c);c=Math.cos(c);a[0]=d*c-g*k;a[1]=e*c+b*k;a[2]=g*c+d*k;a[3]=b*c-e*k;return a};f.rotateZ=function(a,b,c){c*=.5;var d=b[0],e=b[1],g=b[2];b=b[3];var k=Math.sin(c);c=Math.cos(c);a[0]=d*c+e*k;a[1]=e*c-d*k;a[2]=g*c+b*k;a[3]=b*c-g*k;return a};f.calculateW=function(a,b){var c=b[0],d=b[1];b=b[2];a[0]=c;a[1]=d;a[2]=b;a[3]=Math.sqrt(Math.abs(1-c*c-d*d-b*b));return a};f.slerp=d;f.invert=function(a,b){var c=b[0],d=b[1],e=b[2];b=b[3];var g=c*c+d*d+e*e+b*b;g=g?1/g:0;a[0]=-c*g;a[1]=
--d*g;a[2]=-e*g;a[3]=b*g;return a};f.conjugate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=b[3];return a};f.fromMat3=b;f.fromEuler=function(a,b,c,d){var e=.5*Math.PI/180;b*=e;c*=e;d*=e;e=Math.sin(b);b=Math.cos(b);var g=Math.sin(c);c=Math.cos(c);var k=Math.sin(d);d=Math.cos(d);a[0]=e*c*d-b*g*k;a[1]=b*g*d+e*c*k;a[2]=b*c*k-e*g*d;a[3]=b*c*d+e*g*k;return a};f.str=function(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};var c=a(34),e=a(133),g=a(134);h=a(135);f.clone=h.clone;f.fromValues=
-h.fromValues;f.copy=h.copy;f.set=h.set;f.add=h.add;f.mul=n;f.scale=h.scale;f.dot=h.dot;f.lerp=h.lerp;a=h.length;f.length=a;f.len=a;a=h.squaredLength;f.squaredLength=a;f.sqrLen=a;var l=h.normalize;f.normalize=l;f.exactEquals=h.exactEquals;f.equals=h.equals;h=function(){var a=g.create(),b=g.fromValues(1,0,0),c=g.fromValues(0,1,0);return function(d,e,k){var f=g.dot(e,k);if(-.999999>f)return g.cross(a,b,e),1E-6>g.len(a)&&g.cross(a,c,e),g.normalize(a,a),p(d,a,Math.PI),d;if(.999999<f)return d[0]=0,d[1]=
-0,d[2]=0,d[3]=1,d;g.cross(a,e,k);d[0]=a[0];d[1]=a[1];d[2]=a[2];d[3]=1+f;return l(d,d)}}();f.rotationTo=h;h=function(){var a=q(),b=q();return function(c,e,g,k,l,f){d(a,e,l,f);d(b,g,k,f);d(c,a,b,2*f*(1-f));return c}}();f.sqlerp=h;h=function(){var a=e.create();return function(c,d,e,g){a[0]=e[0];a[3]=e[1];a[6]=e[2];a[1]=g[0];a[4]=g[1];a[7]=g[2];a[2]=-d[0];a[5]=-d[1];a[8]=-d[2];return l(c,b(c,a))}}();f.setAxes=h},function(h,f,a){function q(){var a=new l.a(2);a[0]=0;a[1]=0;return a}function p(a,b,c){a[0]=
-b[0]-c[0];a[1]=b[1]-c[1];return a}function n(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];return a}function d(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];return a}function b(a,b){var c=b[0]-a[0];a=b[1]-a[1];return Math.sqrt(c*c+a*a)}function c(a,b){var c=b[0]-a[0];a=b[1]-a[1];return c*c+a*a}function e(a){var b=a[0];a=a[1];return Math.sqrt(b*b+a*a)}function g(a){var b=a[0];a=a[1];return b*b+a*a}Object.defineProperty(f,"__esModule",{value:!0});f.create=q;f.clone=function(a){var b=new l.a(2);b[0]=a[0];b[1]=a[1];return b};
-f.fromValues=function(a,b){var c=new l.a(2);c[0]=a;c[1]=b;return c};f.copy=function(a,b){a[0]=b[0];a[1]=b[1];return a};f.set=function(a,b,c){a[0]=b;a[1]=c;return a};f.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];return a};f.subtract=p;f.multiply=n;f.divide=d;f.ceil=function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);return a};f.floor=function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);return a};f.min=function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);return a};f.max=
-function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);return a};f.round=function(a,b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);return a};f.scale=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;return a};f.scaleAndAdd=function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;return a};f.distance=b;f.squaredDistance=c;f.length=e;f.squaredLength=g;f.negate=function(a,b){a[0]=-b[0];a[1]=-b[1];return a};f.inverse=function(a,b){a[0]=1/b[0];a[1]=1/b[1];return a};f.normalize=function(a,b){var c=b[0],d=b[1];
-c=c*c+d*d;0<c&&(c=1/Math.sqrt(c),a[0]=b[0]*c,a[1]=b[1]*c);return a};f.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]};f.cross=function(a,b,c){b=b[0]*c[1]-b[1]*c[0];a[0]=a[1]=0;a[2]=b;return a};f.lerp=function(a,b,c,d){var e=b[0];b=b[1];a[0]=e+d*(c[0]-e);a[1]=b+d*(c[1]-b);return a};f.random=function(a,b){b=b||1;var c=2*l.c()*Math.PI;a[0]=Math.cos(c)*b;a[1]=Math.sin(c)*b;return a};f.transformMat2=function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[2]*b;a[1]=c[1]*d+c[3]*b;return a};f.transformMat2d=function(a,
-b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[2]*b+c[4];a[1]=c[1]*d+c[3]*b+c[5];return a};f.transformMat3=function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[3]*b+c[6];a[1]=c[1]*d+c[4]*b+c[7];return a};f.transformMat4=function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[4]*b+c[12];a[1]=c[1]*d+c[5]*b+c[13];return a};f.str=function(a){return"vec2("+a[0]+", "+a[1]+")"};f.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]};f.equals=function(a,b){var c=a[0];a=a[1];var d=b[0];b=b[1];return Math.abs(c-d)<=l.b*Math.max(1,
-Math.abs(c),Math.abs(d))&&Math.abs(a-b)<=l.b*Math.max(1,Math.abs(a),Math.abs(b))};var l=a(34);f.len=e;f.sub=p;f.mul=n;f.div=d;f.dist=b;f.sqrDist=c;f.sqrLen=g;h=function(){var a=q();return function(b,c,d,e,g,k){c||(c=2);d||(d=0);for(e=e?Math.min(e*c+d,b.length):b.length;d<e;d+=c)a[0]=b[d],a[1]=b[d+1],g(a,a,k),b[d]=a[0],b[d+1]=a[1];return b}}();f.forEach=h},function(h,f,a){a.d(f,"a",function(){return n});var q=a(2),p=function(){function a(a,c){for(var b=0;b<c.length;b++){var d=c[b];d.enumerable=d.enumerable||
-!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),n=function(){function a(b,c){c=void 0===c?q.d:c;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.size=q.s.clone(b);this.transform=q.k.clone(c);this.invTransform=q.k.invert(q.k.create(),c)}p(a,[{key:"toObject",value:function(a){a.size=this.size;a.transform=this.transform}},{key:"localSpatialToGlobal",value:function(a,
-c){return q.s.transformMat4(a,c,this.transform)}},{key:"globalToLocalSpatial",value:function(a,c){return q.s.transformMat4(a,c,this.invTransform)}},{key:"globalToLocalGrid",value:function(a,c){this.globalToLocalSpatial(a,c);q.s.divide(a,a,this.size);return a}},{key:"localSpatialVectorToGlobal",value:function(a,c){return Object(q.p)(a,c,this.transform)}},{key:"globalToLocalSpatialVector",value:function(a,c){return Object(q.p)(a,c,this.invTransform)}},{key:"assignLocalSpatialToGlobalMat4",value:function(a){return q.k.copy(a,
-this.transform)}}],[{key:"get",value:function(b,c){c=void 0===c?q.d:c;var d=a.cache,g=JSON.stringify([Array.from(b),Array.from(c)]),l=d.get(g);void 0===l&&(l=new a(b,c),d.set(g,l));return l}},{key:"fromObject",value:function(b){return a.get(b.size,b.transform)}}]);return a}();n.cache=new Map},function(h,f,a){f.a=function(a,f){return a===f?!0:1E-6>Math.abs(a-f)/Math.min(Math.abs(a),Math.abs(f))}},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
-}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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)}a.d(f,"a",function(){return t});
-var d=a(58),b=a(18),c=a(35),e=a(9);h=a(1);var g=a(2),l=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),k=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);return b}(e.f),t=function(a){function f(a){q(this,f);var l=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));
-l.transformCacheGeneration=-1;l.cachedObjectToGlobal=g.k.create();l.cachedGlobalToObject=g.k.create();var h=void 0===a.transform?new d.a:a.transform,m=a.source,r=void 0===a.hoverState?new k(void 0):a.hoverState,n=void 0===a.role?b.g.ANNOTATION:a.role,t=a.color,u=a.fillOpacity,E=void 0===a.segmentationState?new e.f(null):a.segmentationState;a=void 0===a.filterBySegmentation?new c.b(!1):a.filterBySegmentation;l.transform=h;l.source=l.registerDisposer(m);l.hoverState=r;l.role=n;l.color=t;l.fillOpacity=
-u;l.segmentationState=E;l.filterBySegmentation=a;return l}n(f,a);l(f,[{key:"updateTransforms",value:function(){if(this.transform.changed.count!==this.transformCacheGeneration){var a=this.cachedObjectToGlobal;g.k.multiply(a,this.transform.transform,this.source.objectToLocal);g.k.invert(this.cachedGlobalToObject,a)}}},{key:"objectToGlobal",get:function(){this.updateTransforms();return this.cachedObjectToGlobal}},{key:"globalToObject",get:function(){this.updateTransforms();return this.cachedGlobalToObject}}]);
-return f}(h.a)},function(h,f,a){var q=a(137);h.exports=function(){return q.Date.now()}},function(h,f,a){f=a(74);h.exports="object"==typeof f&&f&&f.Object===Object&&f},function(h,f,a){var q=a(96),p=a(238),n=0/0,d=/^\s+|\s+$/g,b=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,e=/^0o[0-7]+$/i,g=parseInt;h.exports=function(a){if("number"==typeof a)return a;if(p(a))return n;q(a)&&(a="function"==typeof a.valueOf?a.valueOf():a,a=q(a)?a+"":a);if("string"!=typeof a)return 0===a?a:+a;a=a.replace(d,"");var k=c.test(a);
-return k||e.test(a)?g(a.slice(2),k?2:8):b.test(a)?n:+a}},function(h,f,a){var q=a(239),p=a(242);h.exports=function(a){return"symbol"==typeof a||p(a)&&"[object Symbol]"==q(a)}},function(h,f,a){f=a(138);var q=a(240),p=a(241),n=f?f.toStringTag:void 0;h.exports=function(a){return null==a?void 0===a?"[object Undefined]":"[object Null]":n&&n in Object(a)?q(a):p(a)}},function(h,f,a){f=a(138);a=Object.prototype;var q=a.hasOwnProperty,p=a.toString,n=f?f.toStringTag:void 0;h.exports=function(a){var b=q.call(a,
-n),c=a[n];try{a[n]=void 0;var d=!0}catch(l){}var g=p.call(a);d&&(b?a[n]=c:delete a[n]);return g}},function(h,f){var a=Object.prototype.toString;h.exports=function(f){return a.call(f)}},function(h,f){h.exports=function(a){return null!=a&&"object"==typeof a}},function(h,f,a){var q=a(10),p=a(96);h.exports=function(a,d,b){var c=!0,e=!0;if("function"!=typeof a)throw new TypeError("Expected a function");p(b)&&(c="leading"in b?!!b.leading:c,e="trailing"in b?!!b.trailing:e);return q(a,d,{leading:c,maxWait:d,
-trailing:e})}},function(h,f,a){f.b=function(a,f){a.remove(f)};f.a=function(a,f){a.add(f)}},function(h,f){},function(h,f,a){a.d(f,"b",function(){return q});var q;(function(a){a[a.LITTLE=0]="LITTLE";a[a.BIG=1]="BIG"})(q||(q={}));h=function(){var a=Uint16Array.of(4386);return 17===(new Uint8Array(a.buffer))[0]?q.BIG:q.LITTLE}();f.a=h},function(h,f){},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a){if(null==a)return function(){return!1};var b=a.visibleSegments,c=a.segmentEquivalences;return function(a){a=a.segments;
-if(void 0===a)return!1;a=$jscomp.makeIterator(a);for(var d=a.next();!d.done;d=a.next())if(b.has(c.get(d.value)))return!0;return!1}}function b(a,b){for(var c=[],d=$jscomp.makeIterator(e.e),g=d.next();!g.done;g=d.next())c[g.value]=[];d=$jscomp.makeIterator(a);for(g=d.next();!g.done;g=d.next())g=g.value,(void 0===b||b(g))&&c[g.type].push(g.id);var l=0;b=0;d=[];var f=$jscomp.makeIterator(e.e);for(g=f.next();!g.done;g=f.next()){var h=g.value;d[h]=l;g=c[h].length;h=Object(k.b)(h);l+=g*h.bytes;b+=h.pickIdsPerInstance*
-g}l=new ArrayBuffer(l);f={};h=$jscomp.makeIterator(e.e);for(g=h.next();!g.done;f={serializer:f.serializer},g=h.next()){g=g.value;var m=c[g],r=Object(k.b)(g);f.serializer=r.serializer(l,d[g],m.length);m.forEach(function(b){return function(c,d){return b.serializer(a.get(c),d)}}(f))}return{typeToIds:c,typeToOffset:d,data:l,numPickIds:b}}function c(a,b){return function(a){function c(a){for(var d=[],g=0;g<arguments.length;++g)d[g-0]=arguments[g];q(this,c);var l,f=p(this,(l=c.__proto__||Object.getPrototypeOf(c)).call.apply(l,
-[].concat([this],$jscomp.arrayFromIterable(d))));f.renderHelpers=[];f.isAnnotation=!0;d=f.registerDisposer(f.base);g=d.visibility;void 0!==g&&f.registerDisposer(g.add(f.visibility));f.role=d.state.role;g=f.renderHelpers;l=f.gl;for(var h=$jscomp.makeIterator(e.e),m=h.next();!m.done;m=h.next()){var r=m.value;m=Object(k.b)(r);r=g[r]=f.registerDisposer(new m[b](l));r.pickIdsPerInstance=m.pickIdsPerInstance;r.targetIsSliceView="sliceViewRenderHelper"===b}f.registerDisposer(d.redrawNeeded.add(function(){f.redrawNeeded.dispatch()}));
-f.setReady(!0);return f}n(c,a);G(c,[{key:"drawGeometryChunkData",value:function(a,b){if(!a.bufferValid){var c=a.buffer;void 0===c&&(c=a.buffer=new z.a(this.gl));c.setData(a.data);a.bufferValid=!0}this.drawGeometry(a,b)}},{key:"drawGeometry",value:function(a,b){var c=this.base,d=a.typeToIds,g=a.typeToOffset,l=0;b.emitPickID&&(l=b.pickIDs.register(this,a.numPickIds,0,0,a));for(var f=c.hoverState.value,h=y.k.multiply(C,b.dataToDevice,c.state.objectToGlobal),m=$jscomp.makeIterator(e.e),r=m.next();!r.done;r=
-m.next()){r=r.value;var n=d[r];if(0<n.length){var t=n.length,p=Object(k.b)(r),q=4294967295;void 0!==f&&(n=Object(v.a)(n,f.id,function(a,b){return a<b?-1:a===b?0:1}),0<=n&&(q=n*p.pickIdsPerInstance));this.renderHelpers[r].draw({annotationLayer:c,renderContext:b,selectedIndex:q,basePickId:l,buffer:a.buffer,bufferOffset:g[r],count:t,projectionMatrix:h});l+=t*p.pickIdsPerInstance}}}},{key:"draw",value:function(a){var b=this,c=this.base.source;if(c instanceof e.b)c=this.base,c.updateBuffer(),this.drawGeometry(c,
-a);else if(this.drawGeometryChunkData(c.temporary.data,a),this.base.state.filterBySegmentation.value){var d=this.base.state.segmentationState.value;if(null!=d){var g=c.segmentFilteredSource.chunks;Object(r.a)(d,function(c){c=Object(r.b)(c);c=g.get(c);void 0!==c&&b.drawGeometryChunkData(c.data,a)})}}else for(c=$jscomp.makeIterator(c.sources),d=c.next();!d.done;d=c.next()){d=$jscomp.makeIterator(d.value);for(var k=d.next();!k.done;k=d.next()){k=$jscomp.makeIterator(k.value.chunks.values());for(var l=
-k.next();!l.done;l=k.next())l=l.value,l.state===t.d.GPU_MEMORY&&this.drawGeometryChunkData(l.data,a)}}}},{key:"updateMouseState",value:function(a,b,c,d){var g=d.typeToIds;b=d.typeToOffset;for(var l=$jscomp.makeIterator(e.e),f=l.next();!f.done;f=l.next()){f=f.value;var h=g[f],m=Object(k.b)(f),r=m.pickIdsPerInstance;if(c<h.length*r){g=Math.floor(c/r);c%=r;a.pickedAnnotationId=h[g];a.pickedAnnotationLayer=this.base.state;a.pickedOffset=c;m.snapPosition(a.position,this.base.state.objectToGlobal,d.data.buffer,
-d.data.byteOffset+b[f]+g*m.bytes,c);break}c-=h.length*r}}},{key:"transformPickedValue",value:function(a,b){}},{key:"isReady",value:function(){var a=this.base,b=a.source;if(!(b instanceof l.b&&a.state.filterBySegmentation.value))return!0;a=this.base.state.segmentationState.value;if(void 0===a)return!1;if(null===a)return!0;var c=b.segmentFilteredSource.chunks,d=!1;Object(r.a)(a,function(a){a=Object(r.b)(a);c.has(a)||(d=!0)});return!d}},{key:"gl",get:function(){return this.base.chunkManager.gl}}]);return c}(a)}
-a.d(f,"a",function(){return F});a.d(f,"b",function(){return L});a(249);a(250);a(251);a(252);var e=a(28),g=a(95),l=a(97),k=a(51),t=a(30),m=a(59),r=a(78),u=a(75);h=a(60);var v=a(43),w=a(1),y=a(2),x=a(7),A=a(29),z=a(20),D=a(15),E=function O(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return O(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},G=function(){function a(a,b){for(var c=
-0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();a=this&&this.__decorate||function(a,b,c,d){var e=arguments.length,g=3>e?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,k;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)g=Reflect.decorate(a,b,c,d);else for(var l=a.length-1;0<=l;l--)if(k=a[l])g=(3>e?k(g):3<e?k(b,c,g):k(b,
-c))||g;return 3<e&&g&&Object.defineProperty(b,c,g),g};var C=y.k.create(),B=function(a){function b(a,c,d,e){q(this,b);var k=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));k.chunkManager=a;k.source=c;k.state=d;k.filterBySegmentation=e;k.initializeCounterpart(k.chunkManager.rpc,{chunkManager:k.chunkManager.rpcId,source:c.rpcId,segmentationState:k.serializeDisplayState()});a=function(){var a={id:k.rpcId,segmentationState:k.serializeDisplayState()};k.rpc.invoke(g.i,a)};k.registerDisposer(d.changed.add(a));
-k.registerDisposer(e.changed.add(a));return k}n(b,a);G(b,[{key:"serializeDisplayState",value:function(){var a=this.state.value;return null==a?a:this.filterBySegmentation.value?{segmentEquivalences:a.segmentEquivalences.rpcId,visibleSegments:a.visibleSegments.rpcId}:null}}]);return b}(Object(A.c)(D.b));B=a([Object(D.g)(g.h)],B);var F=function(a){function c(a,b){q(this,c);var d=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.chunkManager=a;d.state=b;d.generation=-1;d.redrawNeeded=new x.a;
-d.handleChangeAffectingBuffer=function(){d.generation=-1;d.redrawNeeded.dispatch()};d.handleSegmentationChanged=function(){d.state.filterBySegmentation.value&&d.handleChangeAffectingBuffer()};d.registerDisposer(b);d.buffer=d.registerDisposer(new z.a(a.gl));d.registerDisposer(d.source.changed.add(d.handleChangeAffectingBuffer));d.registerDisposer(b.filterBySegmentation.changed.add(d.handleChangeAffectingBuffer));d.registerDisposer(function(){return d.unregisterSegmentationState()});d.registerDisposer(b.segmentationState.changed.add(function(){var a=
-b.segmentationState.value;a!==d.segmentationState&&(d.unregisterSegmentationState(),null!=a&&(a.visibleSegments.changed.add(d.handleSegmentationChanged),a.segmentEquivalences.changed.add(d.handleSegmentationChanged)),d.segmentationState=a,d.handleSegmentationChanged())}));d.source instanceof e.b||(d.sharedObject=d.registerDisposer(new B(a,d.source,b.segmentationState,b.filterBySegmentation)));d.registerDisposer(d.state.color.changed.add(d.redrawNeeded.dispatch));d.registerDisposer(d.state.fillOpacity.changed.add(d.redrawNeeded.dispatch));
-d.registerDisposer(d.hoverState.changed.add(d.redrawNeeded.dispatch));d.registerDisposer(d.transform.changed.add(d.redrawNeeded.dispatch));return d}n(c,a);G(c,[{key:"unregisterSegmentationState",value:function(){var a=this.segmentationState;null!=a&&(a.visibleSegments.changed.remove(this.handleSegmentationChanged),a.segmentEquivalences.changed.remove(this.handleSegmentationChanged),this.segmentationState=void 0)}},{key:"updateBuffer",value:function(){var a=this.source;if(a instanceof e.b){var c=a.changed.count;
-if(this.generation!==c){this.generation=c;a=b(a,this.state.filterBySegmentation.value?d(this.segmentationState):void 0);c=a.typeToIds;var g=a.typeToOffset,k=a.numPickIds;this.data=new Uint8Array(a.data);this.buffer.setData(this.data);this.typeToIds=c;this.typeToOffset=g;this.numPickIds=k}}}},{key:"source",get:function(){return this.state.source}},{key:"transform",get:function(){return this.state.transform}},{key:"hoverState",get:function(){return this.state.hoverState}},{key:"visibility",get:function(){var a=
-this.sharedObject;if(void 0!==a)return a.visibility}},{key:"gl",get:function(){return this.chunkManager.gl}}]);return c}(w.a);a=function(a){function b(a){q(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.base=a;return c}n(b,a);return b}(m.a);h=function(a){function b(a){q(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.base=a;return c}n(b,a);return b}(h.b);var L=function(a){function b(){q(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,
-arguments));var c=a.base.source;if(c instanceof l.b){var d=a.registerDisposer(new D.b),e=c.chunkManager.rpc;d.RPC_TYPE_ID=g.e;d.initializeCounterpart(e,{source:c.rpcId,filterBySegmentation:a.registerDisposer(u.a.makeFromExisting(e,a.base.state.filterBySegmentation)).rpcId});c=d}else c=void 0;a.backend=c;return a}n(b,a);G(b,[{key:"isReady",value:function(){if(!E(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"isReady",this).call(this))return!1;var a=this.base,c=a.source;return c instanceof
-l.b&&!a.state.filterBySegmentation.value&&(a=c.sources[0][0].chunks.get("0,0,0"),void 0===a||a.state!==t.d.GPU_MEMORY)?!1:!0}}]);return b}(c(a,"perspectiveViewRenderHelper"));h=c(h,"sliceViewRenderHelper");f.c=h},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(){return new Float32Array([0,1,2,3,4,5])}function b(){return Object(e.d)(d(),1,1,t.b)}h=a(28);f=a(51);var c=a(142),e=a(43),g=a(2),l=a(20),k=a(100),t=a(143),m=a(25),r=function(){function a(a,
-b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),u=function A(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return A(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a=27;var v=Float32Array.from([0,0,0,
-0,0,1,9,1,0,0,1,0,1,10,0,1,0,0,1,1,11,1,1,0,1,1,1,12,0,0,0,0,1,0,13,0,0,1,0,1,1,14,1,0,0,1,1,0,15,1,0,1,1,1,1,16,0,0,0,1,0,0,17,0,0,1,1,0,1,18,0,1,0,1,1,0,19,0,1,1,1,1,1,20]),w=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);r(b,[{key:"defineShader",value:function(a){u(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);a.addAttribute("highp vec3","aLower");a.addAttribute("highp vec3","aUpper")}},
-{key:"enable",value:function(a,c,d){u(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"enable",this).call(this,a,c,function(){var b=a.gl,e=a.attribute("aLower"),g=a.attribute("aUpper");c.buffer.bindToVertexAttrib(e,3,WebGL2RenderingContext.FLOAT,!1,24,c.bufferOffset);c.buffer.bindToVertexAttrib(g,3,WebGL2RenderingContext.FLOAT,!1,24,c.bufferOffset+12);b.vertexAttribDivisor(e,1);b.vertexAttribDivisor(g,1);d();b.vertexAttribDivisor(e,0);b.vertexAttribDivisor(g,0);b.disableVertexAttribArray(e);
-b.disableVertexAttribArray(g)})}}]);return b}(f.a),y=function(a){function b(){q(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.lineShader=a.registerDisposer(new t.a(a.gl,12));a.edgeBoxCornerOffsetsBuffer=a.registerDisposer(l.a.fromData(a.gl,Object(e.d)(v,7,1,t.b)));a.edgeShaderGetter=Object(m.b)(a,a.gl,function(b){a.defineShader(b);a.lineShader.defineShader(b);b.addAttribute("highp vec3","aBoxCornerOffset1");b.addAttribute("highp vec4","aBoxCornerOffset2");b.setVertexMain("\nvec3 vertexPosition1 = mix(aLower, aUpper, aBoxCornerOffset1);\nvec3 vertexPosition2 = mix(aLower, aUpper, aBoxCornerOffset2.xyz);\nemitLine(uProjection, vertexPosition1, vertexPosition2);\n"+
-a.setPartIndex(b,"aBoxCornerOffset2.w")+";\n");b.setFragmentMain("\nemitAnnotation(vec4(vColor.rgb, getLineAlpha()));\n")});a.circleShader=a.registerDisposer(new k.a(a.gl,8));a.boxCornerOffsetsBuffer=a.registerDisposer(l.a.fromData(a.gl,Object(e.d)(c.b,3,1,k.b)));a.cornerShaderGetter=Object(m.b)(a,a.gl,function(b){a.defineShader(b);a.circleShader.defineShader(b,a.targetIsSliceView);b.addAttribute("highp vec3","aBoxCornerOffset");b.setVertexMain("\nvec3 vertexPosition = mix(aLower, aUpper, aBoxCornerOffset);\nemitCircle(uProjection * vec4(vertexPosition, 1.0));\nfloat cornerIndex = aBoxCornerOffset.x + aBoxCornerOffset.y * 2.0 + aBoxCornerOffset.z * 4.0;\nfloat cornerPickOffset = "+
-(1).toFixed(1)+" + cornerIndex;\n"+a.setPartIndex(b,"cornerPickOffset")+";\n");b.setFragmentMain("\nvec4 borderColor = vec4(0.0, 0.0, 0.0, 1.0);\nemitAnnotation(getCircleColor(vColor, borderColor));\n")});return a}n(b,a);r(b,[{key:"drawEdges",value:function(a){var b=this,c=this.edgeShaderGetter(a.renderContext.emitter),d=this.gl;this.enable(c,a,function(){var e=c.attribute("aBoxCornerOffset1"),g=c.attribute("aBoxCornerOffset2");b.edgeBoxCornerOffsetsBuffer.bindToVertexAttrib(e,3,WebGL2RenderingContext.FLOAT,
-!1,28,0);b.edgeBoxCornerOffsetsBuffer.bindToVertexAttrib(g,4,WebGL2RenderingContext.FLOAT,!1,28,12);b.lineShader.draw(c,a.renderContext,a.renderContext.emitColor?1:5,1,a.count);d.disableVertexAttribArray(e);d.disableVertexAttribArray(g)})}},{key:"drawCorners",value:function(a){var b=this,c=this.cornerShaderGetter(a.renderContext.emitter),d=this.gl;this.enable(c,a,function(){var e=c.attribute("aBoxCornerOffset");b.boxCornerOffsetsBuffer.bindToVertexAttrib(e,3,WebGL2RenderingContext.FLOAT,!1);b.circleShader.draw(c,
-a.renderContext,{interiorRadiusInPixels:1,borderWidthInPixels:0,featherWidthInPixels:1},a.count);d.disableVertexAttribArray(e)})}},{key:"draw",value:function(a){this.drawEdges(a);this.drawCorners(a)}}]);return b}(w);w=function(a){function e(a){q(this,e);var g=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a));g.gl=a;g.lineShader=new t.a(g.gl,6);g.intersectionVertexIndexBuffer=Object(l.b)(g.gl,WebGL2RenderingContext.ARRAY_BUFFER,b).value;g.filledIntersectionVertexIndexBuffer=Object(l.b)(g.gl,
-WebGL2RenderingContext.ARRAY_BUFFER,d).value;g.boundingBoxCrossSectionHelper=g.registerDisposer(new c.a(g.gl));g.faceShaderGetter=Object(m.b)(g,g.gl,function(a){u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"defineShader",g).call(g,a);g.boundingBoxCrossSectionHelper.defineShader(a);g.lineShader.defineShader(a);a.addAttribute("highp float","aVertexIndexFloat");a.setVertexMain("\nint vertexIndex1 = int(aVertexIndexFloat);\nint vertexIndex2 = vertexIndex1 == 5 ? 0 : vertexIndex1 + 1;\nvec3 vertexPosition1 = getBoundingBoxPlaneIntersectionVertexPosition(aUpper - aLower, aLower, aLower, aUpper, vertexIndex1);\nvec3 vertexPosition2 = getBoundingBoxPlaneIntersectionVertexPosition(aUpper - aLower, aLower, aLower, aUpper, vertexIndex2);\nemitLine(uProjection, vertexPosition1, vertexPosition2);\n"+
-g.setPartIndex(a)+";\n");a.setFragmentMain("\nemitAnnotation(vec4(vColor.rgb, vColor.a * getLineAlpha()));\n")});g.fillShaderGetter=Object(m.b)(g,g.gl,function(a){u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"defineShader",g).call(g,a);g.boundingBoxCrossSectionHelper.defineShader(a);a.addAttribute("highp float","aVertexIndexFloat");a.addUniform("highp float","uFillOpacity");a.setVertexMain("\nint vertexIndex = int(aVertexIndexFloat);\nvec3 vertexPosition = getBoundingBoxPlaneIntersectionVertexPosition(aUpper - aLower, aLower, aLower, aUpper, vertexIndex);\ngl_Position = uProjection * vec4(vertexPosition, 1);\n"+
-g.setPartIndex(a)+";\n");a.setFragmentMain("\nemitAnnotation(vec4(vColor.rgb, uFillOpacity));\n")});return g}n(e,a);r(e,[{key:"draw",value:function(a){var b=this,c=a.annotationLayer.state.fillOpacity.value,d=(c?this.fillShaderGetter:this.faceShaderGetter)(a.renderContext.emitter),e=this.gl;this.enable(d,a,function(){b.boundingBoxCrossSectionHelper.setViewportPlane(d,a.renderContext.sliceView.viewportAxes[2],a.renderContext.sliceView.centerDataPosition,a.annotationLayer.state.globalToObject);var g=
-d.attribute("aVertexIndexFloat");(c?b.filledIntersectionVertexIndexBuffer:b.intersectionVertexIndexBuffer).bindToVertexAttrib(g,1,WebGL2RenderingContext.FLOAT,!1);c?(e.uniform1f(d.uniform("uFillOpacity"),c),e.drawArraysInstanced(WebGL2RenderingContext.TRIANGLE_FAN,0,6,a.count)):b.lineShader.draw(d,a.renderContext,a.renderContext.emitColor?1:5,1,a.count);e.disableVertexAttribArray(g)})}}]);return e}(w);Object(f.c)(h.c.AXIS_ALIGNED_BOUNDING_BOX,{bytes:24,serializer:function(a,b,c){var d=new Float32Array(a,
-b,6*c);return function(a,b){var c=a.pointA;a=a.pointB;b*=6;d[b]=Math.min(c[0],a[0]);d[b+1]=Math.min(c[1],a[1]);d[b+2]=Math.min(c[2],a[2]);d[b+3]=Math.max(c[0],a[0]);d[b+4]=Math.max(c[1],a[1]);d[b+5]=Math.max(c[2],a[2])}},sliceViewRenderHelper:w,perspectiveViewRenderHelper:y,pickIdsPerInstance:a,snapPosition:function(a,b,d,e,k){d=new Float32Array(d,e,6);if(1<=k&&9>k){k=3*(k-1);for(e=0;3>e;++e){var l=c.b[k+e];a[e]=(1-l)*Math.min(d[e],d[e+3])+l*Math.max(d[e],d[e+3])}g.s.transformMat4(a,a,b)}else if(9<=
-k&&21>k){k=7*(k-9);e=g.s.create();l=g.s.create();for(var f=0;3>f;++f){var h=v[k+f],m=v[k+f+3],r=Math.min(d[f],d[f+3]),n=Math.max(d[f],d[f+3]);e[f]=(1-h)*r+h*n;l[f]=(1-m)*r+m*n}g.s.transformMat4(e,e,b);g.s.transformMat4(l,l,b);Object(g.m)(a,e,l,a)}}})},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(){return Object(d.d)(new Float32Array([0,1]),1,1,e.b)}h=a(28);f=a(51);var d=a(43),b=a(2),c=a(20),e=a(100),g=a(143),l=a(25),k=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,
-c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),t=function r(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return r(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a=function(a){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var a=q(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.lineShader=a.registerDisposer(new g.a(a.gl,
-1));a.circleShader=a.registerDisposer(new e.a(a.gl,2));a.edgeShaderGetter=Object(l.b)(a,a.gl,function(b){a.defineShader(b);a.lineShader.defineShader(b);b.setVertexMain("\nemitLine(uProjection, aEndpointA, aEndpointB);\n"+a.setPartIndex(b)+";\n");b.setFragmentMain("\nemitAnnotation(vec4(vColor.rgb, vColor.a * getLineAlpha() * "+a.getCrossSectionFadeFactor()+"));\n")});a.endpointIndexBuffer=a.registerDisposer(Object(c.b)(a.gl,WebGL2RenderingContext.ARRAY_BUFFER,n)).value;a.endpointShaderGetter=Object(l.b)(a,
-a.gl,function(b){a.defineShader(b);a.circleShader.defineShader(b,a.targetIsSliceView);b.addAttribute("highp float","aEndpointIndex");b.setVertexMain("\nvec3 vertexPosition = mix(aEndpointA, aEndpointB, aEndpointIndex);\nemitCircle(uProjection * vec4(vertexPosition, 1.0));\n"+a.setPartIndex(b,"aEndpointIndex + 1.0")+";\n");b.setFragmentMain("\nvec4 borderColor = vec4(0.0, 0.0, 0.0, 1.0);\nemitAnnotation(getCircleColor(vColor, borderColor));\n")});return a}p(b,a);k(b,[{key:"defineShader",value:function(a){t(b.prototype.__proto__||
-Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);a.addAttribute("highp vec3","aEndpointA");a.addAttribute("highp vec3","aEndpointB")}},{key:"enable",value:function(a,c,d){t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"enable",this).call(this,a,c,function(){var b=a.gl,e=a.attribute("aEndpointA"),g=a.attribute("aEndpointB");c.buffer.bindToVertexAttrib(e,3,WebGL2RenderingContext.FLOAT,!1,24,c.bufferOffset);c.buffer.bindToVertexAttrib(g,3,WebGL2RenderingContext.FLOAT,
-!1,24,c.bufferOffset+12);b.vertexAttribDivisor(e,1);b.vertexAttribDivisor(g,1);d();b.vertexAttribDivisor(e,0);b.vertexAttribDivisor(g,0);b.disableVertexAttribArray(e);b.disableVertexAttribArray(g)})}},{key:"drawEdges",value:function(a){var b=this,c=this.edgeShaderGetter(a.renderContext.emitter);this.enable(c,a,function(){b.lineShader.draw(c,a.renderContext,a.renderContext.emitColor?1:5,1,a.count)})}},{key:"drawEndpoints",value:function(a){var b=this,c=this.endpointShaderGetter(a.renderContext.emitter);
-this.enable(c,a,function(){var d=c.attribute("aEndpointIndex");b.endpointIndexBuffer.bindToVertexAttrib(d,1,WebGL2RenderingContext.FLOAT,!1);b.circleShader.draw(c,a.renderContext,{interiorRadiusInPixels:6,borderWidthInPixels:2,featherWidthInPixels:1},a.count);c.gl.disableVertexAttribArray(d)})}},{key:"draw",value:function(a){this.drawEdges(a);this.drawEndpoints(a)}}]);return b}(f.a);Object(f.c)(h.c.LINE,{bytes:24,serializer:function(a,b,c){var d=new Float32Array(a,b,6*c);return function(a,b){var c=
-a.pointA;a=a.pointB;b*=6;d[b]=c[0];d[b+1]=c[1];d[b+2]=c[2];d[b+3]=a[0];d[b+4]=a[1];d[b+5]=a[2]}},sliceViewRenderHelper:a,perspectiveViewRenderHelper:a,pickIdsPerInstance:3,snapPosition:function(a,c,d,e,g){d=new Float32Array(d,e,6);0===g?(g=b.s.transformMat4(b.s.create(),d.subarray(0,3),c),c=b.s.transformMat4(b.s.create(),d.subarray(3,6),c),Object(b.m)(a,g,c,a)):(g=3*(g-1),g=d.subarray(g,g+3),b.s.transformMat4(a,g,c))}})},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}h=a(28);f=a(51);var n=a(2),d=a(100),b=a(25),c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||
-!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),e=function l(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return l(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a=function(a){function k(){if(!(this instanceof k))throw new TypeError("Cannot call a class as a function");
-var a=q(this,(k.__proto__||Object.getPrototypeOf(k)).apply(this,arguments));a.circleShader=a.registerDisposer(new d.a(a.gl));a.shaderGetter=Object(b.b)(a,a.gl,function(b){return a.defineShader(b)});return a}p(k,a);c(k,[{key:"defineShader",value:function(a){e(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"defineShader",this).call(this,a);this.circleShader.defineShader(a,this.targetIsSliceView);a.addAttribute("highp vec3","aVertexPosition");a.setVertexMain("\nemitCircle(uProjection * vec4(aVertexPosition, 1.0));\n"+
-this.setPartIndex(a)+";\n");a.setFragmentMain("\nvec4 borderColor = vec4(0.0, 0.0, 0.0, 1.0);\nemitAnnotation(getCircleColor(vColor, borderColor));\n")}},{key:"draw",value:function(a){var b=this,c=this.shaderGetter(a.renderContext.emitter);this.enable(c,a,function(){var d=b.gl,e=c.attribute("aVertexPosition");a.buffer.bindToVertexAttrib(e,3,WebGL2RenderingContext.FLOAT,!1,0,a.bufferOffset);d.vertexAttribDivisor(e,1);b.circleShader.draw(c,a.renderContext,{interiorRadiusInPixels:6,borderWidthInPixels:2,
-featherWidthInPixels:1},a.count);d.vertexAttribDivisor(e,0);d.disableVertexAttribArray(e)})}}]);return k}(f.a);Object(f.c)(h.c.POINT,{bytes:12,serializer:function(a,b,c){var d=new Float32Array(a,b,3*c);return function(a,b){a=a.point;b*=3;d[b]=a[0];d[b+1]=a[1];d[b+2]=a[2]}},sliceViewRenderHelper:a,perspectiveViewRenderHelper:a,pickIdsPerInstance:1,snapPosition:function(a,b,c,d){n.s.transformMat4(a,new Float32Array(c,d,3),b)}})},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
-}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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)}h=a(28);f=a(51);var d=
-a(2),b=a(253),c=a(101),e=a(25),g=a(254),l=a(52),k=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),t=function v(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return v(a,b,c)}else{if("value"in d)return d.value;b=d.get;
-return void 0===b?void 0:b.call(c)}},m=d.k.create(),r=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);k(b,[{key:"defineShader",value:function(a){t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);a.addAttribute("highp vec3","aCenter");a.addAttribute("highp vec3","aRadii")}},{key:"enable",value:function(a,c,d){t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"enable",this).call(this,
-a,c,function(){var b=a.attribute("aCenter"),e=a.attribute("aRadii"),g=a.gl;c.buffer.bindToVertexAttrib(b,3,WebGL2RenderingContext.FLOAT,!1,24,c.bufferOffset);c.buffer.bindToVertexAttrib(e,3,WebGL2RenderingContext.FLOAT,!1,24,c.bufferOffset+12);g.vertexAttribDivisor(b,1);g.vertexAttribDivisor(e,1);d();g.vertexAttribDivisor(b,0);g.vertexAttribDivisor(e,0);g.disableVertexAttribArray(b);g.disableVertexAttribArray(e)})}}]);return b}(f.a);a=function(a){function b(){q(this,b);var a=p(this,(b.__proto__||
-Object.getPrototypeOf(b)).apply(this,arguments));a.sphereRenderHelper=a.registerDisposer(new g.a(a.gl,10,10));a.shaderGetter=Object(e.b)(a,a.gl,function(b){a.defineShader(b);a.sphereRenderHelper.defineShader(b);b.addUniform("highp vec4","uLightDirection");b.addUniform("highp mat4","uNormalTransform");b.setVertexMain("\nemitSphere(uProjection, uNormalTransform, aCenter, aRadii, uLightDirection);\n"+a.setPartIndex(b)+";\n");b.setFragmentMain("\nemitAnnotation(vec4(vColor.rgb * vLightingFactor, vColor.a));\n")});
-a.tempLightVec=new Float32Array(4);return a}n(b,a);k(b,[{key:"draw",value:function(a){var b=this,c=this.shaderGetter(a.renderContext.emitter);this.enable(c,a,function(){var e=c.gl,g=b.tempLightVec,k=a.renderContext,f=k.ambientLighting;d.s.scale(g,k.lightDirection,k.directionalLighting);g[3]=f;e.uniform4fv(c.uniform("uLightDirection"),g);e.uniformMatrix4fv(c.uniform("uNormalTransform"),!1,d.k.transpose(d.k.create(),a.annotationLayer.state.globalToObject));b.sphereRenderHelper.draw(c,a.count)})}}]);
-return b}(r);r=function(a){function g(){q(this,g);var a=p(this,(g.__proto__||Object.getPrototypeOf(g)).apply(this,arguments));a.quadRenderHelper=a.registerDisposer(new c.a(a.gl,1));a.squareCornersBuffer=Object(l.a)(a.gl,-1,-1,1,1,1,1);a.shaderGetter=Object(e.b)(a,a.gl,function(c){a.defineShader(c);c.addUniform("highp mat4","uViewportToObject");c.addUniform("highp mat4","uObjectToViewport");c.addUniform("highp mat4","uViewportToDevice");c.addAttribute("highp vec2","aCornerOffset");c.addVarying("highp vec2",
-"vCircleCoord");c.addVertexCode(b.d);c.addVertexCode(b.c);c.setVertexMain("\nmat3 Aobject = mat3(0.0);\nfor (int i = 0; i < 3; ++i) {\n  Aobject[i][i] = 1.0 / (aRadii[i] * aRadii[i]);\n}\nmat3 RviewportToObject = mat3(uViewportToObject);\nmat3 Aviewport = transpose(RviewportToObject) * Aobject * RviewportToObject;\nvec3 cViewport = (uObjectToViewport * vec4(aCenter, 1.0)).xyz;\nEllipseQuadraticForm quadraticForm = computeCrossSectionEllipse(Aviewport, cViewport);\nvec2 u1, u2;\nfloat a, b;\nCenterOrientEllipse centerOrient = computeCenterOrientEllipse(quadraticForm);\nvec2 viewportCorner = centerOrient.k +\n  centerOrient.u1 * aCornerOffset.x * centerOrient.a +\n  centerOrient.u2 * aCornerOffset.y * centerOrient.b;\nif (centerOrient.valid) {\n  gl_Position = uViewportToDevice * vec4(viewportCorner, 0.0, 1.0);\n} else {\n  gl_Position = vec4(1.0, 1.0, 0.0, -100.0);\n}\nvCircleCoord = aCornerOffset;\n"+
-a.setPartIndex(c)+";\n");c.setFragmentMain("\nif (dot(vCircleCoord, vCircleCoord) > 1.0) {\n  discard;\n}\nemitAnnotation(vec4(vColor.rgb, 0.5));\n")});return a}n(g,a);k(g,[{key:"draw",value:function(a){var b=this,c=this.shaderGetter(a.renderContext.emitter);this.enable(c,a,function(){var e=c.gl,g=c.attribute("aCornerOffset");b.squareCornersBuffer.bindToVertexAttrib(g,2);var k=d.k.multiply(m,a.annotationLayer.state.globalToObject,a.renderContext.sliceView.viewportToData);e.uniformMatrix4fv(c.uniform("uViewportToObject"),
-!1,k);e.uniformMatrix4fv(c.uniform("uViewportToDevice"),!1,a.renderContext.sliceView.viewportToDevice);d.k.invert(m,k);e.uniformMatrix4fv(c.uniform("uObjectToViewport"),!1,m);b.quadRenderHelper.draw(e,a.count);c.gl.disableVertexAttribArray(g)})}}]);return g}(r);Object(f.c)(h.c.ELLIPSOID,{bytes:24,serializer:function(a,b,c){var d=new Float32Array(a,b,6*c);return function(a,b){var c=a.radii;b*=6;d.set(a.center,b);d.set(c,b+3)}},sliceViewRenderHelper:r,perspectiveViewRenderHelper:a,pickIdsPerInstance:1,
-snapPosition:function(){}})},function(h,f,a){f.b=function(a,f){a=[[a[0],a[1],a[2]],[a[3],a[4],a[5]],[a[6],a[7],a[8]]];return{A:a[0][0],B:a[0][1]+a[1][0],C:a[1][1],D:-2*f[0]*a[0][0]-f[1]*(a[0][1]+a[1][0])+f[2]*(a[0][2]+a[2][0]),E:-f[0]*(a[0][1]+a[1][0])-2*f[1]*a[1][1]+f[2]*(a[1][2]+a[2][1]),F:f[0]*f[0]*a[0][0]+f[0]*f[1]*(a[0][1]+a[1][0])-f[0]*f[2]*(a[0][2]+a[2][0])+f[1]*f[1]*a[1][1]-f[1]*f[2]*(a[1][2]+a[2][1])+f[2]*f[2]*a[2][2]-1}};f.a=function(a){var f=a.A,d=a.B/2,b=a.C,c=a.D,e=a.E,g=2*(d*d-f*b),
-l=(b*c-d*e)/g;c=(f*e-d*c)/g;a=1/(f*l*l+2*d*l*c+b*c*c-a.F);f*=a;d*=a;b*=a;e=f+b;g=Math.sqrt((f-b)*(f-b)+4*d*d);a=(e+g)/2;e=(e-g)/2;g=1/Math.sqrt(a);var k=1/Math.sqrt(e);var h=1E-10>Math.abs(d)?q.r.fromValues(1,0):f>=b?q.r.fromValues(a-b,d):q.r.fromValues(d,a-f);q.r.normalize(h,h);var m=q.r.fromValues(-h[1],h[0]);return{k:q.r.fromValues(l,c),u1:h,u2:m,a:g,b:k,lambda1:a,lambda2:e,m11:f,m12:d,m22:b}};var q=a(2);f.d=["\nstruct EllipseQuadraticForm {\n  highp float A;  // x*x coefficient\n  highp float B;  // x*y coefficient\n  highp float C;  // y*y coefficient\n  highp float D;  // x coefficient\n  highp float E;  // y coefficient\n  highp float F;  // 1 coefficient\n};\n",
-"\nEllipseQuadraticForm computeCrossSectionEllipse(mat3 A, vec3 c) {\n  EllipseQuadraticForm p;\n  p.A = A[0][0];\n  p.B = A[0][1] + A[1][0];\n  p.C = A[1][1];\n  p.D = -2.0 * c[0] * A[0][0] - c[1] * (A[0][1] + A[1][0]) +\n        c[2] * (A[0][2] + A[2][0]);\n  p.E = -c[0] * (A[0][1] + A[1][0]) - 2.0 * c[1] * A[1][1] +\n        c[2] * (A[1][2] + A[2][1]);\n  p.F = c[0] * c[0] * A[0][0] + c[0] * c[1] * (A[0][1] + A[1][0]) -\n        c[0] * c[2] * (A[0][2] + A[2][0]) + c[1] * c[1] * A[1][1] -\n        c[1] * c[2] * (A[1][2] + A[2][1]) + c[2] * c[2] * A[2][2] - 1.0;\n  return p;\n}\n"];
-f.c=["\nstruct EllipseQuadraticForm {\n  highp float A;  // x*x coefficient\n  highp float B;  // x*y coefficient\n  highp float C;  // y*y coefficient\n  highp float D;  // x coefficient\n  highp float E;  // y coefficient\n  highp float F;  // 1 coefficient\n};\n","\nstruct CenterOrientEllipse {\n  vec2 k;   // center\n  vec2 u1;  // minor axis direction\n  vec2 u2;  // major axis direction\n  float a;  // semimajor axis\n  float b;  // semiminor axis\n  bool valid; // indicates if the ellipse is valid\n};\n",
-"\nCenterOrientEllipse computeCenterOrientEllipse(EllipseQuadraticForm p) {\n  CenterOrientEllipse r;\n  float a11 = p.A;\n  float a12 = p.B / 2.0;\n  float a22 = p.C;\n  float b1 = p.D;\n  float b2 = p.E;\n  float c = p.F;\n  float kdenom = 2.0 * (a12 * a12 - a11 * a22);\n  float k1 = r.k.x = (a22 * b1 - a12 * b2) / kdenom;\n  float k2 = r.k.y = (a11 * b2 - a12 * b1) / kdenom;\n  float mu = 1.0 / (a11 * k1 * k1 + 2.0 * a12 * k1 * k2 + a22 * k2 * k2 - c);\n  float m11 = mu * a11;\n  float m12 = mu * a12;\n  float m22 = mu * a22;\n  float lambdaTerm1 = m11 + m22;\n  float lambdaTerm2 = sqrt((m11 - m22) * (m11 - m22) + 4.0 * m12 * m12);\n  float lambda1 = ((lambdaTerm1 + lambdaTerm2) / 2.0);\n  float lambda2 = ((lambdaTerm1 - lambdaTerm2) / 2.0);\n  r.a = 1.0 / sqrt(lambda1);\n  r.b = 1.0 / sqrt(lambda2);\n  r.valid = lambda1 > 0.0 && lambda2 > 0.0;\n  if (abs(m12) < 1e-10) {\n    r.u1 = vec2(1.0, 0.0);\n  } else if (m11 >= m22) {\n    r.u1 = normalize(vec2(lambda1 - m22, m12));\n  } else {\n    r.u1 = normalize(vec2(m12, lambda1 - m11));\n  }\n  r.u2 = vec2(-r.u1.y, r.u1.x);\n  return r;\n}\n"]},
-function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function p(a,b){for(var c=new Float32Array((a+1)*(b+1)*3),d=0,e=0;e<=a;++e){var g=e*Math.PI/a,f=Math.sin(g);g=Math.cos(g);for(var h=0;h<=b;++h){var n=2*h*Math.PI/b,p=Math.sin(n);
-n=Math.cos(n);c[d++]=n*f;c[d++]=g;c[d++]=p*f}}return c}function n(a,b){for(var c=new Uint16Array(a*b*6),d=0,e=0;e<a;e++)for(var g=0;g<b;g++){var f=e*(b+1)+g,h=f+b+1;c[d++]=f;c[d++]=h;c[d++]=f+1;c[d++]=h;c[d++]=h+1;c[d++]=f+1}return c}a.d(f,"a",function(){return c});h=a(1);var d=a(20),b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,
-c);d&&a(b,d);return b}}(),c=function(a){function c(a,b,e){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var g=(c.__proto__||Object.getPrototypeOf(c)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");g=!g||"object"!==typeof g&&"function"!==typeof g?this:g;g.vertexBuffer=g.registerDisposer(Object(d.b)(a,WebGL2RenderingContext.ARRAY_BUFFER,p,b,e)).value;g.indexBuffer=g.registerDisposer(Object(d.b)(a,WebGL2RenderingContext.ELEMENT_ARRAY_BUFFER,
-n,b,e)).value;g.numIndices=b*e*6;return g}q(c,a);b(c,[{key:"defineShader",value:function(a){a.addAttribute("highp vec3","aSphereVertex");a.addVarying("highp float","vLightingFactor");a.addVertexCode("\nvoid emitSphere(mat4 projectionMatrix, mat4 normalTransformMatrix, vec3 centerPosition, vec3 radii, vec4 lightDirection) {\n  vec3 vertexPosition = aSphereVertex * radii + centerPosition;\n  gl_Position = projectionMatrix * vec4(vertexPosition, 1.0);\n  vec3 normal = normalize((normalTransformMatrix * vec4(aSphereVertex / radii, 0.0)).xyz);\n  vLightingFactor = abs(dot(normal, uLightDirection.xyz)) + uLightDirection.w;\n}\n")}},
-{key:"draw",value:function(a,b){var c=a.attribute("aSphereVertex");this.vertexBuffer.bindToVertexAttrib(c,3,WebGL2RenderingContext.FLOAT,!1);this.indexBuffer.bind();a.gl.drawElementsInstanced(WebGL2RenderingContext.TRIANGLES,this.numIndices,WebGL2RenderingContext.UNSIGNED_SHORT,0,b);a.gl.disableVertexAttribArray(c)}}]);return c}(h.a)},function(h,f,a){f.a=function(a){a=a.getContext("webgl2",{antialias:!1,stencil:!0});if(null==a)throw Error("WebGL not supported.");a.memoize=new q.a;a.maxTextureSize=
-a.getParameter(a.MAX_TEXTURE_SIZE);a.maxTextureImageUnits=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS);a.tempTextureUnit=a.maxTextureImageUnits-1;for(var f=$jscomp.makeIterator(["EXT_color_buffer_float"]),d=f.next();!d.done;d=f.next())if(d=d.value,!a.getExtension(d))throw Error(d+" extension not available");return a};var q=a(98)},function(h,f,a){var q=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,
-c.key,c)}}return function(f,d,b){d&&a(f.prototype,d);b&&a(f,b);return f}}();h=function(){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");}q(a,null,[{key:"insertAfter",value:function(a,d){var b=a.next0;d.next0=b;d.prev0=a;a.next0=d;b.prev0=d}},{key:"insertBefore",value:function(a,d){var b=a.prev0;d.prev0=b;d.next0=a;a.prev0=d;b.next0=d}},{key:"front",value:function(a){var d=a.next0;return d===a?null:d}},{key:"back",value:function(a){var d=a.prev0;return d===
-a?null:d}},{key:"pop",value:function(a){var d=a.next0,b=a.prev0;d.prev0=b;b.next0=d;a.next0=null;a.prev0=null;return a}},{key:"iterator",value:function(a){function d(d,e){for(;;)switch(b){case 0:c=a.next0;case 1:if(c===a){b=3;break}b=4;return{value:c,done:!1};case 4:if(void 0===e){b=5;break}b=-1;throw e;case 5:case 2:c=c.next0;b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,c,e={next:function(a){return d(a,void 0)},throw:function(a){return d(void 0,a)},return:function(a){throw Error("Not yet implemented");
-}};$jscomp.initSymbolIterator();e[Symbol.iterator]=function(){return this};return e}},{key:"reverseIterator",value:function(a){function d(d,e){for(;;)switch(b){case 0:c=a.prev0;case 1:if(c===a){b=3;break}b=4;return{value:c,done:!1};case 4:if(void 0===e){b=5;break}b=-1;throw e;case 5:case 2:c=c.prev0;b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,c,e={next:function(a){return d(a,void 0)},throw:function(a){return d(void 0,a)},return:function(a){throw Error("Not yet implemented");
-}};$jscomp.initSymbolIterator();e[Symbol.iterator]=function(){return this};return e}},{key:"initializeHead",value:function(a){a.next0=a.prev0=a}}]);return a}();f.a=h},function(h,f,a){a.d(f,"a",function(){return p});var q=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}(),p=function(){function a(d){if(!(this instanceof
-a))throw new TypeError("Cannot call a class as a function");this.parents=[];this.parentPriorities=[];this.bindings=new Map;if(void 0!==d){this.parents.push.apply(this.parents,[].concat($jscomp.arrayFromIterable(d.parents)));this.parentPriorities.push.apply(this.parentPriorities,[].concat($jscomp.arrayFromIterable(d.parentPriorities)));d=$jscomp.makeIterator(d.bindings);for(var b=d.next();!b.done;b=d.next()){var c=$jscomp.makeIterator(b.value);b=c.next().value;c=c.next().value;this.bindings.set(b,
-c)}}}q(a,[{key:"addParent",value:function(a,b){for(var c=this,d=this.parents,g=this.parentPriorities,f=0,k=d.length;f<k&&b<g[f];)++f;d.splice(f,0,a);g.splice(f,0,b);return function(){c.removeParent(a)}}},{key:"removeParent",value:function(a){a=this.parents.indexOf(a);if(-1===a)throw Error("Attempt to remove non-existent parent map.");this.parents.splice(a,1);this.parentPriorities.splice(a,1)}},{key:"set",value:function(a,b){this.bindings.set(a,b)}},{key:"delete",value:function(a){this.bindings.delete(a)}},
-{key:"clear",value:function(){this.bindings.clear();this.parents.length=0;this.parentPriorities.length=0}},{key:"get",value:function(a){for(var b=this.parents,c=this.parentPriorities,d=c.length,g=0,f;g<d&&0<c[g];++g)if(f=b[g].get(a),void 0!==f)return f;f=this.bindings.get(a);if(void 0!==f)return f;for(;g<d;++g)if(f=b[g].get(a),void 0!==f)return f}},{key:"getAll",value:function(a){function b(b,e){for(;;)switch(c){case 0:m=r,h=m.parents,k=m.parentPriorities,f=k.length,g=0;case 1:if(!(g<f&&0<k[g])){c=
-2;break}d=h[g].get(a);if(void 0===d){c=3;break}c=4;return{value:d,done:!1};case 4:if(void 0===e){c=5;break}c=-1;throw e;case 5:case 3:c=1;break;case 2:d=r.bindings.get(a);if(void 0===d){c=6;break}c=7;return{value:d,done:!1};case 7:if(void 0===e){c=8;break}c=-1;throw e;case 8:case 6:case 9:if(!(g<f)){c=10;break}d=h[g].get(a);if(void 0===d){c=11;break}c=12;return{value:d,done:!1};case 12:if(void 0===e){c=13;break}c=-1;throw e;case 13:case 11:c=9;break;case 10:c=-1;default:return{value:void 0,done:!0}}}
-var c=0,d,g,f,k,h,m,r=this,n={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();n[Symbol.iterator]=function(){return this};return n}}]);return a}()},function(h,f,a){f.a=function(a){var f=0;switch(a.deltaMode){case 0:f=.005;break;case 1:f=.1;break;case 2:f=2}return Math.exp(a.deltaY*f)}},function(h,f){},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function p(a,b){var c=a.memoize.get({type:"getSharedCredentialsProvider",credentialsProvider:Object(d.a)(b)},function(){return new n.a(b.addRef(),a.rpc)}),e=c.addCounterpartRef();c.dispose();return e}f.a=function(){return function(a){return function(a){function e(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];
-if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var d;c=(d=e.__proto__||Object.getPrototypeOf(e)).call.apply(d,[].concat([this],$jscomp.arrayFromIterable(b)));if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");d=!c||"object"!==typeof c&&"function"!==typeof c?this:c;d.credentialsProvider=b[1].credentialsProvider.addRef();return d}q(e,a);b(e,[{key:"initializeCounterpart",value:function(a,b){b.credentialsProvider=p(this.chunkManager,
-this.credentialsProvider);c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"initializeCounterpart",this).call(this,a,b)}}],[{key:"encodeOptions",value:function(a){var b=c(e.__proto__||Object.getPrototypeOf(e),"encodeOptions",this).call(this,a);b.credentialsProvider=Object(d.a)(a.credentialsProvider);return b}}]);return e}(a)}};var n=a(261),d=a(23),b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=
-!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),c=function g(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return g(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}}},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);
-a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return n});h=a(262);a=a(15);var p=function(){function a(a,c){for(var b=0;b<c.length;b++){var d=c[b];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();f=this&&this.__decorate||function(a,
-b,c,e){var d=arguments.length,f=3>d?b:null===e?e=Object.getOwnPropertyDescriptor(b,c):e,k;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(a,b,c,e);else for(var h=a.length-1;0<=h;h--)if(k=a[h])f=(3>d?k(f):3<d?k(b,c,f):k(b,c))||f;return 3<d&&f&&Object.defineProperty(b,c,f),f};var n=function(a){function b(a,d){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var c=(b.__proto__||Object.getPrototypeOf(b)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-c=!c||"object"!==typeof c&&"function"!==typeof c?this:c;c.provider=a;c.registerDisposer(a);c.initializeCounterpart(d);return c}q(b,a);p(b,[{key:"get",value:function(a,b){return this.provider.get(a,b)}}]);return b}(a.b);n=f([Object(a.g)(h.b)],n);Object(a.d)(h.a,function(a,b){return this.get(a.providerId).get(a.invalidCredentials,b).then(function(a){return{value:a}})})},function(h,f,a){f.b="CredentialsProvider";f.a="CredentialsProvider.get"},function(h,f,a){f.a=function(a){for(var f=0,h=a.length,d=
-0;d<h;++d)f=31*f+a.charCodeAt(d)|0;return f}},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}a.d(f,"d",function(){return n});
-a.d(f,"e",function(){return d});a.d(f,"b",function(){return b});a.d(f,"c",function(){return c});a.d(f,"a",function(){return e});var n;(function(a){a[a.RAW=0]="RAW";a[a.JPEG=1]="JPEG";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION"})(n||(n={}));var d=function l(){p(this,l)};d.RPC_ID="brainmaps/VolumeChunkSource";var b=function k(){p(this,k)};b.RPC_ID="brainmaps/MeshSource";var c=function(a){function b(){p(this,b);var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!a||"object"!==typeof a&&"function"!==typeof a?this:a}q(b,a);return b}(b);c.RPC_ID="brainmaps/SkeletonSource";var e=function t(){p(this,t)};e.RPC_ID="brainmaps/Annotation"},function(h,f,a){f.b="mesh/MeshLayer";f.a="mesh/FragmentSource"},function(h,f,a){f.a="skeleton/SkeletonLayer"},function(h,f,a){Object.defineProperty(f,"__esModule",{value:!0});h=a(150);f=a(103);var q=a(268);h.a.register(f.a,function(){return new q.a})},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return e});var n=a(151),d=a(31),b=a(32),c=a(269),e=function(a){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");
-var a=q(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments));a.get=Object(n.c)(function(a){var e=new d.a(!0),g;return new Promise(function(d,k){function f(a,b){b=void 0===b?"Request authorization.":b;e.setText((void 0===a?"Brain Maps authorization required.":a)+"  ");a=document.createElement("button");a.textContent=b;e.element.appendChild(a);a.addEventListener("click",function(){l(!1)});e.setVisible(!0)}function l(a){void 0!==g&&g.cancel();g=new b.b;f("Waiting for Brain Maps authorization...",
-"Retry");Object(c.a)({clientId:"639403125587-4k5hgdfumtrvur8v48e3pr7oo91d765k.apps.googleusercontent.com",scopes:["https://www.googleapis.com/auth/brainmaps"],immediate:a,authUser:0},g).then(function(a){void 0!==g&&(g=void 0,e.dispose(),d(a))},function(b){void 0!==g&&(g=void 0,a?f():f("Brain Maps authorization failed: "+b+".","Retry"))})}a.add(function(){void 0!==g&&(g.cancel(),g=void 0,e.dispose(),k(b.a))});l(!0)})});return a}p(e,a);return e}(n.b)},function(h,f,a){function q(a,b){if(!(a instanceof
-b))throw new TypeError("Cannot call a class as a function");}function p(a,b){var c=document.createElement("iframe");c.style.display="none";c.id=a;c.name=a;c.src="https://accounts.google.com/o/oauth2/postmessageRelay?"+("parent="+encodeURIComponent(location.origin)+"#rpctoken="+b);document.body.appendChild(c)}f.a=function(a,b){b=void 0===b?n.e:b;var e=Object(c.a)();void 0===t&&(t=new k);var g=t,f=g.makeAuthRequestUrl({state:e,clientId:a.clientId,scopes:a.scopes,approvalPrompt:a.approvalPrompt,loginHint:a.loginHint,
-immediate:a.immediate,authUser:a.authUser}),l=g.addPendingRequest(e);e=new Promise(function(a,b){l.finished.add(function(c,d){void 0!==c?a(c):b(d)})});l.finished.add(b.add(function(){l.finished.dispatch(void 0,n.a)}));if(a.immediate)g.relayReadyPromise.then(function(){if(!b.isCanceled){var a=document.createElement("iframe");a.src=f;a.style.display="none";document.body.appendChild(a);l.finished.add(function(){Object(d.b)(a)})}});else if(!b.isCanceled){var h=open(f);null!==h&&l.finished.add(function(){h.close()})}return e};
-var n=a(32),d=a(8),b=a(4),c=a(136),e=a(7),g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),l=function r(){q(this,r);this.finished=new e.b},k=function(){function a(){var d=this;q(this,a);this.proxyName="postmessageRelay"+Object(c.a)();this.rpcToken=""+Object(c.a)();this.relayReadyService="oauth2relayReady:"+
-this.rpcToken;this.oauth2CallbackService="oauth2callback:"+this.rpcToken;this.pendingRequests=new Map;p(this.proxyName,this.rpcToken);this.relayReadyPromise=new Promise(function(a){addEventListener("message",function(c){if("https://accounts.google.com"===c.origin)try{var e=Object(b.t)(JSON.parse(c.data)),g=Object(b.A)(e.s);g===d.relayReadyService&&a();if(g===d.oauth2CallbackService){var k=Object(b.a)(e.a,function(a){return a}),f=Object(b.A)(k[0]),l=location.origin;if(!f.startsWith(l+"#")&&!f.startsWith(l+
-"?"))throw Error("oauth2callback: URL "+JSON.stringify(f)+" "+("does not match current origin "+l+"."));for(var h=f.substring(l.length+1).split("&"),r=new Map,n=$jscomp.makeIterator(h),t=n.next();!t.done;t=n.next()){var p=t.value.match("^([a-z_]+)=(.*)$");if(null===p)throw Error("oauth2callback: URL part "+JSON.stringify(p)+" does not match expected pattern.");r.set(p[1],p[2])}var q=r.get("state");if(void 0===q)throw Error("oauth2callback: State argument is missing.");var u=d.pendingRequests.get(q);
-if(void 0!==u){var v=r.get("error");if(void 0!==v){var w=r.get("error_subtype");e=v;void 0!==w&&(e+=": "+w);u.finished.dispatch(void 0,Error("Error obtaining Google OAuth2 token: "+e))}else{var P=r.get("access_token"),N=r.get("token_type"),S=r.get("expires_in"),U=r.get("scope");if(void 0===P||void 0===N||void 0===S||void 0===U)throw Error("oauth2callback: URL lacks expected parameters.");u.finished.dispatch({accessToken:P,tokenType:N,expiresIn:S,scope:U})}}}}catch(Z){throw Error("Invalid message received from https://accounts.google.com: "+
-JSON.stringify(c.data)+": "+(Z.message+"."));}})})}g(a,[{key:"addPendingRequest",value:function(a){var b=this,c=new l;this.pendingRequests.set(a,c);c.finished.add(function(){b.pendingRequests.delete(a)});return c}},{key:"makeAuthRequestUrl",value:function(a){var b="https://accounts.google.com/o/oauth2/auth?client_id="+encodeURIComponent(a.clientId);b=b+"&redirect_uri=postmessage&response_type=token"+("&origin="+encodeURIComponent(void 0===a.origin?location.origin:a.origin));b+="&proxy="+this.proxyName;
-b=b+"&include_granted_scopes=true"+("&scope="+encodeURIComponent(a.scopes.join(" ")));a.state&&(b+="&state="+a.state);a.approvalPrompt&&(b+="&approval_prompt="+encodeURIComponent(a.approvalPrompt));a.loginHint&&(b+="&login_hint="+encodeURIComponent(a.loginHint));a.immediate&&(b+="&immediate=true");void 0!==a.authUser&&(b+="&authuser="+a.authUser);return b}}]);return a}(),t},function(h,f,a){Object.defineProperty(f,"__esModule",{value:!0});var q=a(131),p=a(103);h=a(41);Object(h.b)("brainmaps",function(a){return new q.BrainmapsDataSource(q.productionInstance,
-a.credentialsManager.getCredentialsProvider(p.a))})},function(h,f,a){Object.defineProperty(f,"__esModule",{value:!0});var q=a(106);h=a(41);Object(h.b)("ndstore",function(){return new q.NDStoreDataSource})},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}a.d(f,"c",function(){return d});a.d(f,"d",function(){return b});a.d(f,"b",function(){return c});a.d(f,"a",function(){return e});var d;(function(a){a[a.JPEG=0]="JPEG";a[a.RAW=1]="RAW";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION";
-a[a.COMPRESSED_SEGMENTATIONARRAY=3]="COMPRESSED_SEGMENTATIONARRAY"})(d||(d={}));h=function l(){n(this,l)};var b=function(a){function b(){n(this,b);return q(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}p(b,a);return b}(h);b.RPC_ID="dvid/VolumeChunkSource";var c=function(a){function b(){n(this,b);return q(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}p(b,a);return b}(h);c.RPC_ID="dvid/SkeletonSource";var e=function(a){function b(){n(this,b);return q(this,
-(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}p(b,a);return b}(h);e.RPC_ID="dvid/MeshSource"},function(h,f,a){Object.defineProperty(f,"__esModule",{value:!0});var q=a(153);h=a(41);Object(h.b)("dvid",function(){return new q.DVIDDataSource})},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}a.d(f,"b",function(){return d});a.d(f,"a",function(){return b});h=function(a){function b(){n(this,b);return q(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}p(b,a);return b}(function e(){n(this,e)});
-var d=function(a){function b(){n(this,b);return q(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}p(b,a);return b}(h);d.RPC_ID="render/TileChunkSource";var b=function(a){function b(){n(this,b);return q(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}p(b,a);return b}(h);b.RPC_ID="render/PointMatchSource"},function(h,f,a){Object.defineProperty(f,"__esModule",{value:!0});h=a(41);var q=a(154);Object(h.b)("render",function(){return new q.RenderDataSource})},function(h,
-f,a){Object.defineProperty(f,"__esModule",{value:!0});var q=a(157);h=a(41);Object(h.b)("openconnectome",function(){return new q.OpenConnectomeDataSource})},function(h,f,a){function q(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}a.d(f,"b",function(){return p});a.d(f,"c",function(){return n});a.d(f,"a",function(){return d});var p;(function(a){a[a.RAW=0]="RAW";a[a.JPEG=1]="JPEG";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION"})(p||(p={}));var n=function c(){q(this,
-c)};n.RPC_ID="precomputed/VolumeChunkSource";var d=function e(){q(this,e)};d.RPC_ID="precomputed/MeshSource"},function(h,f,a){Object.defineProperty(f,"__esModule",{value:!0});var q=a(158);h=a(41);Object(h.b)("precomputed",function(){return new q.PrecomputedDataSource})},function(h,f,a){a.d(f,"b",function(){return p});f.a="nifti/getNiftiVolumeInfo";var q;(function(a){a[a.NONE=0]="NONE";a[a.BINARY=1]="BINARY";a[a.UINT8=2]="UINT8";a[a.INT16=4]="INT16";a[a.INT32=8]="INT32";a[a.FLOAT32=16]="FLOAT32";a[a.COMPLEX64=
-32]="COMPLEX64";a[a.FLOAT64=64]="FLOAT64";a[a.RGB24=128]="RGB24";a[a.INT8=256]="INT8";a[a.UINT16=512]="UINT16";a[a.UINT32=768]="UINT32";a[a.INT64=1024]="INT64";a[a.UINT64=1280]="UINT64";a[a.FLOAT128=1536]="FLOAT128";a[a.COMPLEX128=1792]="COMPLEX128";a[a.COMPLEX256=2048]="COMPLEX256"})(q||(q={}));var p=function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");};p.RPC_ID="nifti/VolumeChunkSource"},function(h,f,a){Object.defineProperty(f,"__esModule",{value:!0});var q=
-a(159);h=a(41);Object(h.b)("nifti",function(){return new q.NiftiDataSource})},function(h,f){},function(h,f){},function(h,f){},function(h,f){},function(h,f){},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&
-b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return c});h=a(1);var n=a(8),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),b=function g(a,b,c){null===a&&(a=Function.prototype);var d=
-Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return g(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},c=function(a){function c(a){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var b=q(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));b.model=a;b.element=document.createElement("input");var d=b.element;d.classList.add("neuroglancer-color-widget");d.type="color";d.addEventListener("change",
-function(){return b.updateModel()});b.registerDisposer(a.changed.add(function(){return b.updateView()}));b.updateView();return b}p(c,a);d(c,[{key:"updateView",value:function(){this.element.value=this.model.toString()}},{key:"updateModel",value:function(){this.model.restoreState(this.element.value)}},{key:"disposed",value:function(){Object(n.b)(this.element);b(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(h.a)},function(h,f){},function(h,f){},function(h,
-f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return b});
-h=a(290);a.n(h);h=a(40);var n=a(165),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),b=function(a){function b(a){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var c=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.transform=a;c.textArea=document.createElement("textarea");
-c.modelGeneration=-1;var d=c.element;d.classList.add("neuroglancer-coordinate-transform-widget");var e=c.textArea,g=document.createElement("label");g.className="neuroglancer-coordinate-transform-widget-homogeneous";g.textContent="3\u00d74 Homogeneous transformation matrix";g.appendChild(e);d.appendChild(g);c.registerDisposer(a.changed.add(function(){return c.updateView()}));c.registerDisposer(c.visibility.changed.add(function(){return c.updateView()}));e.addEventListener("change",function(){return c.updateModel()});
-e.addEventListener("blur",function(){return c.updateModel()});e.title="Homogeneous transformation matrix";e.rows=3;a=document.createElement("button");a.textContent="Reset to identity";a.addEventListener("click",function(){return c.transform.reset()});d.appendChild(a);c.updateView();return c}p(b,a);d(b,[{key:"updateView",value:function(){if(this.visible){var a=this.transform.changed.count;if(this.modelGeneration!==a){for(var b="",c=this.transform.transform,d=0;3>d;++d){0!==d&&(b+="\n");for(var e=0;4>
-e;++e){var f=c[4*e+d];0!==e&&(b+=" ");b+=Object(n.a)(f)}}this.textArea.value=b;this.modelGeneration=a}}}},{key:"updateModel",value:function(){var a=this.textArea.value.split(/[\s,\[\]\(\)\{\}]/).filter(function(a){return 0<a.length});if(12===a.length){for(var b=[],c=0;12>c;++c){var d=parseFloat(a[c]);if(Number.isNaN(d))return!1;b[c]=d}a=this.transform.transform;a[3]=a[7]=a[10]=0;a[15]=1;for(c=0;4>c;++c)for(d=0;3>d;++d)a[4*c+d]=b[c+4*d];this.transform.changed.dispatch();return!0}return!1}}]);return b}(h.b)},
-function(h,f){},function(h,f,a){(function(a){function f(b,c){function d(b){if(!e.parentNode)return a.off(document,"mousemove",d);e.style.top=Math.max(0,b.clientY-e.offsetHeight-5)+"px";e.style.left=b.clientX+5+"px"}var e=document.createElement("div");e.className="CodeMirror-lint-tooltip";e.appendChild(c.cloneNode(!0));document.body.appendChild(e);a.on(document,"mousemove",d);d(b);null!=e.style.opacity&&(e.style.opacity=1);return e}function h(a){a.parentNode&&(null==a.style.opacity&&a.parentNode&&
-a.parentNode.removeChild(a),a.style.opacity=0,setTimeout(function(){a.parentNode&&a.parentNode.removeChild(a)},600))}function d(b,c,d){function e(){a.off(d,"mouseout",e);g&&(h(g),g=null)}var g=f(b,c),k=setInterval(function(){if(g)for(var a=d;;a=a.parentNode){a&&11==a.nodeType&&(a=a.host);if(a==document.body)return;if(!a){e();break}}if(!g)return clearInterval(k)},400);a.on(d,"mouseout",e)}function b(a,b,c){this.marked=[];this.options=b;this.timeout=null;this.hasGutter=c;this.onMouseOver=function(b){var c=
-b.target||b.srcElement;if(/\bCodeMirror-lint-mark-/.test(c.className)){c=c.getBoundingClientRect();var e=a.findMarksAt(a.coordsChar({left:(c.left+c.right)/2,top:(c.top+c.bottom)/2},"client"));c=[];for(var k=0;k<e.length;++k){var f=e[k].__annotation;f&&c.push(f)}if(c.length){e=b.target||b.srcElement;k=document.createDocumentFragment();for(f=0;f<c.length;f++)k.appendChild(g(c[f]));d(b,k,e)}}};this.waitingFor=0}function c(a){var b=a.state.lint;b.hasGutter&&a.clearGutter("CodeMirror-lint-markers");for(a=
-0;a<b.marked.length;++a)b.marked[a].clear();b.marked.length=0}function e(b,c,e,g){var k=document.createElement("div"),f=k;k.className="CodeMirror-lint-marker-"+c;e&&(f=k.appendChild(document.createElement("div")),f.className="CodeMirror-lint-marker-multiple");if(0!=g)a.on(f,"mouseover",function(a){d(a,b,f)});return k}function g(a){var b=a.severity;b||(b="error");var c=document.createElement("div");c.className="CodeMirror-lint-message-"+b;"undefined"!=typeof a.messageHTML?c.innerHTML=a.messageHTML:
-c.appendChild(document.createTextNode(a.message));return c}function l(b,c,d){function e(){k=-1;b.off("change",e)}var g=b.state.lint,k=++g.waitingFor;b.on("change",e);c(b.getValue(),function(c,d){b.off("change",e);g.waitingFor==k&&(d&&c instanceof a&&(c=d),t(b,c))},d,b)}function k(b){var c=b.state.lint.options,d=c.options||c,e=c.getAnnotations||b.getHelper(a.Pos(0,0),"lint");e&&(c.async||e.async?l(b,e,d):(c=e(b.getValue(),d,b))&&(c.then?c.then(function(a){t(b,a)}):t(b,c)))}function t(a,b){c(a);for(var d=
-a.state.lint,k=d.options,f=[],l=0;l<b.length;++l){var h=b[l],m=h.from.line;(f[m]||(f[m]=[])).push(h)}for(l=0;l<f.length;++l)if(h=f[l]){m=null;for(var r=d.hasGutter&&document.createDocumentFragment(),n=0;n<h.length;++n){var t=h[n],p=t.severity;p||(p="error");"error"!=m&&(m=p);k.formatAnnotation&&(t=k.formatAnnotation(t));d.hasGutter&&r.appendChild(g(t));t.to&&d.marked.push(a.markText(t.from,t.to,{className:"CodeMirror-lint-mark-"+p,__annotation:t}))}d.hasGutter&&a.setGutterMarker(l,"CodeMirror-lint-markers",
-e(r,m,1<h.length,d.options.tooltips))}if(k.onUpdateLinting)k.onUpdateLinting(b,f,a)}function m(a){var b=a.state.lint;b&&(clearTimeout(b.timeout),b.timeout=setTimeout(function(){k(a)},b.options.delay||500))}a.defineOption("lint",!1,function(d,e,g){g&&g!=a.Init&&(c(d),!1!==d.state.lint.options.lintOnChange&&d.off("change",m),a.off(d.getWrapperElement(),"mouseover",d.state.lint.onMouseOver),clearTimeout(d.state.lint.timeout),delete d.state.lint);if(e){var f=d.getOption("gutters");g=!1;for(var l=0;l<
-f.length;++l)"CodeMirror-lint-markers"==f[l]&&(g=!0);f=d.state;e instanceof Function?e={getAnnotations:e}:e&&!0!==e||(e={});g=f.lint=new b(d,e,g);if(!1!==g.options.lintOnChange)d.on("change",m);if(0!=g.options.tooltips&&"gutter"!=g.options.tooltips)a.on(d.getWrapperElement(),"mouseover",g.onMouseOver);k(d)}});a.defineExtension("performLint",function(){this.state.lint&&k(this)})})(a(48))},function(h,f){},function(h,f){h.exports=function(a){function f(a){var b={};a=a.split(" ");for(var c=0;c<a.length;++c)b[a[c]]=
-!0;return b}a.defineMode("glsl",function(a,b){function c(a,b){var c=a.next();if(y[c]){var e=y[c](a,b);if(!1!==e)return e}if('"'==c||"'"==c)return b.tokenize=d(c),b.tokenize(a,b);if(/[\[\]{}\(\),;\:\.]/.test(c))return z=c,"bracket";if(/\d/.test(c))return a.eatWhile(/[\w\.]/),"number";if("/"==c){if(a.eat("*"))return b.tokenize=g,g(a,b);if(a.eat("/"))return a.skipToEnd(),"comment"}if("#"==c)return a.eatWhile(/[\S]+/),a.eatWhile(/[\s]+/),a.eatWhile(/[\S]+/),a.eatWhile(/[\s]+/),"comment";if(A.test(c))return a.eatWhile(A),
-"operator";a.eatWhile(/[\w\$_]/);a=a.current();return r.propertyIsEnumerable(a)?(q.propertyIsEnumerable(a)&&(z="newstatement"),"keyword"):p.propertyIsEnumerable(a)?"builtin":w.propertyIsEnumerable(a)?"atom":"word"}function d(a){return function(b,d){for(var e=!1,g,k=!1;null!=(g=b.next());){if(g==a&&!e){k=!0;break}e=!e&&"\\"==g}if(k||!e&&!x)d.tokenize=c;return"string"}}function g(a,b){for(var d=!1,e;e=a.next();){if("/"==e&&d){b.tokenize=c;break}d="*"==e}return"comment"}function l(a,b,c,d,e){this.indented=
-a;this.column=b;this.type=c;this.align=d;this.prev=e}function k(a,b,c){return a.context=new l(a.indented,b,c,null,a.context)}function t(a){var b=a.context.type;if(")"==b||"]"==b||"}"==b)a.indented=a.context.indented;return a.context=a.context.prev}var m=a.indentUnit,r=b.keywords||f(h),p=b.builtins||f(n),q=b.blockKeywords||f("case do else for if switch while struct"),w=b.atoms||f("null"),y=b.hooks||{},x=b.multiLineStrings,A=/[+\-*&%=<>!?|\/]/,z;return{startState:function(a){return{tokenize:null,context:new l((a||
-0)-m,0,"top",!1),indented:0,startOfLine:!0}},token:function(a,b){var d=b.context;a.sol()&&(null==d.align&&(d.align=!1),b.indented=a.indentation(),b.startOfLine=!0);if(a.eatSpace())return null;z=null;var e=(b.tokenize||c)(a,b);if("comment"==e||"meta"==e)return e;null==d.align&&(d.align=!0);if(";"!=z&&":"!=z||"statement"!=d.type)if("{"==z)k(b,a.column(),"}");else if("["==z)k(b,a.column(),"]");else if("("==z)k(b,a.column(),")");else if("}"==z){for(;"statement"==d.type;)d=t(b);for("}"==d.type&&(d=t(b));"statement"==
-d.type;)d=t(b)}else z==d.type?t(b):("}"==d.type||"top"==d.type||"statement"==d.type&&"newstatement"==z)&&k(b,a.column(),"statement");else t(b);b.startOfLine=!1;return e},indent:function(a,b){if(a.tokenize!=c&&null!=a.tokenize)return 0;b=b&&b.charAt(0);a=a.context;var d=b==a.type;return"statement"==a.type?a.indented+("{"==b?0:m):a.align?a.column+(d?0:1):a.indented+(d?0:m)},electricChars:"{}"}});var h="attribute const uniform varying break continue do for while if else in out inout float int void bool true false lowp mediump highp precision invariant discard return mat2 mat3 mat4 vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 sampler2D samplerCube struct gl_FragCoord gl_FragColor",
-n="radians degrees sin cos tan asin acos atan pow exp log exp2 log2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not dFdx dFdy fwidth texture2D texture2DProj texture2DLod texture2DProjLod textureCube textureCubeLod require export";a.defineMIME("text/x-glsl",{name:"glsl",keywords:f(h),builtins:f(n),blockKeywords:f("case do else for if switch while struct"),
-atoms:f("null"),hooks:{"#":function(a,b){if(!b.startOfLine)return!1;a.skipToEnd();return"meta"}}})}},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a,b,c,d){d=void 0===d?{}:d;return e.a.forPromise(new Promise(function(e){e(a.getVectorGraphicsSource(b,c,d))}),{initialMessage:"Retrieving metadata for vector graphics source "+c+".",delay:!0,errorPrefix:"Error retrieving metadata for vector graphics source "+c+": "})}Object.defineProperty(f,"__esModule",
-{value:!0});a.d(f,"VectorGraphicsUserLayer",function(){return x});h=a(18);f=a(27);var b=a(155),c=a(295),e=a(31),g=a(56),l=a(173),k=a(174),t=a(2),m=a(4),r=a(81),u=a(40),v=a(296),w=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),y=function E(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,
-b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return E(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a(171);a(172);var x=function(a){function e(a,f){q(this,e);var h=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a,f));h.opacity=Object(g.a)(.5);h.lineWidth=Object(l.a)(10);h.color=Object(k.a)(t.s.fromValues(1,1,1));h.opacity.restoreState(f.opacity);h.lineWidth.restoreState(f.linewidth);h.color.restoreState(f.color);h.lineWidth.changed.add(function(){h.specificationChanged.dispatch()});
-h.color.changed.add(function(){h.specificationChanged.dispatch()});h.vectorGraphicsLayerType=Object(m.m)(f.type,b.b);f=h.vectorGraphicsPath=Object(m.y)(f.source);var r=0;void 0!==f&&(++r,h.vectorGraphicsLayerType===b.b.LINE&&d(a.dataSourceProvider,a.chunkManager,f).then(function(a){h.wasDisposed||(a=h.renderLayer=new c.a(a,{opacity:h.opacity,lineWidth:h.lineWidth,color:h.color,sourceOptions:{}}),h.addRenderLayer(a),0===--r&&(h.isReady=!0))}));h.tabs.add("rendering",{label:"Rendering",order:-100,getter:function(){return new A(h)}});
-h.tabs.default="rendering";return h}n(e,a);w(e,[{key:"toJSON",value:function(){var a=y(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"toJSON",this).call(this);a.type=this.getLayerType();a.source=this.vectorGraphicsPath;a.opacity=this.opacity.toJSON();a.linewidth=this.lineWidth.toJSON();a.color=this.color.toJSON();return a}},{key:"getLayerType",value:function(){return b.b[this.vectorGraphicsLayerType].toLowerCase()}}]);return e}(h.i),A=function(a){function b(a){q(this,b);var c=p(this,(b.__proto__||
-Object.getPrototypeOf(b)).call(this));c.layer=a;c.opacityWidget=c.registerDisposer(new r.a(c.layer.opacity));c.lineWidthWidget=c.registerDisposer(new r.a(c.layer.lineWidth,{min:0,max:50,step:1}));c.colorWidget=c.registerDisposer(new z(c.layer.color));a=c.element;a.classList.add("image-dropdown");var d=c.opacityWidget,e=c.lineWidthWidget,g=c.colorWidget,f=document.createElement("div");f.className="image-dropdown-top-row";d.promptElement.textContent="Opacity";e.promptElement.textContent="Line Width";
-g.promptElement.textContent="Color";d=document.createElement("div");d.style.flex="1";e=document.createElement("a");g=document.createElement("button");g.type="button";g.textContent="?";g.className="help-link";e.appendChild(g);e.title="Documentation on vector graphics layer rendering";e.target="_blank";e.href="https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/vectorgraphics_layer_rendering.md";f.appendChild(d);f.appendChild(e);a.appendChild(f);a.appendChild(c.opacityWidget.element);
-a.appendChild(c.lineWidthWidget.element);a.appendChild(c.colorWidget.element);return c}n(b,a);return b}(u.b),z=function(a){function b(a){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a))}n(b,a);w(b,[{key:"verifyValue",value:function(a){a=Object(m.n)(a);a/=255;return 0>a?0:1<a?1:a}},{key:"updateInput",value:function(){this.inputx.valueAsNumber=Math.round(255*this.model.value[0]);this.inputy.valueAsNumber=Math.round(255*this.model.value[1]);this.inputz.valueAsNumber=Math.round(255*
-this.model.value[2])}}]);return b}(v.a);Object(f.e)("line",x)},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?
-Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return m});var n=a(30);h=a(156);var d=a(56),b=a(173),c=a(174),e=a(2),g=a(20),l=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),k=function u(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=
-Object.getPrototypeOf(a),null!==a)return u(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},t=e.k.create(),m=function(a){function f(a,k){var l=void 0===k?{}:k;k=void 0===l.opacity?Object(d.a)(.5):l.opacity;var h=void 0===l.lineWidth?Object(b.a)(10):l.lineWidth,m=void 0===l.color?Object(c.a)(e.s.fromValues(255,255,255)):l.color;l=void 0===l.sourceOptions?{}:l.sourceOptions;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var n=q(this,
-(f.__proto__||Object.getPrototypeOf(f)).call(this,a,{sourceOptions:l}));n.opacity=k;n.registerDisposer(k.changed.add(function(){n.redrawNeeded.dispatch()}));n.lineWidth=h;n.registerDisposer(h.changed.add(function(){n.redrawNeeded.dispatch()}));n.color=m;n.registerDisposer(m.changed.add(function(){n.redrawNeeded.dispatch()}));a=n.gl;k=new Float32Array([1,0,0,1,1,0,0,1]);n.vertexIndexBuffer=n.registerDisposer(g.a.fromData(a,k,a.ARRAY_BUFFER,a.STATIC_DRAW));k=new Float32Array([1,1,-1,-1]);n.normalDirectionBuffer=
-n.registerDisposer(g.a.fromData(a,k,a.ARRAY_BUFFER,a.STATIC_DRAW));return n}p(f,a);l(f,[{key:"getShaderKey",value:function(){return"vectorgraphics.VectorGraphicsLineRenderLayer"}},{key:"defineShader",value:function(a){k(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"defineShader",this).call(this,a);a.addUniform("highp float","uOpacity");a.addUniform("highp float","ulineWidth");a.addUniform("highp vec3","uColor");a.addVarying("vec3","vNormal");a.addAttribute("highp float","aNormalDirection");
-a.addAttribute("highp vec2","aVertexIndex");a.addAttribute("highp vec3","aVertexFirst");a.addAttribute("highp vec3","aVertexSecond");a.addUniform("highp mat4","uProjection");a.setFragmentMain("\nfloat distance = length(vNormal);\n\nfloat antialiasing = 0.5;\n\nif (distance >= 1.0 - antialiasing) {\n  emitRGBA(vec4(uColor, (distance - 1.0) / -antialiasing ));\n}\nelse if (distance < 1.0 - antialiasing) {\n  emitRGB(uColor);\n}\n");a.setVertexMain("\nvec3 direction = vec3(0., 0., 0.);\ndirection.z = aNormalDirection;\n\nvec3 difference = aVertexSecond - aVertexFirst;\ndifference.z = 0.;\n\nvec3 normal = cross(difference, direction);\nnormal = normalize(normal);\nvNormal = normal;\n\nvec4 delta = vec4(normal * ulineWidth, 0.0);\nvec4 pos = vec4(aVertexFirst * aVertexIndex.x + aVertexSecond * aVertexIndex.y, 1.0);\n\ngl_Position = uProjection * (pos + delta);\n")}},
-{key:"beginSlice",value:function(a){k(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"beginSlice",this).call(this,a);a=this.gl;var b=this.shader;a.uniform1f(b.uniform("uOpacity"),this.opacity.value);a.uniform1f(b.uniform("ulineWidth"),this.lineWidth.value);a.uniform3fv(b.uniform("uColor"),this.color.value);this.vertexIndexBuffer.bindToVertexAttrib(b.attribute("aVertexIndex"),2);this.normalDirectionBuffer.bindToVertexAttrib(b.attribute("aNormalDirection"),1);return b}},{key:"endSlice",value:function(a){var b=
-this.gl;b.disableVertexAttribArray(a.attribute("aVertexIndex"));b.disableVertexAttribArray(a.attribute("aNormalDirection"));b.disableVertexAttribArray(a.attribute("aVertexFirst"));b.disableVertexAttribArray(a.attribute("aVertexSecond"))}},{key:"draw",value:function(a){var b=a.visibleLayers.get(this);if(0!==b.length){var c=this.gl,d=this.beginSlice(a);if(void 0===d)console.log("error: shader undefined");else{b=$jscomp.makeIterator(b);for(var g=b.next();!g.done;g=b.next()){g=g.value;var f=g.chunkLayout,
-k=g.source,l=k.spec.voxelSize;g=k.chunks;var h=t;e.k.identity(h);k.vectorGraphicsCoordinatesInVoxels&&e.k.scale(h,h,l);e.k.multiply(h,f.transform,h);c.uniformMatrix4fv(d.uniform("uProjection"),!1,e.k.multiply(t,a.dataToDevice,h));if(f=a.visibleChunks.get(f))for(f=$jscomp.makeIterator(f),k=f.next();!k.done;k=f.next())if((k=g.get(k.value))&&k.state===n.d.GPU_MEMORY){l=k.numPoints/2;h=d.attribute("aVertexFirst");k.vertexBuffer.bindToVertexAttrib(h,3,WebGL2RenderingContext.FLOAT,!1,24,0);c.vertexAttribDivisor(h,
-1);var m=d.attribute("aVertexSecond");k.vertexBuffer.bindToVertexAttrib(m,3,WebGL2RenderingContext.FLOAT,!1,24,12);c.vertexAttribDivisor(m,1);c.drawArraysInstanced(c.TRIANGLE_STRIP,0,4,l);c.vertexAttribDivisor(h,0);c.vertexAttribDivisor(m,0)}}this.endSlice(d)}}}}]);return f}(h.a)},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&
-null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return g});h=a(1);var n=a(2),d=a(4),b=a(7),c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,
-d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),e=function k(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return k(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a(297);var g=function(a){function g(a){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var c=q(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));
-c.model=a;c.promptElement=document.createElement("span");c.element=document.createElement("label");c.inputx=document.createElement("input");c.inputy=document.createElement("input");c.inputz=document.createElement("input");c.valueEntered=new b.b;a=c.inputx;var d=c.inputy,e=c.inputz,f=c.element,k=c.promptElement;f.className="vec3-input-row";k.className="vec3-input-label";f.appendChild(k);f.appendChild(a);f.appendChild(d);f.appendChild(e);a.type=d.type=e.type="number";c.updateInput();f=function(){c.model.value=
-c.getVec3Values()};c.registerEventListener(a,"change",f);c.registerEventListener(d,"change",f);c.registerEventListener(e,"change",f);c.model.changed.add(function(){c.updateInput()});return c}p(g,a);c(g,[{key:"getVec3Values",value:function(){var a=n.s.create();a[0]=this.verifyValue(this.inputx.valueAsNumber);a[1]=this.verifyValue(this.inputy.valueAsNumber);a[2]=this.verifyValue(this.inputz.valueAsNumber);return a}},{key:"verifyValue",value:function(a){return Object(d.n)(a)}},{key:"updateInput",value:function(){this.inputx.valueAsNumber=
-this.model.value[0];this.inputy.valueAsNumber=this.model.value[1];this.inputz.valueAsNumber=this.model.value[2]}},{key:"disposed",value:function(){var a=this.inputx,b=this.inputy,c=this.inputz,d=this.element;a.parentElement&&a.parentElement.removeChild(a);b.parentElement&&b.parentElement.removeChild(b);c.parentElement&&c.parentElement.removeChild(c);d.parentElement&&d.parentElement.removeChild(d);e(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",this).call(this)}}]);return g}(h.a)},
-function(h,f){},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return g});var p=a(299),n=a(4),d=a(7),b=a(14);h=a(15);var c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=
-d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),e=function m(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return m(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};f=this&&this.__decorate||function(a,b,c,d){var e=arguments.length,g=3>e?b:null===d?d=Object.getOwnPropertyDescriptor(b,
-c):d,f;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)g=Reflect.decorate(a,b,c,d);else for(var k=a.length-1;0<=k;k--)if(f=a[k])g=(3>e?f(g):3<e?f(b,c,g):f(b,c))||g;return 3<e&&g&&Object.defineProperty(b,c,g),g};var g=function(a){function g(){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var a=(g.__proto__||Object.getPrototypeOf(g)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a.disjointSets=new p.a;a.changed=new d.a;return a}q(g,a);c(g,[{key:"disposed",value:function(){this.changed=this.disjointSets=void 0;e(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",this).call(this)}},{key:"link",value:function(a,b){if(this.disjointSets.link(a,b)){var c=this.rpc;c&&c.invoke("DisjointUint64Sets.add",{id:this.rpcId,al:a.low,ah:a.high,bl:b.low,bh:b.high});this.changed.dispatch()}}},{key:"get",value:function(a){return this.disjointSets.get(a)}},
-{key:"clear",value:function(){if(this.disjointSets.clear()){var a=this.rpc;a&&a.invoke("DisjointUint64Sets.clear",{id:this.rpcId});this.changed.dispatch()}}},{key:"setElements",value:function(a){return this.disjointSets.setElements(a)}},{key:"toJSON",value:function(){return this.disjointSets.toJSON()}},{key:"restoreState",value:function(a){var c=this;this.clear();if(void 0!==a){var d=[new b.a,new b.a];Object(n.a)(a,function(a){Object(n.a)(a,function(a,b){d[b%2].parseString(String(a),10);0!==b&&c.link(d[0],
-d[1])})})}}},{key:"size",get:function(){return this.disjointSets.size}}],[{key:"makeWithCounterpart",value:function(a){var b=new this;b.initializeCounterpart(a);return b}}]);return g}(h.c);g=f([Object(h.f)("DisjointUint64Sets")],g);var l=new b.a,k=new b.a;Object(h.e)("DisjointUint64Sets.add",function(a){var b=this.get(a.id);l.low=a.al;l.high=a.ah;k.low=a.bl;k.high=a.bh;b.disjointSets.link(l,k)&&b.changed.dispatch()});Object(h.e)("DisjointUint64Sets.clear",function(a){a=this.get(a.id);a.disjointSets.clear()&&
-a.changed.dispatch()})},function(h,f,a){function q(a){for(var b=a,d=a[c];d!==a;)a=d,d=a[c];for(a=b[c];d!==a;)b[c]=d,b=a,a=b[c];return d}function p(a){function b(b,f){for(;;)switch(c){case 0:g=!0,d=a;case 1:if(!g&&d===a){c=3;break}c=4;return{value:d,done:!1};case 4:if(void 0===f){c=5;break}c=-1;throw f;case 5:d=d[e];case 2:g=!1;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,d,g,f={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");
-}};$jscomp.initSymbolIterator();f[Symbol.iterator]=function(){return this};return f}a.d(f,"a",function(){return k});var n=a(14),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();$jscomp.initSymbol();var b=Symbol("disjoint_sets:rank");$jscomp.initSymbol();var c=Symbol("disjoint_sets:parent");$jscomp.initSymbol();
-var e=Symbol("disjoint_sets:next");$jscomp.initSymbol();var g=Symbol("disjoint_sets:prev");$jscomp.initSymbol();var l=Symbol("disjoint_sets:min"),k=function(){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.map=new Map;this.generation=0}$jscomp.initSymbol();$jscomp.initSymbolIterator();d(a,[{key:"get",value:function(a){var b=this.map.get(a.toString());return void 0===b?a:q(b)[l]}},{key:"isMinElement",value:function(a){var b=this.get(a);return b===
-a||n.a.equal(b,a)}},{key:"makeSet",value:function(a){var d=a.toString(),f=this.map,k=f.get(d);return void 0===k?(a=k=a.clone(),a[c]=a,a[b]=0,a[e]=a[g]=a,k[l]=k,f.set(d,k),k):q(k)}},{key:"link",value:function(a,d){a=this.makeSet(a);d=this.makeSet(d);if(a===d)return!1;this.generation++;var f=a;var k=d,h=f[b],m=k[b];h>m?k[c]=f:(f[c]=k,h===m&&(k[b]=m+1),f=k);k=a;h=d;m=k[g];var r=h[g];h[g]=m;m[e]=h;k[g]=r;r[e]=k;a=a[l];d=d[l];f[l]=n.a.less(a,d)?a:d;return!0}},{key:"setElements",value:function(a){function b(b,
-l){for(;;)switch(c){case 0:f=a.toString();g=k.map.get(f);if(void 0!==g){c=1;break}c=3;return{value:a,done:!1};case 3:if(void 0===l){c=4;break}c=-1;throw l;case 4:c=2;break;case 1:e=$jscomp.makeIterator(p(g));case 5:if((d=e.next(b)).done){c=6;break}c=7;return{value:d.value,done:!1};case 7:if(void 0===l){c=8;break}c=-1;throw l;case 8:c=5;break;case 6:case 2:c=-1;default:return{value:void 0,done:!0}}}var c=0,d,e,g,f,k=this,l={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},
-return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();l[Symbol.iterator]=function(){return this};return l}},{key:"clear",value:function(){var a=this.map;if(0===a.size)return!1;++this.generation;a.clear();return!0}},{key:"mappings",value:function(a){function b(b,k){for(;;)switch(c){case 0:a=void 0===a?Array(2):a,g=$jscomp.makeIterator(f.map.values()),e=g.next();case 1:if(e.done){c=3;break}d=e.value;a[0]=d;a[1]=q(d)[l];c=4;return{value:a,done:!1};case 4:if(void 0===k){c=
-5;break}c=-1;throw k;case 5:case 2:e=g.next();c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,d,e,g,f=this,k={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();k[Symbol.iterator]=function(){return this};return k}},{key:Symbol.iterator,value:function(){return this.mappings()}},{key:"toJSON",value:function(){for(var a=[],b=$jscomp.makeIterator(this.map.values()),d=b.next();!d.done;d=
-b.next()){var e=d.value;if(e[c]===e){d=[];e=$jscomp.makeIterator(p(e));for(var g=e.next();!g.done;g=e.next())d.push(g.value);d.sort(n.a.compare);a.push(d)}}a.sort(function(a,b){return n.a.compare(a[0],b[0])});return a.map(function(a){return a.map(function(a){return a.toString()})})}},{key:"size",get:function(){return this.map.size}}]);return a}()},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);
-a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return c});var p=a(66),n=a(7);h=a(15);var d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),b=function l(a,b,
-c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return l(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};f=this&&this.__decorate||function(a,b,c,d){var e=arguments.length,f=3>e?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,k;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var l=a.length-1;0<=l;l--)if(k=a[l])f=(3>e?
-k(f):3<e?k(b,c,f):k(b,c))||f;return 3<e&&f&&Object.defineProperty(b,c,f),f};var c=e=function(a){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var a=(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a.hashTable=new p.b;a.changed=new n.b;return a}q(c,a);$jscomp.initSymbol();$jscomp.initSymbolIterator();
-d(c,[{key:"disposed",value:function(){b(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this);this.changed=this.hashTable=void 0}},{key:"add_",value:function(a){return this.hashTable.add(a)}},{key:"add",value:function(a){if(this.add_(a)){var b=this.rpc;b&&b.invoke("Uint64Set.add",{id:this.rpcId,value:a});this.changed.dispatch(a,!0)}}},{key:"has",value:function(a){return this.hashTable.has(a)}},{key:Symbol.iterator,value:function(){return this.hashTable.keys()}},{key:"delete_",
-value:function(a){return this.hashTable.delete(a)}},{key:"delete",value:function(a){if(this.delete_(a)){var b=this.rpc;b&&b.invoke("Uint64Set.delete",{id:this.rpcId,value:a});this.changed.dispatch(a,!1)}}},{key:"clear",value:function(){if(this.hashTable.clear()){var a=this.rpc;a&&a.invoke("Uint64Set.clear",{id:this.rpcId});this.changed.dispatch(null,!1)}}},{key:"toJSON",value:function(){for(var a=[],b=$jscomp.makeIterator(this),c=b.next();!c.done;c=b.next())a.push(c.value.toString());a.sort();return a}},
-{key:"size",get:function(){return this.hashTable.size}}],[{key:"makeWithCounterpart",value:function(a){var b=new e;b.initializeCounterpart(a);return b}}]);return c}(h.c);c=e=f([Object(h.f)("Uint64Set")],c);Object(h.e)("Uint64Set.add",function(a){var b=this.get(a.id);b.add_(a.value)&&b.changed.dispatch()});Object(h.e)("Uint64Set.delete",function(a){var b=this.get(a.id);b.delete_(a.value)&&b.changed.dispatch()});Object(h.e)("Uint64Set.clear",function(a){a=this.get(a.id);a.hashTable.clear()&&a.changed.dispatch()});
-var e},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=
-b)}a.d(f,"a",function(){return c});h=a(1);f=a(14);var n=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),d=function g(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return g(a,b,c)}else{if("value"in d)return d.value;b=
-d.get;return void 0===b?void 0:b.call(c)}};a(45);a(302);var b=new f.a,c=function(a){function c(a){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var b=q(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));b.displayState=a;b.element=document.createElement("div");b.clearButton=document.createElement("button");b.itemContainer=document.createElement("span");b.items=new Map;var d=b.element,g=b.clearButton,f=b.itemContainer;d.className="segment-set-widget neuroglancer-noselect";
-g.className="clear-button";g.title="Remove all segment IDs";b.registerEventListener(g,"click",function(){b.visibleSegments.clear()});f.className="item-container";d.appendChild(f);f.appendChild(g);b.registerDisposer(a.visibleSegments.changed.add(function(a,c){b.handleSetChanged(a,c)}));b.registerDisposer(a.segmentColorHash.changed.add(function(){b.handleColorChanged()}));a=$jscomp.makeIterator(a.visibleSegments);for(d=a.next();!d.done;d=a.next())b.addElement(d.value.toString());b.updateClearButtonVisibility();
-return b}p(c,a);n(c,[{key:"updateClearButtonVisibility",value:function(){this.clearButton.style.display=0<this.displayState.visibleSegments.size?"":"none"}},{key:"handleSetChanged",value:function(a,b){this.updateClearButtonVisibility();var c=this.items;if(null===a){a=this.itemContainer;for(b=this.clearButton;;){var d=a.lastElementChild;if(d===b)break;a.removeChild(d)}c.clear()}else b?this.addElement(a.toString()):(a=a.toString(),b=c.get(a),b.parentElement.removeChild(b),c.delete(a))}},{key:"addElement",
-value:function(a){var c=document.createElement("button");c.className="segment-button";c.textContent=a;c.title="Remove segment ID "+a;var d=this;c.addEventListener("click",function(){b.tryParseString(this.textContent);d.visibleSegments.delete(b)});c.addEventListener("mouseenter",function(){b.tryParseString(this.textContent);d.segmentSelectionState.set(b)});c.addEventListener("mouseleave",function(){b.tryParseString(this.textContent);d.segmentSelectionState.set(null)});this.setItemColor(c);this.itemContainer.appendChild(c);
-this.items.set(a,c)}},{key:"setItemColor",value:function(a){b.tryParseString(a.textContent);a.style.backgroundColor=this.segmentColorHash.computeCssColor(b)}},{key:"handleColorChanged",value:function(){var a=this;this.items.forEach(function(b){a.setItemColor(b)})}},{key:"disposed",value:function(){var a=this.element,b=a.parentElement;b&&b.removeChild(a);d(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}},{key:"visibleSegments",get:function(){return this.displayState.visibleSegments}},
-{key:"segmentColorHash",get:function(){return this.displayState.segmentColorHash}},{key:"segmentSelectionState",get:function(){return this.displayState.segmentSelectionState}}]);return c}(h.a)},function(h,f){},function(h,f){},function(h,f){},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a,c){void 0!==c&&Object(w.a)(c,function(c,d){a.add({type:b.c.POINT,id:""+d,point:Object(w.k)(c)})})}function d(a){a=a.layer;return null===a||a instanceof k.SegmentationUserLayer?!0:!1}Object.defineProperty(f,"__esModule",{value:!0});a.d(f,"AnnotationUserLayer",function(){return z});var b=a(28),c=a(73),e=
-a(58),g=a(18);h=a(27);var l=a(57),k=a(65),t=a(31),m=a(35),r=a(9),u=a(108);f=a(111);var v=a(2),w=a(4),y=a(307),x=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),A=function E(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==
-a)return E(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a(308);var z=function(a){function f(a,k){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var h=q(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,a,k));h.localAnnotations=h.registerDisposer(new b.d);h.voxelSize=new l.h;h.linkedSegmentationLayer=h.registerDisposer(new g.b(h.manager.rootLayers.addRef(),d));h.filterBySegmentation=new m.b(!1);var r=h.sourceUrl=k.source;
-h.linkedSegmentationLayer.restoreState(k.linkedSegmentationLayer);h.filterBySegmentation.restoreState(k.filterBySegmentation);if(void 0===r){h.isReady=!0;h.voxelSize.restoreState(k.voxelSize);h.localAnnotations.restoreState(k.annotations);n(h.localAnnotations,k.points);var p=!1;k=function(){!h.voxelSize.valid&&a.voxelSize.valid&&(v.s.copy(h.voxelSize.size,a.voxelSize.size),h.voxelSize.setValid());if(h.voxelSize.valid&&!1===p){var b=new e.a;h.registerDisposer(Object(e.b)(b,h.transform,function(a,b){var c=
-v.k.fromScaling(v.k.create(),h.voxelSize.size);v.k.multiply(a,b,c)}));h.annotationLayerState.value=new c.b(Object.assign({transform:b,source:h.localAnnotations.addRef()},h.getAnnotationRenderOptions()));p=!0}};h.registerDisposer(h.localAnnotations.changed.add(h.specificationChanged.dispatch));h.registerDisposer(h.voxelSize.changed.add(h.specificationChanged.dispatch));h.registerDisposer(h.filterBySegmentation.changed.add(h.specificationChanged.dispatch));h.registerDisposer(h.voxelSize.changed.add(k));
-h.registerDisposer(h.manager.voxelSize.changed.add(k));k()}else t.a.forPromise(h.manager.dataSourceProvider.getAnnotationSource(h.manager.chunkManager,r),{initialMessage:"Retrieving metadata for volume "+r+".",delay:!0,errorPrefix:"Error retrieving metadata for volume "+r+": "}).then(function(a){h.wasDisposed||(h.annotationLayerState.value=new c.b(Object.assign({transform:h.transform,source:a},h.getAnnotationRenderOptions())),h.isReady=!0)});h.tabs.default="annotations";return h}p(f,a);x(f,[{key:"getAnnotationRenderOptions",
-value:function(){var a=this,b=new r.f(void 0),c=function(){var c=a.linkedSegmentationLayer;if(void 0===c.layerName)c=null;else a:{c=c.layer;if(void 0!==c&&(c=c.layer,null!==c&&c instanceof k.SegmentationUserLayer)){c=c.displayState;break a}c=void 0}b.value=c};this.registerDisposer(this.linkedSegmentationLayer.changed.add(c));c();return Object.assign({segmentationState:b,filterBySegmentation:this.filterBySegmentation},Object(u.b)(this))}},{key:"initializeAnnotationLayerViewTab",value:function(a){var b=
-a.registerDisposer(new y.a(this.linkedSegmentationLayer));b.element.insertBefore(document.createTextNode("Linked segmentation: "),b.element.firstChild);a.element.appendChild(b.element);b=this.registerDisposer(new m.c(a.annotationLayer.filterBySegmentation));var c=document.createElement("label");c.textContent="Filter by segmentation: ";c.appendChild(b.element);a.element.appendChild(c);a.registerDisposer(new m.a(this.registerDisposer(Object(r.g)(function(a){return void 0!==a},a.annotationLayer.segmentationState)),
-c))}},{key:"toJSON",value:function(){var a=A(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"toJSON",this).call(this);a.type="annotation";a.source=this.sourceUrl;void 0===this.sourceUrl&&(a.annotations=this.localAnnotations.toJSON(),a.voxelSize=this.voxelSize.toJSON());a.linkedSegmentationLayer=this.linkedSegmentationLayer.toJSON();a.filterBySegmentation=this.filterBySegmentation.toJSON();return a}}]);return f}(Object(u.a)(Object(f.a)(g.i)));Object(h.e)("annotation",z);Object(h.e)("pointAnnotation",
-z)},function(h,f,a){a.d(f,"a",function(){return d});var q=a(4),p=a(7),n=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,d,g){d&&a(b.prototype,d);g&&a(b,g);return b}}(),d=function(){function a(b,d,g){g=void 0===g?d:g;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.enumType=b;this.value_=d;this.defaultValue=g;this.changed=
-new p.a}n(a,[{key:"reset",value:function(){this.value=this.defaultValue}},{key:"restoreState",value:function(a){this.value=Object(q.m)(a,this.enumType)}},{key:"toJSON",value:function(){return this.enumType[this.value_].toLowerCase()}},{key:"value",set:function(a){this.value_!==a&&(this.value_=a,this.changed.dispatch())},get:function(){return this.value_}}]);return a}()},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||
-"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return c});h=a(10);var n=a.n(h);h=a(1);var d=a(8),b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];
-d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),c=function(a){function c(a){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var b=q(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));b.ref=a;b.element=document.createElement("label");b.selectElement=document.createElement("select");b.registerDisposer(a);a=b.selectElement;b.element.appendChild(a);
-b.updateView();b.registerEventListener(a,"change",function(){return b.updateModel()});b.registerDisposer(b.ref.changed.add(n()(function(){return b.updateView()},0)));return b}p(c,a);b(c,[{key:"updateModel",value:function(){this.ref.layerName=this.selectElement.value||void 0}},{key:"updateView",value:function(){var a=this.selectElement,b=this.ref,c=b.filter;Object(d.a)(a);var e=document.createElement("option");a.appendChild(e);e=$jscomp.makeIterator(this.ref.layerManager.managedLayers);for(var g=e.next();!g.done;g=
-e.next()){var f=g.value;c(f)&&(g=document.createElement("option"),f=f.name,g.textContent=f,g.value=f,a.appendChild(g))}a.value=b.layerName||""}}]);return c}(h.a)},function(h,f){},function(h,f,a){Object.defineProperty(f,"__esModule",{value:!0});a.d(f,"getNgPatchableObj",function(){return e});a.d(f,"getNgHash",function(){return g});var q=a(178),p=a(18),n=a(60),d=a(82),b=a(22),c=a(180);a.d(f,"createNehubaViewer",function(){return c.b});a.d(f,"NehubaViewer",function(){return c.a});a.d(f,"layoutEventType",
-function(){return c.c});a.d(f,"perspectiveRenderEventType",function(){return c.e});a.d(f,"quat",function(){return c.f});a.d(f,"sliceRenderEventType",function(){return c.g});a.d(f,"vec3",function(){return c.h});a.d(f,"vec4",function(){return c.i});a.d(f,"registerActionListener",function(){return b.c});a.d(f,"mat4",function(){return c.d});var e=function(){return{UrlHashBinding:q.a,LayerManager:p.a,SliceViewPanel:n.a,PerspectivePanel:d.b}},g=function(){if(!window.viewer)return null;var a=JSON.stringify(window.viewer.state.toJSON());
-return"#!"+encodeURI(a).replace(/[!'()*;,]/g,function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()})}},function(h,f,a){f.c="perspective_view/PerspectiveView";f.a="perspective_view/addLayer";f.b="perspective_view/removeLayer"},function(h,f){},function(h,f,a){function q(a){return a.map(function(a){return{name:a.name,value:a.layer}}).filter(function(a){return!!a.value}).map(function(a){return{name:a.name,userLayer:a.value}})}function p(a){return a.map(function(a){var b=a.layer.userLayer,c=
-b.getValueAt(a.mouse.position,a.mouse),d=b.volumePath;d||(d=b.parameters.meshSourceUrl);return{value:0===c?0:c?c:null,layer:{name:a.layer.name,url:d?d:void 0}}})}f.b=function(a,b){return w.create(a,b)};a.d(f,"a",function(){return w});var n=a(14),d=a(107),b=a(65),c=a(313),e=a(359),g=a(193),l=a(121),k=a(180),t=a(122),m=a(123),r=a(363),u=a(194);a.n(u);a(647);var v=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=
-!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),w=function(){function a(c,e,f){var l=this;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.errorHandler=f;this.onError=function(a){l.errorHandler&&(a instanceof Error?l.errorHandler(a):l.errorHandler(Error(a)))};this.ngviewer=c;this._config=e;var h=c.navigationState;this.navigationState={position:{inRealSpace:Object(r.a)(h.position,function(a){return k.h.clone(a.spatialCoordinates)}),
-inVoxels:Object(r.a)(h.position,function(a){var b=k.h.create();if(a.getVoxelCoordinates(b)){for(a=0;3>a;++a)b[a]=Math.floor(b[a]);return b}return null},{share:!1}).notNull().publishReplay(1).refCount()},orientation:Object(r.a)(h.pose.orientation,function(a){return k.f.clone(a.orientation)}),sliceZoom:Object(r.a)({s:h.zoomFactor,r:h},function(a){return a.value}),perspectiveZoom:Object(r.a)({s:c.perspectiveNavigationState.zoomFactor,r:c.perspectiveNavigationState},function(a){return a.value}),perspectiveOrientation:Object(r.a)(c.perspectiveNavigationState.pose.orientation,
-function(a){return k.f.clone(a.orientation)}),full:Object(r.a)(h,function(a){return{position:k.h.clone(a.position.spatialCoordinates),orientation:k.f.clone(a.pose.orientation.orientation),zoom:a.zoomFactor.value}}),get all(){var a=this.perspectiveZoom.combineLatest(this.perspectiveOrientation,function(a,b){return{perspectiveZoom:a,perspectiveOrientation:b}});return this.full.combineLatest(a,function(a,b){return Object.assign({},a,b)}).publishReplay(1).refCount()}};e=Object(r.a)({s:c.mouseState,r:c},
-function(a){return a.active?k.h.clone(a.position):null});this.mousePosition={inRealSpace:e,inVoxels:e.map(function(a){if(a){a=h.pose.position.voxelSize.voxelFromSpatial(k.h.create(),a);for(var b=0;3>b;++b)a[b]=Math.round(a[b])}return a}).publishReplay(1).refCount()};e=c.layerManager;e=Object(r.a)({s:{changed:e.layersChanged,layerManager:e},r:e},function(a){return a.layerManager}).concatMap(function(a){return u.Observable.from(a.managedLayers)});this._createdSegmentationUserLayers=e.map(function(a){return a.layer}).notNull().filter(function(a){return a instanceof
-b.SegmentationUserLayer}).map(function(a){return a});this.createdSegmentationUserLayers.subscribe(function(a){l.config.disableSegmentSelection&&Object(g.d)(a)});this.createdSegmentationUserLayers.subscribe(function(a){l.config.disableSegmentHighlighting&&Object(g.c)(a)});this.createdSegmentationUserLayers.subscribe(function(a){l.config.enableMeshLoadingControl&&(a=a.displayState,a.visibleSegments instanceof m.b||(a.visibleSegments=new m.b(a.visibleSegments)))});e=e.let(q).filter(function(a){return a.userLayer instanceof
-b.SegmentationUserLayer}).map(function(a){return{name:a.name,layer:a.userLayer}}).unseen(function(a){return a.layer}).flatMap(function(a){var b=a.name,c=a.layer.volumePath;return Object(r.a)(a.layer.displayState.segmentSelectionState,function(a){return{segment:a.hasSelectedSegment?l.segmentToNumber(a.selectedSegment):null,layer:{name:b,url:c}}})}).publishReplay(1).refCount();f=Object(r.a)(c.layerSelectedValues,function(a){return a}).concatMap(function(a){return u.Observable.from(a.layerManager.managedLayers).filter(function(a){return a.visible}).let(q).map(function(b){return{mouse:a.mouseState,
-layer:b}})});c=f.filter(function(a){return a.layer.userLayer instanceof d.ImageUserLayer}).let(p).map(function(a){return Object.assign({},a,{layer:Object.assign({},a.layer,{url:a.layer.url})})});f=f.let(p);this.mouseOver={segment:e,image:c,layer:f}}v(a,[{key:"addMouseOverSegmentCallback",value:function(a){var b=this.mouseOver.segment.subscribe(function(b){return a(b.segment,b.layer)},this.onError);return function(){return b.unsubscribe()}}},{key:"addMouseEnterSegmentCallback",value:function(a){var b=
-this.mouseOver.segment.filter(function(a){return null!==a.segment}).subscribe(function(b){return a(b.segment,b.layer)},this.onError);return function(){return b.unsubscribe()}}},{key:"addMouseLeaveSegmentsCallback",value:function(a){var b=this.mouseOver.segment.filter(function(a){return null===a.segment}).subscribe(function(){return a()},this.onError);return function(){return b.unsubscribe()}}},{key:"addNavigationStateCallbackInRealSpaceCoordinates",value:function(a){var b=this.navigationState.position.inRealSpace.subscribe(function(b){return a(b)},
-this.onError);return function(){return b.unsubscribe()}}},{key:"addNavigationStateCallbackInVoxelCoordinates",value:function(a){var b=this.navigationState.position.inVoxels.subscribe(function(b){return a(b)},this.onError);return function(){return b.unsubscribe()}}},{key:"addMousePositionCallbackInRealSpaceCoordinates",value:function(a){var b=this.mousePosition.inRealSpace.subscribe(function(b){return a(b)},this.onError);return function(){return b.unsubscribe()}}},{key:"addMousePositionCallbackInVoxelCoordinates",
-value:function(a){var b=this.mousePosition.inVoxels.subscribe(function(b){return a(b)},this.onError);return function(){return b.unsubscribe()}}},{key:"setPosition",value:function(a,b){var c=this.ngviewer.navigationState.pose.position;b?(k.h.copy(c.spatialCoordinates,a),c.markSpatialCoordinatesChanged()):c.setVoxelCoordinates(a)}},{key:"showSegment",value:function(a,b){this.getSingleSegmentation(b).displayState.visibleSegments.add(new n.a(a))}},{key:"hideSegment",value:function(a,b){this.getSingleSegmentation(b).displayState.visibleSegments.delete(new n.a(a))}},
-{key:"getShownSegmentsNow",value:function(a){return Array.from(this.getSingleSegmentation(a).displayState.visibleSegments,this.segmentToNumber)}},{key:"getShownSegmentsObservable",value:function(a){var b=this;a=this.getSingleSegmentation(a);return Object(r.a)({s:a.displayState.visibleSegments,r:a},function(a){return Array.from(a,b.segmentToNumber)})}},{key:"setSegmentColor",value:function(a,b,c){this.checkRGB(b);this.getSingleSegmentationColors(c).setSegmentColor(a,b.red,b.green,b.blue)}},{key:"unsetSegmentColor",
-value:function(a,b){this.getSingleSegmentationColors(b).unsetSegmentColor(a)}},{key:"clearCustomSegmentColors",value:function(a){this.getSingleSegmentationColors(a).clearCustomSegmentColors()}},{key:"batchAddAndUpdateSegmentColors",value:function(a,b){this.getSingleSegmentationColors(b).batchUpdate(a)}},{key:"setMeshesToLoad",value:function(a,b){b=this.getSingleSegmentation(b).displayState.visibleSegments;b instanceof m.b?b.setMeshesToLoad(a):this.throwError("visibleSegments property is not wrapped by nehuba. Maybe mesh loading control is not enabled in config (enableMeshLoadingControl?: boolean) ")}},
-{key:"relayout",value:function(){this.ngviewer.layout.container.component.changed.dispatch()}},{key:"redraw",value:function(){this.ngviewer.display.scheduleRedraw()}},{key:"dispose",value:function(){this.ngviewer.dispose();this.ngviewer.display.container[l.b]=void 0}},{key:"applyInitialNgState",value:function(){a.restoreInitialState(this.ngviewer,this.config)}},{key:"hideNeuroglancerUI",value:function(){this.ngviewer.uiConfiguration.showUIControls.value=!1}},{key:"showNeuroglancerUI",value:function(){this.ngviewer.uiConfiguration.showUIControls.value=
-!0}},{key:"restoreState",value:function(b){a.restoreViewerState(this.ngviewer,b,this.config)}},{key:"getSingleSegmentationColors",value:function(a){a=this.getSingleSegmentation(a).displayState.segmentColorHash;if(a instanceof t.a)return a;throw Error("Looks like neuroglancer was not patched and hooked to support custom segment colors. Are you sure you enabled it by `config.globals.useCustomSegmentColors: true` or similar?");}},{key:"getSingleSegmentation",value:function(a){var c=this.ngviewer.layerManager.managedLayers.filter(function(b){return!a||
-!a.name||b.name===a.name}).map(function(a){return a.layer}).filter(function(a){return!!a}).filter(function(a){return a instanceof b.SegmentationUserLayer}).map(function(a){return a}).filter(function(b){return!a||!a.url||b.volumePath===a.url});0===c.length&&this.throwError("No parcellation found");1<c.length&&this.throwError("Ambiguous request. Multiple parcellations found");return c[0]}},{key:"segmentToNumber",value:function(a){0!==a.high&&this.throwError("Segment id number does not fit into 32 bit integer "+
-a.toString(10));return a.low}},{key:"throwError",value:function(a){a=Error(a);var b=this.errorHandler;b&&b(a);throw a;}},{key:"checkRGB",value:function(a){this.checkRGBValue(a.red,"red");this.checkRGBValue(a.green,"green");this.checkRGBValue(a.blue,"blue")}},{key:"checkRGBValue",value:function(a,b){Number.isInteger(a)||this.throwError("Provided color value "+a+" for "+b+" channel is not an integer (0 to 255).");(0>a||255<a)&&this.throwError("Provided color value "+a+" for "+b+" channel is not in expected range of 0 to 255.")}},
-{key:"crossSectionBackground",get:function(){return this.ngviewer.crossSectionBackgroundColor.value},set:function(a){this.ngviewer.crossSectionBackgroundColor.value=a}},{key:"config",get:function(){return this._config},set:function(a){this._config=a;this.ngviewer.display.container[l.b]=this._config}},{key:"createdSegmentationUserLayers",get:function(){return this._createdSegmentationUserLayers.unseen()}}],[{key:"create",value:function(b,d){b=b||{};var f=document.getElementById("neuroglancer-container");
-if(f[l.b])throw b=Error("Viewer is already created in this container: "+f),d&&d(b),b;f[l.b]=b;Object(e.a)(b);Object(g.b)(f,b);f=Object(c.a)();b.hideNeuroglancerUI&&(f.uiConfiguration.showUIControls.value=!1);this.setCrossSectionBackgroundFromConfig(f,b);Object(g.a)(f,b);0===f.layerManager.managedLayers.length&&a.restoreInitialState(f,b);return new a(f,b,d)}},{key:"setCrossSectionBackgroundFromConfig",value:function(a,b){if(b=b.dataset&&b.dataset.imageBackground||b.crossSectionBackground)a.crossSectionBackgroundColor.value=
-b}},{key:"restoreInitialState",value:function(a,b){var c=b.dataset&&b.dataset.initialNgState;c&&this.restoreViewerState(a,c,b)}},{key:"restoreViewerState",value:function(b,c,d){b.state.reset();b.state.restoreState(c);c.crossSectionBackgroundColor||a.setCrossSectionBackgroundFromConfig(b,d)}}]);return a}()},function(h,f,a){f.a=function(){var a=window.viewer=Object(d.a)();Object(n.a)(a.inputEventBindings);var e=a.registerDisposer(new b.a(a.state));a.registerDisposer(e.parseError.changed.add(function(){var a=
-e.parseError.value;void 0!==a&&((new q.a).setErrorMessage("Error parsing state: "+a.message),console.log("Error parsing state",a));e.parseError}));e.updateFromUrlHash();Object(p.a)(a);Object(p.b)(a);return a};var q=a(31),p=a(314),n=a(315),d=a(316),b=a(178)},function(h,f,a){f.a=function(a){a.registerEventListener(document,"copy",function(b){if(!Object(q.a)(b)){var c=Object(n.b)(a.state).value;b.clipboardData.setData("text/plain",JSON.stringify(c,void 0,"  "));b.preventDefault()}})};f.b=function(a){a.registerEventListener(document,
-"paste",function(b){if(!Object(q.a)(b)){var c=b.clipboardData.getData("text/plain").match(/^[\[\]{}()\s,]*(\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)[\[\]{}()\s,]*$/);c=null!==c?p.s.fromValues(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3])):void 0;void 0!==c&&a.navigationState.position.setVoxelCoordinates(c);b.preventDefault()}})};var q=a(181),p=a(2),n=a(67)},function(h,f,a){function q(){if(void 0===c){var a=new b.a;a.set("keyl","recolor");a.set("keyx","clear-segments");a.set("keys",
-"toggle-show-slices");a.set("keyb","toggle-scale-bar");a.set("shift+keyb","toggle-default-annotations");a.set("keya","toggle-axis-lines");a.set("keyo","toggle-orthographic-projection");for(var d=1;9>=d;++d)a.set("digit"+d,"toggle-layer-"+d),a.set("control+digit"+d,"select-layer-"+d);a.set("keyn","add-layer");a.set("keyh","help");a.set("space","toggle-layout");a.set("shift+space","toggle-layout-alternative");c=a}return c}function p(){void 0===e&&(e=b.a.fromObject({arrowleft:"x-",arrowright:"x+",arrowup:"y-",
-arrowdown:"y+",comma:"z-",period:"z+",keyz:"snap","control+equal":"zoom-in","control+shift+equal":"zoom-in","control+minus":"zoom-out",keyr:"rotate-relative-z-",keye:"rotate-relative-z+","shift+arrowdown":"rotate-relative-x-","shift+arrowup":"rotate-relative-x+","shift+arrowleft":"rotate-relative-y-","shift+arrowright":"rotate-relative-y+","at:control+wheel":{action:"zoom-via-wheel",preventDefault:!0},"at:wheel":{action:"z+1-via-wheel",preventDefault:!0},"at:shift+wheel":{action:"z+10-via-wheel",
-preventDefault:!0},"at:dblclick0":"select","at:control+mousedown0":"annotate","at:mousedown2":"move-to-mouse-position","at:control+mousedown2":"select-annotation"},{label:"All Data Panels"}));return e}function n(){void 0===g&&(g=b.a.fromObject({"at:mousedown0":{action:"rotate-via-mouse-drag",stopPropagation:!0},"at:shift+mousedown0":{action:"translate-via-mouse-drag",stopPropagation:!0}},{parents:[[p(),Number.NEGATIVE_INFINITY]]}));return g}function d(){void 0===l&&(l=b.a.fromObject({"at:mousedown0":{action:"translate-via-mouse-drag",
-stopPropagation:!0},"at:shift+mousedown0":{action:"rotate-via-mouse-drag",stopPropagation:!0}},{parents:[[p(),Number.NEGATIVE_INFINITY]]}));return l}f.a=function(a){a.global.addParent(q(),Number.NEGATIVE_INFINITY);a.sliceView.addParent(d(),Number.NEGATIVE_INFINITY);a.perspectiveView.addParent(n(),Number.NEGATIVE_INFINITY)};var b=a(22),c,e,g,l},function(h,f,a){f.a=function(a){Object(d.a)();Object(d.b)();try{var b=new p.a(document.getElementById("neuroglancer-container"));return new n.a(b,a)}catch(e){throw q.a.showMessage("Error: "+
-e.message),e;}};a(318);var q=a(31),p=a(147),n=a(323),d=a(358);a(317)},function(h,f){},function(h,f,a){a(319);a(320)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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)}h=a(182);var d=a(26);f=a(33);var b=a(1),c=a(2),e=a(14),g=a(117),l=a(21),k=function y(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return y(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},
-t=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),m=function(a){function b(a,c,d,e){q(this,b);var f=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));f.chunkDataSize=c;f.channelStride=c[0]*c[1]*c[2];Object(g.e)(f,a,d,c[0],c[1],c[2]*e);return f}n(b,a);t(b,null,[{key:"get",value:function(a,d,e,g){return a.memoize.get("sliceview.UncompressedTextureLayout:"+
-Object(c.t)(d)+","+(e+","+g),function(){return new b(a,d,e,g)})}}]);return b}(b.a),r=function(a){function b(a,c,d,e){q(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,e));a.dataType=c;a.numChannels=d;Object(g.c)(a,c);a.textureAccessHelper=new g.a("chunkData");return a}n(b,a);t(b,[{key:"defineShader",value:function(a){k(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);var c=this.textureAccessHelper;c.defineShader(a);a.addFragmentCode(c.getAccessor("readVolumeData",
-"uVolumeChunkSampler",this.dataType));1<this.numChannels?(a.addUniform("highp float","uChannelStride"),a.addFragmentCode("\nfloat getChannelOffset(int channelIndex) {\n  return float(channelIndex) * uChannelStride;\n}\n")):a.addFragmentCode("float getChannelOffset(int channelIndex) { return 0.0; }");a.addFragmentCode("\nfloat getIndexIntoChunk (int channelIndex) {\n  vec3 chunkDataPosition = getPositionWithinChunk();\n  return chunkDataPosition.x + uChunkDataSize.x * (chunkDataPosition.y + uChunkDataSize.y * chunkDataPosition.z) + getChannelOffset(channelIndex);\n}\n");
-c=Object(l.a)(this.dataType);a.addFragmentCode("\n"+c+" getDataValue (int channelIndex) {\n  return readVolumeData(getIndexIntoChunk(channelIndex));\n}\n")}},{key:"setupTextureLayout",value:function(a,b,c){1<this.numChannels&&a.uniform1f(b.uniform("uChannelStride"),c.channelStride);this.textureAccessHelper.setupTextureLayout(a,b,c)}},{key:"getTextureLayout",value:function(a,b){return m.get(a,b,this.texelsPerElement,this.numChannels)}},{key:"setTextureData",value:function(a,b,c){Object(g.f)(a,b,this,
-c)}}],[{key:"get",value:function(a,c,d){var e="sliceview.UncompressedChunkFormat:"+c+":"+d;return a.memoize.get(e,function(){return new b(a,c,d,e)})}}]);return b}(h.a),u=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}n(b,a);t(b,[{key:"setTextureData",value:function(a){var b=this.source,c=b.chunkFormatHandler,d=c.chunkFormat,e;this.textureLayout=this.chunkDataSize===b.spec.chunkDataSize?e=c.textureLayout.addRef():e=d.getTextureLayout(a,
-this.chunkDataSize);this.chunkFormat.setTextureData(a,e,this.data)}},{key:"getChannelValueAt",value:function(a,b){var c=this.chunkDataSize;b=a[0]+c[0]*(a[1]+c[1]*(a[2]+c[2]*b));c=this.chunkFormat.dataType;a=this.data;switch(c){case d.a.UINT8:case d.a.FLOAT32:case d.a.UINT16:case d.a.UINT32:return a[b];case d.a.UINT64:return b*=2,new e.a(a[b],a[b+1])}throw Error("Invalid data type: "+c);}}]);return b}(h.b),v=function(a){function b(a,c){q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));
-d.chunkFormat=d.registerDisposer(r.get(a,c.dataType,c.numChannels));d.textureLayout=d.registerDisposer(d.chunkFormat.getTextureLayout(a,c.chunkDataSize));return d}n(b,a);t(b,[{key:"getChunk",value:function(a,b){return new u(a,b)}}]);return b}(b.a);Object(f.c)(function(a,b){return null==b.compressedSegmentationBlockSize?new v(a,b):null})},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d=a(321),b=a(322);h=a(182);var c=a(26);f=a(33);var e=a(1),g=a(2),l=a(14),k=a(117),t=a(21),m=function z(a,b,c){null===a&&(a=Function.prototype);
-var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return z(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},r=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),u=function(a){function b(a,c,d,e){q(this,b);var f=p(this,(b.__proto__||
-Object.getPrototypeOf(b)).call(this));f.chunkDataSize=c;f.subchunkSize=d;Object(k.d)(f,a,1,e);a=f.subchunkGridSize=g.s.create();for(e=0;3>e;++e)a[e]=Math.ceil(c[e]/d[e]);return f}n(b,a);r(b,null,[{key:"get",value:function(a,c,d,e){return a.memoize.get("sliceview.CompressedSegmentationTextureLayout:"+Object(g.t)(c)+","+(Object(g.t)(d)+","+e),function(){return new b(a,c,d,e)})}}]);return b}(e.a),v=Object(k.c)(new k.b,c.a.UINT32),w=function(a){function b(a,c,d,e){q(this,b);e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,
-e));e.dataType=a;e.subchunkSize=c;e.numChannels=d;e.textureAccessHelper=new k.a("chunkData");return e}n(b,a);r(b,[{key:"defineShader",value:function(a){m(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);var d=this.textureAccessHelper;d.defineShader(a);var e=function(a){return"compressedSegmentationChunkFormat_"+a};a.addUniform("highp vec3","uSubchunkGridSize");a.addUniform("highp vec3","uSubchunkSize");a.addFragmentCode(t.g);var g=this.dataType,f=Object(t.a)(g);
-g===c.a.UINT64&&a.addFragmentCode(t.n);a.addFragmentCode(d.getAccessor(e("readTextureValue"),"uVolumeChunkSampler",c.a.UINT32));a.addFragmentCode(t.q);a.addFragmentCode(t.p);d="\nfloat "+e("getChannelOffset")+"(int channelIndex) {\n  if (channelIndex == 0) {\n    return "+this.numChannels+".0;\n  }\n  vec4 v = "+e("readTextureValue")+"(float(channelIndex)).value;\n  return uintleToFloat(v.xyz);\n}\n"+f+" getDataValue (int channelIndex) {\n  vec3 chunkPosition = getPositionWithinChunk();\n\n  // TODO: maybe premultiply this and store as uniform.\n  vec3 subchunkGridPosition = floor(chunkPosition / uSubchunkSize);\n  float subchunkGridOffset = getFortranOrderIndex(subchunkGridPosition, uSubchunkGridSize);\n\n  float channelOffset = "+
-e("getChannelOffset")+"(channelIndex);\n\n  // TODO: Maybe just combine this offset into subchunkGridStrides.\n  float subchunkHeaderOffset = subchunkGridOffset * 2.0 + channelOffset;\n\n  vec4 subchunkHeader0 = "+e("readTextureValue")+"(subchunkHeaderOffset).value;\n  vec4 subchunkHeader1 = "+e("readTextureValue")+"(subchunkHeaderOffset + 1.0).value;\n\n  float outputValueOffset = uintleToFloat(subchunkHeader0.xyz) + channelOffset;\n  float encodingBits = unnormalizeUint8(subchunkHeader0[3]);\n  if (encodingBits > 0.0) {\n    vec3 subchunkPosition = floor(min(chunkPosition - subchunkGridPosition * uSubchunkSize, uSubchunkSize - 1.0));\n    float subchunkOffset = getFortranOrderIndex(subchunkPosition, uSubchunkSize);\n    highp float encodedValueBaseOffset = uintleToFloat(subchunkHeader1.xyz) + channelOffset;\n    highp float encodedValueOffset = floor(encodedValueBaseOffset + subchunkOffset * encodingBits / 32.0);\n    vec4 encodedValue = "+
-e("readTextureValue")+"(encodedValueOffset).value;\n    float wordOffset = mod(subchunkOffset * encodingBits, 32.0);\n    // If the value is in the first byte, then 0 <= wordOffset < 8.\n    // We need to mod by 2**encodedBits\n    float wordShifter = pow(2.0, -wordOffset);\n    float encodedValueMod = pow(2.0, encodingBits);\n    float encodedValueShifted;\n    if (wordOffset < 16.0) {\n      encodedValueShifted = dot(unnormalizeUint8(encodedValue.xy), vec2(1.0, 256.0));\n    } else {\n      encodedValueShifted = dot(unnormalizeUint8(encodedValue.zw), vec2(256.0 * 256.0, 256.0 * 256.0 * 256.0));\n    }\n    encodedValueShifted = floor(encodedValueShifted * wordShifter);\n    float decodedValue = mod(encodedValueShifted, encodedValueMod);\n    outputValueOffset += decodedValue * "+
-(this.dataType===c.a.UINT64?"2.0":"1.0")+";\n  }\n  "+f+" result;\n";d=g===c.a.UINT64?d+("\n  result.low = "+e("readTextureValue")+"(outputValueOffset).value;\n  result.high = "+e("readTextureValue")+"(outputValueOffset+1.0).value;\n"):d+("\n  result.value = "+e("readTextureValue")+"(outputValueOffset).value;\n");a.addFragmentCode(d+"\n  return result;\n}\n")}},{key:"setupTextureLayout",value:function(a,b,c){a.uniform3fv(b.uniform("uSubchunkGridSize"),c.subchunkGridSize);this.textureAccessHelper.setupTextureLayout(a,
-b,c)}},{key:"setTextureData",value:function(a,b,c){Object(k.f)(a,b,v,c)}},{key:"getTextureLayout",value:function(a,b,c){return u.get(a,b,this.subchunkSize,c)}},{key:"beginSource",value:function(a,c){m(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"beginSource",this).call(this,a,c);a.uniform3fv(c.uniform("uSubchunkSize"),this.subchunkSize)}}],[{key:"get",value:function(a,c,d,e){var f="sliceview.CompressedSegmentationChunkFormat:"+c+":"+e,k=f+":"+Object(g.t)(d);return a.memoize.get(k,function(){return new b(c,
-d,e,f)})}}]);return b}(h.a),y=function(a){function e(){q(this,e);return p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}n(e,a);r(e,[{key:"setTextureData",value:function(a){var b=this.data,c=this.chunkFormat,d=this.textureLayout=c.getTextureLayout(a,this.chunkDataSize,b.length);c.setTextureData(a,d,b)}},{key:"getChannelValueAt",value:function(a,e){var g=this.chunkDataSize,f=this.chunkFormat,k=this.data;e=k[e];if(f.dataType===c.a.UINT64){var h=new l.a;Object(b.a)(h,k,e,g,f.subchunkSize,
-a);return h}return Object(d.a)(k,e,g,f.subchunkSize,a)}}]);return e}(h.b),x=function(a){function b(a,d){q(this,b);var e=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this)),g=d.dataType;if(g!==c.a.UINT64&&g!==c.a.UINT32)throw Error("Unsupported compressed segmentation data type: "+c.a[g]);e.chunkFormat=e.registerDisposer(w.get(a,d.dataType,d.compressedSegmentationBlockSize,d.numChannels));return e}n(b,a);r(b,[{key:"getChunk",value:function(a,b){return new y(a,b)}}]);return b}(e.a);Object(f.c)(function(a,
-b){return null!=b.compressedSegmentationBlockSize?new x(a,b):null})},function(h,f,a){f.a=function(a,f,d,b,c){f=Object(q.a)(a,f,d,b,c,1)+f;return a[f]};var q=a(183)},function(h,f,a){f.a=function(a,f,d,b,c,e){d=Object(q.a)(f,d,b,c,e,2)+d;a.low=f[d];a.high=f[d+1];return a};var q=a(183)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a,b){for(var c=$jscomp.makeIterator(X),d=c.next();!d.done;d=c.next()){d=d.value;var e=b[d];void 0!==e&&(a[d].value=e)}}
-function b(a){var b=new z.a,c=b.element;c.classList.add("neuroglancer-viewer-context-menu");var d=function(a,d){a=b.registerDisposer(new Z.a(d,{label:a}));a.element.classList.add("neuroglancer-viewer-context-menu-limit-widget");c.appendChild(a.element)};d("GPU memory limit",a.chunkQueueManager.capacities.gpuMemory.sizeLimit);d("System memory limit",a.chunkQueueManager.capacities.systemMemory.sizeLimit);d("Concurrent chunk requests",a.chunkQueueManager.capacities.download.itemLimit);d=function(a,d){var e=
-document.createElement("label");e.textContent=a;a=b.registerDisposer(new x.c(d));e.appendChild(a.element);c.appendChild(e)};d("Show axis lines",a.showAxisLines);d("Show scale bar",a.showScaleBar);d("Show cross sections in 3-d",a.showPerspectiveSliceViews);d("Show default annotations",a.showDefaultAnnotations);return b}a.d(f,"a",function(){return Za});h=a(10);var c=a.n(h),e=a(24),g=a(150);h=a(83);var l=a(41),k=a(324),t=a(18),m=a(185),r=a(333),u=a(27),v=a(57),w=a(47),y=a(31),x=a(35),A=a(9),z=a(188),
-D=a(342),E=a(344),G=a(189),C=a(348),B=a(79),F=a(164);f=a(1);var L=a(8),J=a(22),O=a(2),M=a(61),P=a(7),N=a(67),S=a(29),U=a(354),Z=a(356),H=a(120),Q=a(53),aa=a(110),ba=a(15),ka=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();a(357);a(45);a(84);var fa=function(a){function b(a){q(this,b);var c=p(this,(b.__proto__||
-Object.getPrototypeOf(b)).call(this));c.gl=a;c.worker=new Worker("chunk_worker.bundle.js");c.chunkQueueManager=c.registerDisposer(new e.d(new ba.a(c.worker),c.gl,{gpuMemory:new e.a({defaultItemLimit:1E6,defaultSizeLimit:1E9}),systemMemory:new e.a({defaultItemLimit:1E7,defaultSizeLimit:2E9}),download:new e.a({defaultItemLimit:32,defaultSizeLimit:Number.POSITIVE_INFINITY})}));c.chunkManager=c.registerDisposer(new e.c(c.chunkQueueManager));c.chunkQueueManager.registerDisposer(function(){return c.worker.terminate()});
-return c}n(b,a);ka(b,[{key:"rpc",get:function(){return this.chunkQueueManager.rpc}}]);return b}(f.a);(function(a){function b(){q(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.global=new M.a;return a}n(b,a);return b})(h.b);var R=["showHelpButton","showEditStateButton","showLayerPanel","showLocation","showAnnotationToolStatus"],X=[].concat(["showUIControls","showPanelBorders"],$jscomp.arrayFromIterable(R)),Ka=function(a){function b(){q(this,b);var a=p(this,(b.__proto__||
-Object.getPrototypeOf(b)).apply(this,arguments));a.showUIControls=new x.b(!0);a.showPanelBorders=new x.b(!0);return a}n(b,a);return b}(function Wb(){q(this,Wb);this.showHelpButton=new x.b(!0);this.showEditStateButton=new x.b(!0);this.showLayerPanel=new x.b(!0);this.showLocation=new x.b(!0);this.showAnnotationToolStatus=new x.b(!0)}),Ba={showLayerDialog:!0,resetStateWhenEmpty:!0},Za=function(a){function e(a,b){b=void 0===b?{}:b;q(this,e);var f=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));
-f.display=a;f.navigationState=f.registerDisposer(new v.e);f.perspectiveNavigationState=new v.e(new v.g(f.navigationState.position),1);f.mouseState=new t.e;f.layerManager=f.registerDisposer(new t.a);f.selectedLayer=f.registerDisposer(new t.h(f.layerManager.addRef()));f.showAxisLines=new x.b(!0,!0);f.showScaleBar=new x.b(!0,!0);f.showPerspectiveSliceViews=new x.b(!0,!0);f.visibleLayerRoles=Object(t.k)();f.showDefaultAnnotations=new x.b(!0,!0);f.crossSectionBackgroundColor=new F.a(O.s.fromValues(.5,
-.5,.5));f.scaleBarOptions=new Q.c;f.layerSelectedValues=f.registerDisposer(new t.c(f.layerManager,f.mouseState));f.resetInitiated=new P.a;f.state=new N.a;f.uiControlVisibility={};f.visible=!0;var k=b,h=void 0===k.dataContext?new fa(a.gl):k.dataContext,n=void 0===k.visibility?new S.b(S.b.VISIBLE):k.visibility,r=void 0===k.inputEventBindings?{global:new M.a,sliceView:new M.a,perspectiveView:new M.a}:k.inputEventBindings,z=void 0===k.element?a.makeCanvasOverlayElement():k.element,y=void 0===k.dataSourceProvider?
-Object(l.a)({credentialsManager:g.a}):k.dataSourceProvider;k=void 0===k.uiConfiguration?new Ka:k.uiConfiguration;f.visibility=n;f.inputEventBindings=r;f.element=z;f.dataSourceProvider=y;f.uiConfiguration=k;f.registerDisposer(function(){return Object(L.b)(f.element)});f.dataContext=f.registerDisposer(h);d(k,b);h=Object.assign({},Ba,b);b=h.resetStateWhenEmpty;h=h.showLayerDialog;n=$jscomp.makeIterator(R);for(r=n.next();!r.done;r=n.next())r=r.value,f.uiControlVisibility[r]=f.makeUiControlVisibilityState(r);
-f.registerDisposer(f.uiConfiguration.showPanelBorders.changed.add(function(){f.updateShowBorders();f.display.onResize()}));f.showLayerDialog=h;f.resetStateWhenEmpty=b;f.layerSpecification=new u.c(f.dataSourceProvider,f.layerManager,f.chunkManager,f.layerSelectedValues,f.navigationState.voxelSize);f.registerDisposer(a.updateStarted.add(function(){f.onUpdateDisplay()}));f.registerDisposer(a.updateFinished.add(function(){f.onUpdateDisplayFinished()}));f.showDefaultAnnotations.changed.add(function(){f.showDefaultAnnotations.value?
-f.visibleLayerRoles.add(t.g.DEFAULT_ANNOTATION):f.visibleLayerRoles.delete(t.g.DEFAULT_ANNOTATION)});b=f.state;b.add("layers",f.layerSpecification);b.add("navigation",f.navigationState);b.add("showAxisLines",f.showAxisLines);b.add("showScaleBar",f.showScaleBar);b.add("showDefaultAnnotations",f.showDefaultAnnotations);b.add("perspectiveOrientation",f.perspectiveNavigationState.pose.orientation);b.add("perspectiveZoom",f.perspectiveNavigationState.zoomFactor);b.add("showSlices",f.showPerspectiveSliceViews);
-b.add("gpuMemoryLimit",f.dataContext.chunkQueueManager.capacities.gpuMemory.sizeLimit);b.add("systemMemoryLimit",f.dataContext.chunkQueueManager.capacities.systemMemory.sizeLimit);b.add("concurrentDownloads",f.dataContext.chunkQueueManager.capacities.download.itemLimit);b.add("selectedLayer",f.selectedLayer);b.add("crossSectionBackgroundColor",f.crossSectionBackgroundColor);f.registerDisposer(f.navigationState.changed.add(function(){f.handleNavigationStateChanged()}));f.layerManager.initializePosition(f.navigationState.position);
-f.registerDisposer(f.layerSpecification.voxelCoordinatesSet.add(function(a){f.navigationState.position.setVoxelCoordinates(a)}));f.registerDisposer(f.layerSpecification.spatialCoordinatesSet.add(function(a){var b=f.navigationState.position;O.s.copy(b.spatialCoordinates,a);b.markSpatialCoordinatesChanged()}));h=f.registerCancellable(c()(function(){!f.wasDisposed&&0===f.layerManager.managedLayers.length&&f.resetStateWhenEmpty&&(f.navigationState.reset(),f.perspectiveNavigationState.pose.orientation.reset(),
-f.perspectiveNavigationState.zoomFactor.reset(),f.resetInitiated.dispatch(),!w.b&&f.showLayerDialog&&f.visibility.visible&&new m.a(f.layerSpecification))}));f.layerManager.layersChanged.add(h);h();f.registerDisposer(f.dataContext.chunkQueueManager.visibleChunksChanged.add(function(){f.layerSelectedValues.handleLayerChange()}));f.registerDisposer(f.dataContext.chunkQueueManager.visibleChunksChanged.add(function(){f.visible&&a.scheduleRedraw()}));f.makeUI();f.updateShowBorders();b.add("layout",f.layout);
-f.registerActionListeners();f.registerEventActionBindings();f.registerDisposer(Object(G.a)(z,f.navigationState.position));f.registerDisposer(new E.a(f.mouseState,f.layerManager,f.navigationState.voxelSize));return f}n(e,a);ka(e,[{key:"makeUiControlVisibilityState",value:function(a){return this.registerDisposer(Object(A.g)(function(a,b){return a&&b},this.uiConfiguration.showUIControls,this.uiConfiguration[a]))}},{key:"updateShowBorders",value:function(){var a=this.element;this.uiConfiguration.showPanelBorders.value?
-a.classList.add("neuroglancer-show-panel-borders"):a.classList.remove("neuroglancer-show-panel-borders")}},{key:"makeUI",value:function(){var a=this,c=this.element;c.classList.add("neuroglancer-viewer");c.classList.add("neuroglancer-noselect");c.style.display="flex";c.style.flexDirection="column";var d=document.createElement("div");d.title="Right click for settings";d.classList.add("neuroglancer-viewer-top-row");(this.contextMenu=this.registerDisposer(b(this))).registerParent(d);d.style.display="flex";
-d.style.flexDirection="row";d.style.alignItems="stretch";var e=this.registerDisposer(new H.c(document.createElement("div"),this.navigationState.voxelSize));this.registerDisposer(new x.a(this.uiControlVisibility.showLocation,e.element));d.appendChild(e.element);e=this.registerDisposer(new H.b(this.navigationState.position));this.registerDisposer(new x.a(this.uiControlVisibility.showLocation,e.element));d.appendChild(e.element);e=this.registerDisposer(new H.a(document.createElement("div"),this.mouseState,
-this.navigationState.voxelSize));e.element.style.flex="1";e.element.style.alignSelf="center";this.registerDisposer(new x.a(this.uiControlVisibility.showLocation,e.element));d.appendChild(e.element);e=this.registerDisposer(new U.a(this.selectedLayer));d.appendChild(e.element);this.registerDisposer(new x.a(this.uiControlVisibility.showAnnotationToolStatus,e.element));e=Object(aa.a)("{}","Edit JSON state");this.registerEventListener(e,"click",function(){a.editJsonState()});this.registerDisposer(new x.a(this.uiControlVisibility.showEditStateButton,
-e));d.appendChild(e);e=Object(aa.a)("?","Help");this.registerEventListener(e,"click",function(){a.showHelpDialog()});this.registerDisposer(new x.a(this.uiControlVisibility.showHelpButton,e));d.appendChild(e);this.registerDisposer(new x.a(Object(A.g)(function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];return b.reduce(function(a,b){return a||b},!1)},this.uiControlVisibility.showHelpButton,this.uiControlVisibility.showEditStateButton,this.uiControlVisibility.showLocation,this.uiControlVisibility.showAnnotationToolStatus),
-d));c.appendChild(d);d=document.createElement("div");d.style.display="flex";d.style.flex="1";d.style.flexDirection="row";this.layout=this.registerDisposer(new r.a(this,"4panel"));d.appendChild(this.layout.element);d.appendChild(this.registerDisposer(new D.a(this.selectedLayer.addRef())).element);this.registerDisposer(this.selectedLayer.changed.add(function(){return a.display.onResize()}));c.appendChild(d);this.display.onResize();d=function(){var b=a.visibility.visible;b!==a.visible&&(c.style.visibility=
-b?"inherit":"hidden",a.visible=b)};d();this.registerDisposer(this.visibility.changed.add(d))}},{key:"registerEventActionBindings",value:function(){var a=this.element;this.registerDisposer(new M.b(a,this.inputEventMap));this.registerDisposer(new B.a(a))}},{key:"bindAction",value:function(a,b){this.registerDisposer(Object(J.c)(this.element,a,b))}},{key:"registerActionListeners",value:function(){for(var a=this,b={},c=$jscomp.makeIterator(["recolor","clear-segments"]),d=c.next();!d.done;b={action:b.action},
-d=c.next())b.action=d.value,this.bindAction(b.action,function(b){return function(){a.layerManager.invokeAction(b.action)}}(b));b={};c=$jscomp.makeIterator(["select"]);for(d=c.next();!d.done;b={action$321:b.action$321},d=c.next())b.action$321=d.value,this.bindAction(b.action$321,function(b){return function(){a.mouseState.updateUnconditionally();a.layerManager.invokeAction(b.action$321)}}(b));this.bindAction("help",function(){return a.showHelpDialog()});for(d={i:1};9>=d.i;d={i:d.i},++d.i)this.bindAction("toggle-layer-"+
-d.i,function(b){return function(){var c=b.i-1,d=a.layerManager.managedLayers;c<d.length&&(c=d[c],c.setVisible(!c.visible))}}(d)),this.bindAction("select-layer-"+d.i,function(b){return function(){var c=b.i-1,d=a.layerManager.managedLayers;c<d.length&&(a.selectedLayer.layer=d[c],a.selectedLayer.visible=!0)}}(d));this.bindAction("annotate",function(){var b=a.selectedLayer.layer;if(void 0===b)y.a.showTemporaryMessage("The annotate command requires a layer to be selected.");else{var c=b.layer;null===c||
-void 0===c.tool.value?y.a.showTemporaryMessage("The selected layer ("+JSON.stringify(b.name)+") does not have an active annotation tool."):c.tool.value.trigger(a.mouseState)}});this.bindAction("toggle-axis-lines",function(){return a.showAxisLines.toggle()});this.bindAction("toggle-scale-bar",function(){return a.showScaleBar.toggle()});this.bindAction("toggle-default-annotations",function(){return a.showDefaultAnnotations.toggle()});this.bindAction("toggle-show-slices",function(){return a.showPerspectiveSliceViews.toggle()})}},
-{key:"showHelpDialog",value:function(){var a=this.inputEventBindings;new k.a([["Global",a.global],["Slice View",a.sliceView],["Perspective View",a.perspectiveView]])}},{key:"editJsonState",value:function(){new C.a(this)}},{key:"onUpdateDisplay",value:function(){this.visible&&(this.dataContext.chunkQueueManager.chunkUpdateDeadline=null)}},{key:"onUpdateDisplayFinished",value:function(){this.visible&&this.mouseState.updateIfStale()}},{key:"handleNavigationStateChanged",value:function(){if(this.visible){var a=
-this.dataContext.chunkQueueManager;null===a.chunkUpdateDeadline&&(a.chunkUpdateDeadline=Date.now()+10)}this.mouseState.stale=!0}},{key:"chunkManager",get:function(){return this.dataContext.chunkManager}},{key:"chunkQueueManager",get:function(){return this.dataContext.chunkQueueManager}},{key:"inputEventMap",get:function(){return this.inputEventBindings.global}},{key:"gl",get:function(){return this.display.gl}}]);return e}(f.a)},function(h,f,a){function q(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function n(a){return a.startsWith("key")?a.substring(3):a.startsWith("digit")||a.startsWith("arrow")?a.substring(5):a}a.d(f,"a",
-function(){return d});h=a(47);a(325);var d=function(a){function b(a){function c(a,b){for(var e=$jscomp.makeIterator(a.parents),g=e.next();!g.done;g=e.next())g=g.value,void 0!==g.label?d(g.label,g):c(g,b);a=$jscomp.makeIterator(a.bindings.entries());for(e=a.next();!e.done;e=a.next()){g=$jscomp.makeIterator(e.value);e=g.next().value;g=g.next().value;var f=e.indexOf(":");e=e.substring(f+1);b.set(e,g.action)}}function d(a,b){r.has(b)||(a={label:a,entries:new Map},c(b,a.entries),r.set(b,a))}if(!(this instanceof
-b))throw new TypeError("Cannot call a class as a function");var e=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this)),f=e.content;f.classList.add("describe-key-bindings");var h=document.createElement("div");h.classList.add("describe-key-bindings-container");var r=new Map;a=$jscomp.makeIterator(a);for(var p=a.next();!p.done;p=a.next()){var v=$jscomp.makeIterator(p.value);p=v.next().value;v=v.next().value;d(p,v)}a=$jscomp.makeIterator(r.values());for(p=a.next();!p.done;p=a.next()){v=p.value;
-p=document.createElement("h2");p.textContent=v.label;h.appendChild(p);p=document.createElement("div");p.className="dl";v=$jscomp.makeIterator(v.entries);for(var w=v.next();!w.done;w=v.next()){var y=$jscomp.makeIterator(w.value);w=y.next().value;y=y.next().value;var x=document.createElement("div"),A=document.createElement("div");A.className="definition-outer-container";x.className="definition-container";var z=document.createElement("div");z.className="dt";z.textContent=w.split("+").map(n).join("+");
-w=document.createElement("div");w.className="dd";w.textContent=y;x.appendChild(z);x.appendChild(w);p.appendChild(A);A.appendChild(x)}h.appendChild(p)}f.appendChild(h);return e}p(b,a);return b}(h.a)},function(h,f){},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function n(a){var b=document.createElement("div");b.textContent=a.value;return b}f.b=function(a){var b=document.createElement("div");b.className="autocomplete-completion-with-description";b.textContent=a.value;var c=document.createElement("div");c.className="autocomplete-completion-description";c.textContent=a.description||
-"";b.appendChild(c);return b};a.d(f,"a",function(){return y});h=a(10);var d=a.n(h),b=a(32);h=a(1);var c=a(8),e=a(327),g=a(61),l=a(328),k=a(329),t=a(7),m=a(186),r=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),u=function A(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);
-if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return A(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a(330);$jscomp.initSymbol();var v=Symbol("autocompleteIndex"),w=g.a.fromObject({arrowdown:{action:"cycle-next-active-completion"},arrowup:{action:"cycle-prev-active-completion"},tab:{action:"choose-active-completion-or-prefix",preventDefault:!1},enter:{action:"choose-active-completion",preventDefault:!1},escape:{action:"cancel",preventDefault:!1,stopPropagation:!1}}),
-y=function(a){function f(a){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var c=q(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));c.inputChanged=new t.b;c.prevInputValue="";c.completionsVisible=!1;c.activeCompletionPromise=null;c.activeCompletionCancellationToken=void 0;c.hasFocus=!1;c.completionResult=null;c.dropdownContentsStale=!0;c.updateHintScrollPositionTimer=null;c.completionElements=null;c.hasResultForDropdown=!1;c.commonPrefix="";c.activeIndex=
--1;c.dropdownStyleStale=!0;c.completer=a.completer;a=void 0===a.delay?200:a.delay;var e=c.scheduleUpdateCompletions=d()(function(){var a=c.activeCompletionCancellationToken=new b.b,d=c.activeCompletionPromise=c.completer(c.value,a);null!==d&&d.then(function(a){c.activeCompletionPromise===d&&(c.setCompletions(a),c.activeCompletionPromise=null)})},a);c.registerDisposer(function(){e.cancel()});a=c.element=document.createElement("div");a.className="autocomplete";var k=document.createElement("div");k.className=
-"autocomplete-dropdown-wrapper";var l=c.dropdownElement=document.createElement("div");l.className="autocomplete-dropdown";var h=c.promptElement=document.createElement("label");h.className="autocomplete-prompt";var n=c.inputWrapperElement=document.createElement("div");n.className="autocomplete-input-wrapper";a.appendChild(h);var r=c.inputElement=document.createElement("input");r.type="text";r.autocomplete="off";r.spellcheck=!1;r.className="autocomplete-input";Object(m.a)(h,r);h=c.hintElement=document.createElement("input");
-h.type="text";h.spellcheck=!1;h.className="autocomplete-hint";h.disabled=!0;n.appendChild(h);n.appendChild(r);k.appendChild(n);k.appendChild(l);a.appendChild(k);c.registerInputHandler();c.handleInputChanged("");c.registerEventListener(c.inputElement,"focus",function(){c.hasFocus||(c.hasFocus=!0,c.dropdownStyleStale=!0,c.updateDropdown())});c.registerEventListener(c.inputElement,"blur",function(){c.hasFocus&&(c.hasFocus=!1,c.updateDropdown())});c.registerEventListener(a.ownerDocument.defaultView,"resize",
-function(){c.dropdownStyleStale=!0});c.registerEventListener(a.ownerDocument.defaultView,"scroll",function(){c.dropdownStyleStale=!0});c.registerEventListener(c.dropdownElement,"mousedown",c.handleDropdownMousedown.bind(c));c.registerEventListener(c.inputElement,"keydown",function(){c.hintScrollPositionMayBeStale()});c.registerEventListener(c.inputElement,"mousemove",function(a){0!==a.buttons&&c.hintScrollPositionMayBeStale()});c.registerDisposer(new g.b(r,w)).allShortcutsAreGlobal=!0;Object(g.c)(r,
-"cycle-next-active-completion",function(){c.cycleActiveCompletion(1)});Object(g.c)(r,"cycle-prev-active-completion",function(){c.cycleActiveCompletion(-1)});Object(g.c)(r,"choose-active-completion-or-prefix",function(a){c.selectActiveCompletion(!0)&&a.preventDefault()});Object(g.c)(r,"choose-active-completion",function(a){c.selectActiveCompletion(!1)&&a.preventDefault()});Object(g.c)(r,"cancel",function(a){a.stopPropagation();c.cancel()&&(a.detail.preventDefault(),a.detail.stopPropagation())});return c}
-p(f,a);r(f,[{key:"hintScrollPositionMayBeStale",value:function(){""!==this.hintElement.value&&this.scheduleUpdateHintScrollPosition()}},{key:"handleDropdownMousedown",value:function(a){this.inputElement.focus();for(var b=this.dropdownElement,c=a.target;c instanceof HTMLElement;c=c.parentElement){var d=c[v];if(void 0!==d){this.selectCompletion(d);break}if(c===b)break}a.preventDefault()}},{key:"cycleActiveCompletion",value:function(a){if(null!==this.completionResult){var b=this.activeIndex,c=this.completionResult.completions.length;
-this.setActiveIndex(-1===b?0<a?0:c-1:(b+a+c)%c)}}},{key:"registerInputHandler",value:function(){for(var a=this,b=function(b){b=a.inputElement.value;b!==a.prevInputValue&&(a.prevInputValue=b,a.handleInputChanged(b))},c=$jscomp.makeIterator(["input"]),d=c.next();!d.done;d=c.next())this.registerEventListener(this.inputElement,d.value,b,!1)}},{key:"shouldShowDropdown",value:function(){return null!==this.completionResult&&this.hasFocus?this.hasResultForDropdown:!1}},{key:"updateDropdownStyle",value:function(){Object(e.a)(this.dropdownElement,
-this.inputElement,{horizontal:!1});this.dropdownStyleStale=!1}},{key:"updateDropdown",value:function(){if(this.shouldShowDropdown()){var a=this.dropdownElement,b=this.activeIndex;if(this.dropdownContentsStale){var c=this.completionResult,d=void 0===c.makeElement?n:c.makeElement;this.completionElements=c.completions.map(function(e,g){e=d.call(c,e);e[v]=g;e.classList.add("autocomplete-completion");b===g&&e.classList.add("autocomplete-completion-active");a.appendChild(e);return e});this.dropdownContentsStale=
-!1}this.dropdownStyleStale&&this.updateDropdownStyle();this.completionsVisible||(a.style.display="block",this.completionsVisible=!0);-1!==b&&Object(k.a)(this.completionElements[b])}else this.completionsVisible&&(this.dropdownElement.style.display="none",this.completionsVisible=!1)}},{key:"setCompletions",value:function(a){this.clearCompletions();var b=a.completions;0!==b.length&&(this.completionResult=a,1===b.length?(b=b[0],a.showSingleResult?this.hasResultForDropdown=!0:b.value.startsWith(this.prevInputValue)?
-this.hasResultForDropdown=!1:this.hasResultForDropdown=!0,a.selectSingleResult?this.setActiveIndex(0):this.setHintValue(this.getCompletedValueByIndex(0))):(this.hasResultForDropdown=!0,b=Object(l.a)(function(){function b(b,f){for(;;)switch(c){case 0:g=$jscomp.makeIterator(a.completions),e=g.next();case 1:if(e.done){c=3;break}d=e.value;c=4;return{value:d.value,done:!1};case 4:if(void 0===f){c=5;break}c=-1;throw f;case 5:case 2:e=g.next();c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}
-var c=0,d,e,g,f={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();f[Symbol.iterator]=function(){return this};return f}()),b=this.getCompletedValue(b),b.startsWith(this.prevInputValue)&&(this.commonPrefix=b,this.setHintValue(b))),this.updateDropdown())}},{key:"scheduleUpdateHintScrollPosition",value:function(){var a=this;null===this.updateHintScrollPositionTimer&&(this.updateHintScrollPositionTimer=
-setTimeout(function(){a.updateHintScrollPosition()},0))}},{key:"setHintValue",value:function(a){var b=this.prevInputValue;a!==b&&a.startsWith(b)||(a="");this.hintElement.value=a;this.scheduleUpdateHintScrollPosition()}},{key:"setActiveIndex",value:function(a){if(!this.dropdownContentsStale){var b=this.activeIndex;-1!==b&&this.completionElements[b].classList.remove("autocomplete-completion-active");-1!==a&&(b=this.completionElements[a],b.classList.add("autocomplete-completion-active"),Object(k.a)(b))}-1!==
-a&&this.setHintValue(this.getCompletedValueByIndex(a));this.activeIndex=a}},{key:"getCompletedValueByIndex",value:function(a){return this.getCompletedValue(this.completionResult.completions[a].value)}},{key:"getCompletedValue",value:function(a){return this.prevInputValue.substring(0,this.completionResult.offset)+a}},{key:"selectActiveCompletion",value:function(a){var b=this.activeIndex;if(-1===b){if(!a)return!1;a=this.completionResult;if(null!==a&&1===a.completions.length)b=0;else return a=this.commonPrefix,
-a.length>this.value.length?(this.value=a,!0):!1}a=this.getCompletedValueByIndex(b);if(this.value===a)return!1;this.value=a;return!0}},{key:"selectCompletion",value:function(a){this.value=this.getCompletedValueByIndex(a)}},{key:"cancel",value:function(){return!1}},{key:"updateHintScrollPosition",value:function(){this.updateHintScrollPositionTimer=null;this.hintElement.scrollLeft=this.inputElement.scrollLeft}},{key:"cancelActiveCompletion",value:function(){var a=this.activeCompletionCancellationToken;
-void 0!==a&&a.cancel();this.activeCompletionCancellationToken=void 0;this.activeCompletionPromise=null}},{key:"handleInputChanged",value:function(a){this.cancelActiveCompletion();this.hintElement.value="";this.clearCompletions();this.inputChanged.dispatch(a);this.scheduleUpdateCompletions()}},{key:"clearCompletions",value:function(){null!==this.completionResult&&(this.activeIndex=-1,this.completionElements=this.completionResult=null,this.dropdownStyleStale=this.dropdownContentsStale=!0,this.commonPrefix=
-"",Object(c.a)(this.dropdownElement),this.updateDropdown())}},{key:"disposed",value:function(){Object(c.b)(this.element);this.cancelActiveCompletion();null!==this.updateHintScrollPositionTimer&&(clearTimeout(this.updateHintScrollPositionTimer),this.updateHintScrollPositionTimer=null);u(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}},{key:"disabled",get:function(){return this.inputElement.disabled},set:function(a){this.inputElement.disabled=a}},{key:"value",
-get:function(){return this.prevInputValue},set:function(a){a!==this.prevInputValue&&(this.prevInputValue=this.inputElement.value=a,this.handleInputChanged(a))}}]);return f}(h.a)},function(h,f,a){f.a=function(a,f,h){var d=void 0===h?{}:h,b=void 0===d.horizontal?!1:d.horizontal,c=void 0===d.vertical?!0:d.vertical,e=void 0===d.topMargin?6:d.topMargin,g=void 0===d.bottomMargin?6:d.bottomMargin,l=void 0===d.leftMargin?6:d.leftMargin,k=void 0===d.rightMargin?6:d.rightMargin;h=void 0===d.maxHeight?!0:d.maxHeight;
-d=void 0===d.maxWidth?!0:d.maxWidth;f=f.getBoundingClientRect();if(b){b=f.right;var n=a.ownerDocument.documentElement.clientHeight-f.left;b>n?(a.style.left="",a.style.right="0",d&&(a.style.maxWidth=b-l+"px")):(a.style.right="",a.style.left="0",d&&(a.style.maxWidth=n-k+"px"))}c&&(c=f.top-e,g=a.ownerDocument.documentElement.clientHeight-f.bottom-g,c>3*g?(a.style.top="",a.style.bottom="100%",h&&(a.style.maxHeight=c+"px")):(a.style.top="100%",a.style.bottom="",h&&(a.style.maxHeight=g+"px")))}},function(h,
-f,a){f.a=function(a){$jscomp.initSymbol();$jscomp.initSymbolIterator();a=a[Symbol.iterator]();var f=a.next(),h=f.value;if(f.done)return"";for(f=h.length;0<f;){var d=a.next(),b=d.value;if(d.done)break;for(d=0;d<f&&h.charCodeAt(d)===b.charCodeAt(d);++d);f=d}return h.substring(0,f)}},function(h,f,a){f.a=function(a){var f=a.parentElement,h=a.offsetLeft-f.clientLeft,d=a.offsetTop-f.clientTop,b=f.scrollLeft,c=f.scrollTop;d=Math.max(0,d+a.offsetHeight-(c+f.clientHeight))||Math.min(0,d-c);f.scrollLeft+=Math.max(0,
-h+a.offsetWidth-(b+f.clientWidth))||Math.min(0,h-b);f.scrollTop+=d}},function(h,f){},function(h,f,a){f.a=function(){var a=document.createElement("button");a.type="submit";a.className="hidden-submit-button";a.style.margin="0";a.style.border="0";a.style.padding="0";a.style.width="0";a.style.height="0";a.style.overflow="hidden";a.tabIndex=-1;return a}},function(h,f){},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a){return{mouseState:a.mouseState,showAxisLines:a.showAxisLines,showScaleBar:a.showScaleBar,scaleBarOptions:a.scaleBarOptions,
-showPerspectiveSliceViews:a.showPerspectiveSliceViews,inputEventBindings:a.inputEventBindings,visibility:a.visibility,selectedLayer:a.selectedLayer,visibleLayerRoles:a.visibleLayerRoles,navigationState:a.navigationState.addRef(),perspectiveNavigationState:a.perspectiveNavigationState.addRef(),crossSectionBackgroundColor:a.crossSectionBackgroundColor}}function b(a,b,c){var d=Object(t.c)(a,"dragenter",function(b){void 0!==Object(k.c)(b)&&a.classList.add("neuroglancer-drag-over")}),e=Object(t.c)(a,"dragleave",
-function(){a.classList.remove("neuroglancer-drag-over")}),f=Object(t.c)(a,"dragover",function(a){Object(g.c)(a)?(Object(r.e)(a,Object(g.b)(a,b)),a.stopPropagation(),a.preventDefault()):void 0!==Object(k.c)(a)&&(Object(k.f)(a,b,!0),a.stopPropagation(),a.preventDefault())}),l=Object(t.c)(a,"drop",function(d){a.classList.remove("neuroglancer-drag-over");if(Object(g.c)(d)){d.stopPropagation();try{var e=JSON.parse(d.dataTransfer.getData(g.d))}catch(U){return}var f=Object(k.b)(d,b,!1,!1,!0);if(void 0!==
-f&&f.finalize(d)){d.preventDefault();d.dataTransfer.dropEffect=Object(r.c)();Object(k.a)(d);var l=c();f=$jscomp.makeIterator(f.layers.keys());for(d=f.next();!d.done;d=f.next())l.layerSpecification.add(d.value);try{l.restoreState(e)}catch(U){}}}else if(e=Object(k.b)(d,b,"copy"===Object(r.c)(),!1,!0),void 0!==e&&e.finalize(d)){d.preventDefault();d.dataTransfer.dropEffect=Object(r.c)();Object(k.a)(d);l=c();f=$jscomp.makeIterator(e.layers.keys());for(d=f.next();!d.done;d=f.next())l.layerSpecification.add(d.value);
-try{l.layout.restoreState(e.layoutSpec)}catch(U){l.layout.reset()}}});return function(){l();f();e();d()}}function c(a,b){var c=document.createElement("div");c.style.flex="1";c.style.width="0px";if("string"===typeof b){if(void 0!==a.parent)throw Error("Invalid layout component specification: "+JSON.stringify(b));return new z(c,b,a.viewer)}Object(u.t)(b);var e=Object(u.v)(b,"type",u.A);switch(e){case "row":case "column":return new D(c,e,Object(u.v)(b,"children",function(b){b=Object(u.a)(b,function(a){return a});
-if(void 0===a.parent&&0===b.length)throw Error("Stack layout requires at least one child.");return b}),a);case "viewer":e=a.viewer;var f=new l.a(e.layerSpecification.addRef());c=new g.a(c,Object.assign({display:e.display,layerSpecification:f},d(e)),{showLayerPanel:e.uiControlVisibility.showLayerPanel,showViewerMenu:!0});try{c.restoreState(b)}catch(J){throw c.dispose(),J;}return c;default:return new z(c,b,a.viewer)}}a.d(f,"a",function(){return E});h=a(10);var e=a.n(h),g=a(334),l=a(27),k=a(118),t=a(1),
-m=a(8),r=a(119),u=a(4),v=a(7),w=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),y=function C(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return C(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?
-void 0:b.call(c)}};a(341);$jscomp.initSymbol();var x=Symbol("layoutComponentContainer"),A=function(a){function d(a,c,e){q(this,d);var g=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));g.viewer=a;g.parent=e;g.changed=new v.a;g.element=document.createElement("div");var f=g.element;f.style.display="flex";f.style.flex="1";f.style.position="relative";f.style.alignItems="stretch";f.foo="hello";f[x]=g;g.setSpecification(c);var l=[];a=function(a){var c=document.createElement("div");c.className=
-"neuroglancer-layout-split-drop-zone";c.style[a]="0";switch(a){case "left":case "right":var d="row";c.style.width="10px";c.style.height="100%";break;case "top":case "bottom":d="column",c.style.height="10px",c.style.width="100%"}c.style.display="none";l.push({element:c,direction:d,orientation:a});f.appendChild(c);g.registerDisposer(b(c,g.viewer.layerSpecification,function(){return g.split(a).newContainer.component}))};a("left");a("right");a("top");a("bottom");var h=!1;g.registerEventListener(f,"dragenter",
-function(a){if(!h&&void 0!==Object(k.c)(a)){h=!0;a=$jscomp.makeIterator(l);for(var b=a.next();!b.done;b=a.next()){var c=b.value;b=c.element;var d=c.direction;c=c.orientation;if(void 0===e||d!==e.direction||("left"!==c&&"top"!==c||e.get(0)===g)&&("bottom"!==c&&"right"!==c||e.get(e.length-1)===g))c=g.component,c instanceof D&&c.direction===d||(b.style.display="block")}}},!0);g.registerEventListener(f,"drop",function(a){if(h){h=!1;a=$jscomp.makeIterator(l);for(var b=a.next();!b.done;b=a.next())b.value.element.style.display=
-"none"}});g.registerEventListener(f,"dragleave",function(a){a=a.relatedTarget;if(h&&!(a instanceof HTMLElement&&g.element.contains(a))){h=!1;a=$jscomp.makeIterator(l);for(var b=a.next();!b.done;b=a.next())b.value.element.style.display="none"}},!0);return g}n(d,a);w(d,[{key:"unsetComponent",value:function(){var a=this.componentValue;void 0!==a&&(a.changed.remove(this.changed.dispatch),this.element.removeChild(a.element),a.dispose())}},{key:"setComponent",value:function(a){var b=this;this.unsetComponent();
-this.componentValue=a;a.changed.add(this.changed.dispatch);this.element.appendChild(a.element);if(a instanceof g.a){var c=a.layerManager,d=a.registerCancellable(e()(function(){0===c.managedLayers.length&&b.dispose()},0));a.registerDisposer(c.layersChanged.add(function(){0===c.managedLayers.length&&d()}));d()}else if(a instanceof D){var f=a.registerCancellable(e()(function(){var c=a.length;if(0===c&&void 0!==b.parent)b.dispose();else if(1===c){c=a.get(0).component;if(void 0===b.parent&&c instanceof
-g.a){var d=c.layout.specification.toJSON();c.viewerNavigationState.copyToParent();var e=new Set(c.layerManager.managedLayers),f=c.layerSpecification;f.rootLayers.filter(function(a){return e.has(a)});f.rootLayers.managedLayers=Array.from(c.layerManager.managedLayers);f.rootLayers.layersChanged.dispatch()}else d=c.toJSON();b.setSpecification(d)}},0));a.registerDisposer(a.changed.add(function(){2>a.length&&f()}));f()}this.changed.dispatch()}},{key:"toJSON",value:function(){return this.component.toJSON()}},
-{key:"setSpecification",value:function(a){this.setComponent(c(this,a))}},{key:"disposed",value:function(){this.unsetComponent();this.componentValue=void 0;y(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}},{key:"split",value:function(a){var b={type:"viewer"},c=this.parent;if(void 0!==c){if("left"===a&&"row"===c.direction||"top"===a&&"column"===c.direction)return{newContainer:c.insertChild(b,this),existingContainer:this};if("right"===a&&"row"===c.direction||"bottom"===
-a&&"column"===c.direction)return{newContainer:c.insertChild(b),existingContainer:this}}c=this.component;c=c instanceof z?c.layerGroupViewer.toJSON():c.toJSON();var d="left"===a||"right"===a?"row":"column";switch(a){case "left":case "top":var e={type:d,children:[b,c]};var g=0;break;case "right":case "bottom":e={type:d,children:[c,b]},g=1}this.setSpecification(e);a=this.component;return{newContainer:a.get(g),existingContainer:a.get(1-g)}}},{key:"component",get:function(){return this.componentValue}}],
-[{key:"getFromElement",value:function(a){return a[x]}}]);return d}(t.a),z=function(a){function b(a,c,e){q(this,b);var f=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));f.element=a;f.layerGroupViewer=f.registerDisposer(new g.a(a,Object.assign({display:e.display,layerSpecification:e.layerSpecification.addRef()},d(e)),{showLayerPanel:e.uiControlVisibility.showLayerPanel,showViewerMenu:!1}));f.layerGroupViewer.layout.restoreState(c);return f}n(b,a);w(b,[{key:"toJSON",value:function(){return this.layerGroupViewer.layout.specification.toJSON()}},
-{key:"changed",get:function(){return this.layerGroupViewer.layout.changed}}]);return b}(t.a),D=function(a){function c(a,b,d,e){q(this,c);var g=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));g.element=a;g.direction=b;g.container=e;g.changed=new v.a;a.classList.add("neuroglancer-stack-layout");a.classList.add("neuroglancer-stack-layout-"+b);a.style.display="flex";a.style.flexDirection=b;a.appendChild(g.makeDropPlaceholder(g));a=$jscomp.makeIterator(d);for(b=a.next();!b.done;b=a.next())g.insertChild(b.value);
-return g}n(c,a);$jscomp.initSymbol();$jscomp.initSymbolIterator();w(c,[{key:"makeDropPlaceholder",value:function(a){var c=this,d=document.createElement("div");d.className="neuroglancer-stack-layout-drop-placeholder";a.registerDisposer(b(d,this.viewer.layerSpecification,function(){var a=d.nextElementSibling,b;null!==a&&(b=A.getFromElement(a));return c.insertChild({type:"viewer",layers:[]},b).component}));a.registerDisposer(function(){Object(m.b)(d)});return d}},{key:"get",value:function(a){return A.getFromElement(this.element.children[2*
-a+1])}},{key:"insertChild",value:function(a,b){var c=this,d=new A(this.viewer,a,this);a=this.makeDropPlaceholder(d);d.element.classList.add("neuroglancer-stack-layout-child");d.registerDisposer(d.changed.add(this.changed.dispatch));d.registerDisposer(function(){c.element.removeChild(d.element);c.changed.dispatch()});b=void 0!==b?b.element:null;this.element.insertBefore(d.element,b);this.element.insertBefore(a,b);this.changed.dispatch();return d}},{key:"disposed",value:function(){this.clear();y(c.prototype.__proto__||
-Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}},{key:"clear",value:function(){for(;0!==this.length;)this.get(0).dispose()}},{key:Symbol.iterator,value:function(){function a(a,f){for(;;)switch(b){case 0:e=g,d=e.length,c=0;case 1:if(!(c<d)){b=3;break}b=4;return{value:g.get(c),done:!1};case 4:if(void 0===f){b=5;break}b=-1;throw f;case 5:case 2:++c;b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,c,d,e,g=this,f={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();f[Symbol.iterator]=function(){return this};return f}},{key:"toJSON",value:function(){return{type:this.direction,children:Array.from(this).map(function(a){return a.toJSON()})}}},{key:"length",get:function(){return(this.element.childElementCount-1)/2}},{key:"viewer",get:function(){return this.container.viewer}}]);return c}(t.a),E=function(a){function b(a,c){q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));
-d.viewer=a;d.defaultSpecification=c;d.container=d.registerDisposer(new A(d.viewer,d.defaultSpecification,void 0));return d}n(b,a);w(b,[{key:"reset",value:function(){this.container.setSpecification(this.defaultSpecification)}},{key:"restoreState",value:function(a){this.container.setSpecification(a)}},{key:"disposed",value:function(){y(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"toJSON",value:function(){return this.container.toJSON()}},{key:"changed",
-get:function(){return this.container.changed}},{key:"element",get:function(){return this.container.element}}]);return b}(t.a)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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 d(a,b){a=new t.a(a);var c=a.element;c.classList.add("neuroglancer-layer-group-viewer-context-menu");var d=document.createElement("button");d.textContent="Remove layer group";c.appendChild(d);a.registerEventListener(d,"click",function(){b.layerSpecification.layerManager.clear()});d=b.viewerNavigationState;
-d=$jscomp.makeIterator([["Position",d.position.link],["Cross-section orientation",d.crossSectionOrientation.link],["Cross-section zoom",d.crossSectionZoom.link],["Perspective orientation",d.perspectiveOrientation.link],["Perspective zoom",d.perspectiveZoom.link]]);for(var e=d.next();!e.done;e=d.next()){var g=$jscomp.makeIterator(e.value);e=g.next().value;g=g.next().value;g=a.registerDisposer(new x.a(g));var f=document.createElement("label");f.style.display="flex";f.style.flexDirection="row";f.style.whiteSpace=
-"nowrap";f.textContent=e;f.appendChild(g.element);c.appendChild(f)}return a}f.c=function(a){return-1!==a.dataTransfer.types.indexOf("neuroglancer-layer-group-viewer")};f.b=function(a,b){if(a.shiftKey)return"copy";if(a.ctrlKey)return"move";a=D&&D.viewer.layerSpecification.rootLayers===b.rootLayers?D.viewer:void 0;return void 0!==a?"move":"copy"};a.d(f,"a",function(){return G});h=a(10);var b=a.n(h),c=a(83),e=a(335),g=a(27),l=a(57),k=a(35),t=a(188),m=a(118),r=a(189),u=a(79);h=a(1);var v=a(8),w=a(22),
-y=a(67),x=a(339),A=function B(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return B(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},z=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();
-a(340);f.d="neuroglancer-layer-group-viewer";var D,E=function(a){function b(a){q(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.position=new l.b(a.navigationState.position.addRef());c.crossSectionOrientation=new l.a(a.navigationState.pose.orientation.addRef());c.crossSectionZoom=new l.c(a.navigationState.zoomFactor.addRef());c.navigationState=c.registerDisposer(new l.e(new l.g(c.position.value,c.crossSectionOrientation.value),c.crossSectionZoom.value));c.perspectiveOrientation=
-new l.a(a.perspectiveNavigationState.pose.orientation.addRef());c.perspectiveZoom=new l.c(a.perspectiveNavigationState.zoomFactor.addRef());c.perspectiveNavigationState=c.registerDisposer(new l.e(new l.g(c.position.value.addRef(),c.perspectiveOrientation.value),c.perspectiveZoom.value));return c}n(b,a);z(b,[{key:"copyToParent",value:function(){for(var a=$jscomp.makeIterator([this.position,this.crossSectionOrientation,this.crossSectionZoom,this.perspectiveOrientation,this.perspectiveZoom]),b=a.next();!b.done;b=
-a.next())b.value.copyToPeer()}},{key:"register",value:function(a){a.add("position",this.position);a.add("crossSectionOrientation",this.crossSectionOrientation);a.add("crossSectionZoom",this.crossSectionZoom);a.add("perspectiveOrientation",this.perspectiveOrientation);a.add("perspectiveZoom",this.perspectiveZoom)}}]);return b}(h.a),G=function(a){function f(a,d,e){e=void 0===e?{}:e;q(this,f);var l=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));l.element=a;l.viewerState=d;l.state=new y.a;
-l.options=Object.assign({showLayerPanel:new k.b(!0),showViewerMenu:!1},e);l.layerSpecification=l.registerDisposer(d.layerSpecification);l.viewerNavigationState=l.registerDisposer(new E(d));l.viewerNavigationState.register(l.state);l.layerSpecification instanceof g.a?l.state.add("layers",l.layerSpecification):l.state.add("layers",{changed:l.layerSpecification.changed,toJSON:function(){return l.layerSpecification.layerManager.managedLayers.map(function(a){return a.name})},reset:function(){throw Error("not implemented");
-},restoreState:function(){throw Error("not implemented");}});a.classList.add("neuroglancer-layer-group-viewer");l.registerDisposer(new u.a(a));l.layout=l.registerDisposer(new c.a(l,"xy"));l.state.add("layout",l.layout);l.registerActionBindings();l.registerDisposer(l.layerManager.useDirectly());l.registerDisposer(Object(r.a)(a,l.navigationState.position));l.registerDisposer(l.options.showLayerPanel.changed.add(l.registerCancellable(b()(function(){return l.updateUI()},0))));l.makeUI();return l}n(f,
-a);z(f,[{key:"bindAction",value:function(a,b){this.registerDisposer(Object(w.c)(this.element,a,b))}},{key:"registerActionBindings",value:function(){var a=this;this.bindAction("add-layer",function(){a.layerPanel&&a.layerPanel.addLayerMenu()})}},{key:"toJSON",value:function(){return Object.assign({type:"viewer"},this.state.toJSON())}},{key:"reset",value:function(){this.state.reset()}},{key:"restoreState",value:function(a){this.state.restoreState(a)}},{key:"makeUI",value:function(){this.element.style.flex=
-"1";this.element.style.display="flex";this.element.style.flexDirection="column";this.element.appendChild(this.layout.element);this.updateUI()}},{key:"updateUI",value:function(){var a=this,b=this.options,c=b.showLayerPanel.value;void 0===this.layerPanel||c?c&&void 0===this.layerPanel&&(c=this.layerPanel=new e.a(this.display,this.layerSpecification,this.viewerNavigationState,this.viewerState.selectedLayer,function(){return a.layout.toJSON()}),b.showViewerMenu?(c.registerDisposer(d(c.element,this)),
-c.element.title="Right click for options, drag to move/copy layer group."):c.element.title="Drag to move/copy layer group.",c.element.draggable=!0,this.registerEventListener(c.element,"dragstart",function(b){Object(m.e)(b,{manager:a.layerSpecification,layers:a.layerManager.managedLayers,layoutSpec:a.layout.toJSON()});var c=function(){D&&D.viewer===a&&(D=void 0);a.unregisterDisposer(c)};D={viewer:a,disposer:c};a.registerDisposer(c);var d=a.toJSON();delete d.layers;b.dataTransfer.setData("neuroglancer-layer-group-viewer",
-JSON.stringify(d))}),this.registerEventListener(c.element,"dragend",function(b){Object(m.a)(b);void 0!==D&&D.viewer===a&&D.disposer()}),this.element.insertBefore(c.element,this.element.firstChild)):(this.layerPanel.dispose(),this.layerPanel=void 0)}},{key:"disposed",value:function(){Object(v.a)(this.element);var a=this.layerPanel;void 0!==a&&(a.dispose(),this.layerPanel=void 0);A(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}},{key:"perspectiveNavigationState",
-get:function(){return this.viewerNavigationState.perspectiveNavigationState}},{key:"navigationState",get:function(){return this.viewerNavigationState.navigationState}},{key:"display",get:function(){return this.viewerState.display}},{key:"selectedLayer",get:function(){return this.viewerState.selectedLayer}},{key:"layerManager",get:function(){return this.layerSpecification.layerManager}},{key:"chunkManager",get:function(){return this.layerSpecification.chunkManager}},{key:"mouseState",get:function(){return this.viewerState.mouseState}},
-{key:"showAxisLines",get:function(){return this.viewerState.showAxisLines}},{key:"showScaleBar",get:function(){return this.viewerState.showScaleBar}},{key:"showPerspectiveSliceViews",get:function(){return this.viewerState.showPerspectiveSliceViews}},{key:"inputEventBindings",get:function(){return this.viewerState.inputEventBindings}},{key:"visibility",get:function(){return this.viewerState.visibility}},{key:"visibleLayerRoles",get:function(){return this.viewerState.visibleLayerRoles}},{key:"crossSectionBackgroundColor",
-get:function(){return this.viewerState.crossSectionBackgroundColor}},{key:"scaleBarOptions",get:function(){return this.viewerState.scaleBarOptions}},{key:"changed",get:function(){return this.state.changed}}]);return f}(h.a)},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}
-function n(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 d(a,b){if("move"===a.method)return!1;a.manager.layerManager.filter(function(b){return!a.layers.has(b)});return void 0!==b&&a.layers.has(b)}function b(a,b,c){function e(b,e){var g=
-a.dropLayers,f=e?Object(l.d)(b,a.manager):Object(r.c)(),k=!0;if(void 0!==g&&(e&&Object(r.e)(b,f),!g.compatibleWithMethod(f)&&(a.dropLayers=void 0,d(g,c))))return;if(void 0===g){g=a.dropLayers=Object(l.b)(b,a.manager,"copy"===f,!0,!1);if(void 0===g)return;k="move"===g.method}if(void 0!==c&&g.layers.has(c))return g;if(k){var h=a.manager.layerManager,m=new Set,n=Number.POSITIVE_INFINITY;b=h.managedLayers=h.managedLayers.filter(function(a,b){return g.layers.has(a)?(n===Number.POSITIVE_INFINITY&&(n=b),
-m.add(a),!1):!0});void 0!==c?(e=b.indexOf(c),n<=e&&++e):e=b.length;f=$jscomp.makeIterator(g.layers.keys());for(k=f.next();!k.done;k=f.next())k=k.value,m.has(k)||g.layers.delete(k);b.splice.apply(b,[].concat([e,0],$jscomp.arrayFromIterable(g.layers.keys())));h.layersChanged.dispatch()}else for(void 0!==c&&(h=a.manager.layerManager.managedLayers.indexOf(c)),b=$jscomp.makeIterator(g.layers.keys()),e=b.next();!e.done;e=b.next())a.manager.add(e.value,h);return g}var g=Object(t.c)(b,"dragenter",function(a){void 0!==
-e(a,!0)&&a.preventDefault()}),f=Object(t.c)(b,"drop",function(b){b.preventDefault();var c=e(b,!1);void 0!==c&&(c.finalize(b)?(b.dataTransfer.dropEffect=Object(r.c)(),Object(l.a)("move"===c.method?void 0:b)):d(c));a.dropLayers=void 0}),k=Object(t.c)(b,"dragover",function(a){void 0!==e(a,!0)&&(a.preventDefault(),a.stopPropagation())});return function(){k();f();g()}}a.d(f,"a",function(){return A});var c=a(185),e=a(27),g=a(57),l=a(118),k=a(187),t=a(1),m=a(8),r=a(119),u=a(109),v=a(120),w=function(){function a(a,
-b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),y=function D(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return D(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};a(45);a(337);a(84);var x=function(a){function d(a,
-g){q(this,d);var f=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));f.layer=a;f.panel=g;var k=f.element=document.createElement("div");k.title="Control+click for layer options, drag to move/copy.";k.className="neuroglancer-layer-item neuroglancer-noselect";var h=f.labelElement=document.createElement("span");h.className="neuroglancer-layer-item-label";var m=f.layerNumberElement=document.createElement("span");m.className="neuroglancer-layer-item-number";var n=f.valueElement=document.createElement("span");
-n.className="neuroglancer-layer-item-value";var r=Object(u.a)();r.title="Delete layer";f.registerEventListener(r,"click",function(a){f.panel.layerManager.removeManagedLayer(f.layer);a.stopPropagation()});k.appendChild(m);k.appendChild(h);k.appendChild(n);k.appendChild(r);f.registerEventListener(k,"click",function(b){b.ctrlKey?(g.selectedLayer.layer=a,g.selectedLayer.visible=!0):a.setVisible(!a.visible)});f.registerEventListener(k,"contextmenu",function(b){g.selectedLayer.layer=a;g.selectedLayer.visible=
-!0;b.stopPropagation();b.preventDefault()});k.draggable=!0;f.registerEventListener(k,"dragstart",function(a){Object(l.e)(a,{manager:g.manager,layers:[f.layer],layoutSpec:g.getLayoutSpecForDrag()});a.stopPropagation()});f.registerEventListener(k,"dragend",function(a){Object(l.a)(a)});f.registerDisposer(b(f.panel,k,f.layer));f.registerEventListener(k,"dblclick",function(b){a instanceof e.b&&new c.a(f.panel.manager,a)});return f}n(d,a);w(d,[{key:"update",value:function(){var a=this.layer;this.labelElement.textContent=
-a.name;this.element.setAttribute("layer-visible",a.visible.toString());this.element.setAttribute("layer-selected",(a===this.panel.selectedLayer.layer).toString())}},{key:"disposed",value:function(){this.element.parentElement.removeChild(this.element);y(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}}]);return d}(t.a),A=function(a){function f(a,c,l,h,m){q(this,f);var n=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));n.display=a;n.manager=c;n.viewerNavigationState=
-l;n.selectedLayer=h;n.getLayoutSpecForDrag=m;n.layerWidgets=new Map;n.element=document.createElement("div");n.layerUpdateNeeded=!0;n.valueUpdateNeeded=!1;n.layerWidgetInsertionPoint=document.createElement("div");n.positionWidget=n.registerDisposer(new v.b(n.viewerNavigationState.position.value));n.scheduleUpdate=n.registerCancellable(Object(k.a)(function(){return n.update()}));n.registerDisposer(h);var t=n.element;t.className="neuroglancer-layer-panel";n.registerDisposer(c.layerSelectedValues.changed.add(function(){n.handleLayerValuesChanged()}));
-n.registerDisposer(c.layerManager.layersChanged.add(function(){n.handleLayersChanged()}));n.registerDisposer(h.changed.add(function(){n.handleLayersChanged()}));n.layerWidgetInsertionPoint.style.display="none";n.element.appendChild(n.layerWidgetInsertionPoint);c=n.addButton=document.createElement("div");c.className="neuroglancer-layer-add-button neuroglancer-button";c.title="Click to add layer, control+click to add local annotation layer.";c.textContent="+";l=n.dropZone=document.createElement("div");
-l.className="neuroglancer-layer-panel-drop-zone";n.registerEventListener(c,"click",function(a){a.ctrlKey?(a=new e.b("annotation",{},n.manager),n.manager.initializeLayerFromSpec(a,{type:"annotation"}),n.manager.add(a)):n.addLayerMenu()});t.appendChild(c);t.appendChild(l);n.registerDisposer(Object(r.d)(c));t.appendChild(n.positionWidget.element);h=function(){n.positionWidget.element.style.display=n.viewerNavigationState.position.link.value===g.d.LINKED?"none":null};n.registerDisposer(n.viewerNavigationState.position.link.changed.add(h));
-h();n.update();n.registerEventListener(t,"dragleave",function(a){a.relatedTarget&&t.contains(a.relatedTarget)||(a=n.dropLayers,void 0!==a&&(d(a),n.dropLayers=void 0))});n.registerDisposer(b(n,c,void 0));n.registerDisposer(b(n,l,void 0));n.registerDisposer(a.updateStarted.add(function(){return n.updateLayers()}));return n}n(f,a);w(f,[{key:"disposed",value:function(){this.layerWidgets.forEach(function(a){return a.dispose()});this.layerWidgets=void 0;Object(m.b)(this.element);y(f.prototype.__proto__||
-Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}},{key:"handleLayersChanged",value:function(){this.layerUpdateNeeded=!0;this.handleLayerValuesChanged()}},{key:"handleLayerValuesChanged",value:function(){this.valueUpdateNeeded||(this.valueUpdateNeeded=!0,this.scheduleUpdate())}},{key:"update",value:function(){this.valueUpdateNeeded=!1;this.updateLayers();for(var a=this.manager.layerSelectedValues,b=$jscomp.makeIterator(this.layerWidgets),c=b.next();!c.done;c=b.next()){c=$jscomp.makeIterator(c.value);
-var d=c.next().value;c=c.next().value;var e=d.layer;d="";null!==e&&(e=a.get(e),void 0!==e&&(d=""+e));c.valueElement.textContent=d}}},{key:"updateLayers",value:function(){var a=this;if(this.layerUpdateNeeded){this.layerUpdateNeeded=!1;var b=this.element,c=new Set,d=this.layerWidgetInsertionPoint.nextElementSibling;this.manager.layerManager.managedLayers.forEach(function(e){c.add(e);var g=a.layerWidgets.get(e),f=a.manager.rootLayers.managedLayers.indexOf(e);void 0===g&&(g=new x(e,a),a.layerWidgets.set(e,
-g));g.layerNumberElement.textContent=""+(1+f);g.update();e=g.element;e!==d&&b.insertBefore(g.element,d);d=e.nextElementSibling});for(var e=$jscomp.makeIterator(this.layerWidgets),g=e.next();!g.done;g=e.next()){var f=$jscomp.makeIterator(g.value);g=f.next().value;f=f.next().value;c.has(g)||(this.layerWidgets.delete(g),f.dispose())}}}},{key:"addLayerMenu",value:function(){new c.a(this.manager)}},{key:"layerManager",get:function(){return this.manager.layerManager}}]);return f}(t.a)},function(h,f){},
-function(h,f){},function(h,f){},function(h,f,a){function q(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,
-c):a.__proto__=c)}a.d(f,"a",function(){return d});h=a(1);var n=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,d,g){d&&a(b.prototype,d);g&&a(b,g);return b}}(),d=function(a){function b(a){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var c=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.model=a;c.element=document.createElement("select");
-c.valueIndexMap=new Map;for(var d=c.element,e=c.valueIndexMap,f=0,h=$jscomp.makeIterator(Object.keys(a.enumType)),n=h.next();!n.done;n=h.next())if(n=n.value,isNaN(Number(n))){var p=document.createElement("option");p.textContent=p.value=n.toLowerCase();d.appendChild(p);e.set(a.enumType[n],f);++f}c.registerDisposer(a.changed.add(function(){return c.updateView()}));c.registerEventListener(d,"change",function(){return c.updateModel()});c.updateView();return c}p(b,a);n(b,[{key:"updateView",value:function(){this.element.selectedIndex=
-this.valueIndexMap.get(this.model.value)}},{key:"updateModel",value:function(){this.model.restoreState(this.element.value)}}]);return b}(h.a)},function(h,f){},function(h,f){},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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)}a.d(f,"a",function(){return r});h=a(343);a.n(h);h=a(1);var d=a(8),b=a(29),c=a(109),e=a(40),g=function v(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return v(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===
-b?void 0:b.call(c)}},l=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),k=function(a){function b(a){q(this,b);var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.layer=a;c.tabView=new e.d(c.layer.tabs.addRef(),c.visibility);c.element.appendChild(c.tabView.element);c.element.classList.add("neuroglancer-layer-side-panel-info-panel");
-c.tabView.element.style.flex="1";return c}n(b,a);return b}(e.b),t=function(a){function b(){q(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));a.element.classList.add("neuroglancer-layer-side-panel-info-panel-empty");a.element.textContent="Information about this layer will be available once it finishes loading.";return a}n(b,a);l(b,[{key:"layer",get:function(){return null}}]);return b}(e.b),m=function(a){function b(a,d,g){q(this,b);var f=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));
-f.layer=a;f.layerManager=d;f.collapse=g;f.element=document.createElement("div");f.title=document.createElement("div");f.layerName=document.createElement("input");f.stack=f.registerDisposer(new e.a(function(a){return null===a?new t:new k(a)},f.visibility));var l=f.element;d=f.title;g=f.layerName;var h=f.stack;l.className="neuroglancer-managed-user-layer-info-panel";d.className="neuroglancer-layer-side-panel-title";h.element.classList.add("neuroglancer-layer-side-panel-content-container");l.appendChild(d);
-l.appendChild(h.element);l=Object(c.a)();l.title="Close side panel";l.addEventListener("click",function(){f.collapse()});d.appendChild(g);g.spellcheck=!1;g.title="Rename layer";d.appendChild(l);g.addEventListener("change",function(){return f.handleLayerNameViewChanged()});g.addEventListener("blur",function(){return f.handleLayerNameViewChanged()});f.registerDisposer(a.layerChanged.add(function(){return f.handleLayerNameModelChanged()}));f.handleUserLayerChanged();f.handleLayerNameModelChanged();return f}
-n(b,a);l(b,[{key:"handleUserLayerChanged",value:function(){this.stack.selected!==this.layer.layer&&(this.stack.invalidateAll(),this.stack.selected=this.layer.layer)}},{key:"handleLayerNameModelChanged",value:function(){this.layerName.value=this.layer.name}},{key:"handleLayerNameViewChanged",value:function(){var a=this.layer;if(void 0!==a){var b=this.layerName.value;b!==a.name&&(b=this.layerManager.getUniqueLayerName(b),this.layerName.value=b,a.name=b,a.layerChanged.dispatch())}}}]);return b}(e.b),
-r=function(a){function c(a){q(this,c);var b=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));b.state=a;b.element=document.createElement("div");b.stack=b.registerDisposer(new e.a(function(a){return new m(a,b.state.layerManager,b.collapse.bind(b))}));var d=b.element,g=b.stack;d.className="neuroglancer-layer-side-panel";g.element.classList.add("neuroglancer-layer-info-panel-container");d.appendChild(g.element);b.registerDisposer(a.changed.add(function(){return b.handleStateChanged()}));b.registerDisposer(a.layerManager.layersChanged.add(function(){return b.handleLayersChanged()}));
-b.handleStateChanged();return b}n(c,a);l(c,[{key:"handleLayersChanged",value:function(){for(var a=this.state.layerManager,b=this.stack,c=$jscomp.makeIterator(b.tabs.keys()),d=c.next();!d.done;d=c.next())d=d.value,a.has(d)||b.invalidate(d)}},{key:"collapse",value:function(){!0===this.state.visible&&(this.state.visible=!1,this.state.changed.dispatch())}},{key:"handleStateChanged",value:function(){var a=this.state,c=a.visible;this.element.style.display=c?null:"none";this.stack.visibility.value=c?b.b.VISIBLE:
-b.b.IGNORED;this.stack.selected=a.layer}},{key:"disposed",value:function(){Object(d.b)(this.element);g(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(h.a)},function(h,f){},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return r});h=a(345);a.n(h);h=a(10);var n=a.n(h),d=a(28),b=a(102),c=a(108);h=a(1);var e=a(8),g=a(167),l=a(346),k=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,
-c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),t=function v(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return v(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},m=new Map([[d.c.AXIS_ALIGNED_BOUNDING_BOX,function(a,b,c,d){d=document.createElement("div");d.className="neuroglancer-annotation-details-volume";d.textContent=Object(g.a)(a.pointA,a.pointB,c);b.appendChild(d)}]]),
-r=function(a){function g(a,b,c){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var d=q(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));d.mouseState=a;d.layerManager=b;d.voxelSize=c;d.tooltip=void 0;d.debouncedShowTooltip=d.registerCancellable(n()(function(){return d.doCreateTooltip()},500));d.debouncedShowTooltip0=d.registerCancellable(n()(function(){return d.doCreateTooltip()},0));d.doCreateTooltip=function(){d.debouncedShowTooltip.cancel();d.debouncedShowTooltip0.cancel();
-var a=d.mouseState;d.maybeCreateTooltip()?d.tooltip.updatePosition(a.pageX,a.pageY):(a=d.tooltip,void 0!==a&&(a.dispose(),d.tooltip=void 0),d.setReference(void 0))};d.registerDisposer(a.changed.add(function(){return d.mouseStateChanged()}));return d}p(g,a);k(g,[{key:"setReference",value:function(a){var b=this.reference;void 0!==b&&(b.changed.remove(this.debouncedShowTooltip0),b.dispose(),this.reference=void 0);this.reference=a;void 0!==a&&a.changed.add(this.debouncedShowTooltip0)}},{key:"maybeCreateTooltip",
-value:function(){var a=Object(b.a)(this.mouseState,this.layerManager);if(void 0===a||!this.voxelSize.valid)return!1;var g=this.tooltip;void 0===g&&(g=this.tooltip=new l.a,g.element.classList.add("neuroglancer-mouse-selection-tooltip"));var f=a.annotationLayer.source.getReference(a.id);this.setReference(f);if(null===f.value)return!1;Object(e.a)(g.element);var k=document.createElement("div");k.className="neuroglancer-mouse-selection-tooltip-title";k.textContent=""+a.layer.name;var h=document.createElement("div");
-h.className="neuroglancer-mouse-selection-tooltip-description";f=f.value;h.textContent=void 0===f?"Loading...":f.description||"";g.element.appendChild(k);g.element.appendChild(h);if(null!=f){k=f.segments;if(void 0!==k&&0<k.length){var n=document.createElement("div");n.className="neuroglancer-annotation-segment-list";var r=a.annotationLayer.segmentationState.value,t=r?r.segmentColorHash:void 0;k.forEach(function(a,b){0!==b&&n.appendChild(document.createTextNode(" "));b=document.createElement("span");
-b.className="neuroglancer-annotation-segment-item";b.textContent=a.toString();void 0!==r&&(b.style.backgroundColor=t.computeCssColor(a));n.appendChild(b)});g.element.appendChild(n)}a=a.annotationLayer.objectToGlobal;k=Object(d.g)(f.type);h=document.createElement("div");h.appendChild(document.createTextNode(k.icon));Object(c.c)(h,f,a,this.voxelSize);h.className="neuroglancer-mouse-selection-tooltip-annotation-corners";g.element.appendChild(h);k=m.get(f.type);void 0!==k&&k(f,g.element,a,this.voxelSize)}return!0}},
-{key:"mouseStateChanged",value:function(){var a=this.tooltip;void 0!==a&&(a.dispose(),this.tooltip=void 0);this.setReference(void 0);this.debouncedShowTooltip()}},{key:"disposed",value:function(){var a=this.tooltip;void 0!==a&&(a.dispose(),this.tooltip=void 0);this.setReference(void 0);t(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",this).call(this)}}]);return g}(h.a)},function(h,f){},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
-typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return b});h=a(347);a.n(h);h=a(1);var p=a(8),n=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),d=function e(a,
-b,d){null===a&&(a=Function.prototype);var g=Object.getOwnPropertyDescriptor(a,b);if(void 0===g){if(a=Object.getPrototypeOf(a),null!==a)return e(a,b,d)}else{if("value"in g)return g.value;b=g.get;return void 0===b?void 0:b.call(d)}},b=function(a){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var a=(b.__proto__||Object.getPrototypeOf(b)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");a=!a||"object"!==
-typeof a&&"function"!==typeof a?this:a;a.element=document.createElement("div");var d=a.element;d.className="neuroglancer-tooltip";d.style.visibility="hidden";document.body.appendChild(d);return a}q(b,a);n(b,[{key:"updatePosition",value:function(a,b){var d=this.element;d.style.left=a+"px";d.style.top=b+"px";d.style.visibility="inherit"}},{key:"disposed",value:function(){Object(p.b)(this.element);d(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}}]);return b}(h.a)},
-function(h,f){},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=
-b)}a.d(f,"a",function(){return e});h=a(169);a.n(h);h=a(349);a.n(h);h=a(190);a.n(h);h=a(350);a.n(h);h=a(351);a.n(h);h=a(352);a.n(h);h=a(170);a.n(h);h=a(353);a.n(h);h=a(48);var n=a.n(h);h=a(10);var d=a.n(h);h=a(47);var b=a(67),c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),e=function(a){function e(a){if(!(this instanceof
-e))throw new TypeError("Cannot call a class as a function");var b=q(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));b.viewer=a;b.parsedValue=null;b.debouncedValueUpdater=d()(function(){var a=b.textEditor.getValue();try{var c=JSON.parse(a);b.parsedValue=c;b.applyButton.disabled=!1;b.textEditor.setOption("lint",void 0)}catch(y){b.parsedValue=null;b.applyButton.disabled=!0;var d=0,e=0,g="Unknown parse error";y instanceof Error&&(c=y.message.match(/^((?:.|\n)*) in JSON at position ([0-9]+)$/),
-null!==c?(g=c[1],c=parseInt(c[2],10),a=a.substring(0,c).split("\n"),d=a.length-1,e=a[a.length-1].length):g=y.message);b.textEditor.setOption("lint",{getAnnotations:function(){return[{message:g,severity:"error",from:n.a.Pos(d,e)}]}})}},100);b.content.classList.add("neuroglancer-state-editor");a=b.applyButton=document.createElement("button");a.textContent="Apply changes";b.content.appendChild(a);a.addEventListener("click",function(){return b.applyChanges()});a.disabled=!0;b.textEditor=n()(function(a){},
-{value:"",mode:{name:"javascript",json:!0},foldGutter:!0,gutters:["CodeMirror-lint-markers","CodeMirror-foldgutter"]});b.updateView();b.textEditor.on("change",function(){b.debouncedValueUpdater()});b.content.appendChild(b.textEditor.getWrapperElement());b.textEditor.refresh();return b}p(e,a);c(e,[{key:"applyChanges",value:function(){null!==this.parsedValue&&(this.viewer.state.reset(),this.viewer.state.restoreState(this.parsedValue));this.applyButton.disabled=!0}},{key:"updateView",value:function(){this.textEditor.setValue(this.getJson());
-this.textEditor.execCommand("foldAll");this.textEditor.execCommand("unfold")}},{key:"getJson",value:function(){return JSON.stringify(Object(b.b)(this.viewer.state).value,null,"  ")}}]);return e}(h.a)},function(h,f,a){(function(a){a.defineMode("javascript",function(f,h){function d(a,b,c){ib=a;Va=c;return b}function b(a,b){var f=a.next();if('"'==f||"'"==f)return b.tokenize=c(f),b.tokenize(a,b);if("."==f&&a.match(/^\d+(?:[eE][+\-]?\d+)?/))return d("number","number");if("."==f&&a.match(".."))return d("spread",
-"meta");if(/[\[\]{}\(\),;\:\.]/.test(f))return d(f);if("="==f&&a.eat(">"))return d("=>","operator");if("0"==f&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),d("number","number");if("0"==f&&a.eat(/o/i))return a.eatWhile(/[0-7]/i),d("number","number");if("0"==f&&a.eat(/b/i))return a.eatWhile(/[01]/i),d("number","number");if(/\d/.test(f))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),d("number","number");if("/"==f){if(a.eat("*"))return b.tokenize=e,e(a,b);if(a.eat("/"))return a.skipToEnd(),d("comment",
-"comment");if(ac(a,b,1)){a:for(var k=b=!1;null!=(f=a.next());){if(!b){if("/"==f&&!k)break a;"["==f?k=!0:k&&"]"==f&&(k=!1)}b=!b&&"\\"==f}a.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);return d("regexp","string-2")}a.eat("=");return d("operator","operator",a.current())}if("`"==f)return b.tokenize=g,g(a,b);if("#"==f)return a.skipToEnd(),d("error","error");if(bc.test(f))return">"==f&&b.lexical&&">"==b.lexical.type||(a.eat("=")?"!"!=f&&"="!=f||a.eat("="):/[<>*+\-]/.test(f)&&(a.eat(f),">"==f&&a.eat(f))),d("operator",
-"operator",a.current());if(Oa.test(f)){a.eatWhile(Oa);f=a.current();if("."!=b.lastType){if(Ib.propertyIsEnumerable(f))return a=Ib[f],d(a.type,a.style,f);if("async"==f&&a.match(/^\s*[\(\w]/,!1))return d("async","keyword",f)}return d("variable","variable",f)}}function c(a){return function(c,e){var g=!1,f;if(bb&&"@"==c.peek()&&c.match(Sc))return e.tokenize=b,d("jsonld-keyword","meta");for(;null!=(f=c.next())&&(f!=a||g);)g=!g&&"\\"==f;g||(e.tokenize=b);return d("string","string")}}function e(a,c){for(var e=
-!1,g;g=a.next();){if("/"==g&&e){c.tokenize=b;break}e="*"==g}return d("comment","comment")}function g(a,c){for(var e=!1,g;null!=(g=a.next());){if(!e&&("`"==g||"$"==g&&a.eat("{"))){c.tokenize=b;break}e=!e&&"\\"==g}return d("quasi","string-2",a.current())}function l(a,b){b.fatArrowAt&&(b.fatArrowAt=null);var c=a.string.indexOf("=>",a.start);if(!(0>c)){if(ta){var d=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(a.string.slice(a.start,c));d&&(c=d.index)}d=0;var e=!1;for(--c;0<=c;--c){var g=a.string.charAt(c),
-f="([{}])".indexOf(g);if(0<=f&&3>f){if(!d){++c;break}if(0==--d){"("==g&&(e=!0);break}}else if(3<=f&&6>f)++d;else if(Oa.test(g))e=!0;else{if(/["'\/]/.test(g))return;if(e&&!d){++c;break}}}e&&!d&&(b.fatArrowAt=c)}}function k(a,b,c,d,e,g){this.indented=a;this.column=b;this.type=c;this.prev=e;this.info=g;null!=d&&(this.align=d)}function n(){for(var a=arguments.length-1;0<=a;a--)K.cc.push(arguments[a])}function m(){n.apply(null,arguments);return!0}function r(a){function b(b){for(;b;b=b.next)if(b.name==
-a)return!0;return!1}var c=K.state;K.marked="def";c.context?b(c.localVars)||(c.localVars={name:a,next:c.localVars}):!b(c.globalVars)&&h.globalVars&&(c.globalVars={name:a,next:c.globalVars})}function p(){K.state.context={prev:K.state.context,vars:K.state.localVars};K.state.localVars=dc}function q(){K.state.localVars=K.state.context.vars;K.state.context=K.state.context.prev}function w(a,b){var c=function(){var c=K.state,d=c.indented;if("stat"==c.lexical.type)d=c.lexical.indented;else for(var e=c.lexical;e&&
-")"==e.type&&e.align;e=e.prev)d=e.indented;c.lexical=new k(d,K.stream.column(),a,null,c.lexical,b)};c.lex=!0;return c}function y(){var a=K.state;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function x(a){function b(c){return c==a?m():";"==a?n():m(b)}return b}function A(a,b){return"var"==a?m(w("vardef",b.length),Eb,x(";"),y):"keyword a"==a?m(w("form"),E,A,y):"keyword b"==a?m(w("form"),A,y):"keyword d"==a?K.stream.match(/^\s*$/,!1)?m():m(w("stat"),
-C,x(";"),y):"debugger"==a?m(x(";")):"{"==a?m(w("}"),fa,y):";"==a?m():"if"==a?("else"==K.state.lexical.info&&K.state.cc[K.state.cc.length-1]==y&&K.state.cc.pop()(),m(w("form"),E,A,y,Ga)):"function"==a?m(xa):"for"==a?m(w("form"),Xb,A,y):"variable"==a?ta&&"type"==b?(K.marked="keyword",m(X,x("operator"),X,x(";"))):ta&&"declare"==b?(K.marked="keyword",m(A)):m(w("stat"),U):"switch"==a?m(w("form"),E,x("{"),w("}","switch"),fa,y,y):"case"==a?m(z,x(":")):"default"==a?m(x(":")):"catch"==a?m(w("form"),p,x("("),
-ab,x(")"),A,y,q):"class"==a?m(w("form"),Ua,y):"export"==a?m(w("stat"),ia,y):"import"==a?m(w("stat"),Da,y):"module"==a?m(w("form"),Aa,x("{"),w("}"),fa,y,y):"async"==a?m(A):"@"==b?m(z,A):n(w("stat"),z,x(";"),y)}function z(a){return G(a,!1)}function D(a){return G(a,!0)}function E(a){return"("!=a?n():m(w(")"),z,x(")"),y)}function G(a,b){if(K.state.fatArrowAt==K.stream.start){var c=b?M:O;if("("==a)return m(p,w(")"),ba(ab,")"),y,x("=>"),c,q);if("variable"==a)return n(p,Aa,x("=>"),c,q)}c=b?F:B;return cc.hasOwnProperty(a)?
-m(c):"function"==a?m(xa,c):"class"==a?m(w("form"),qd,y):"keyword c"==a||"async"==a?m(b?D:z):"("==a?m(w(")"),C,x(")"),y,c):"operator"==a||"spread"==a?m(b?D:z):"["==a?m(w("]"),pb,y,c):"{"==a?ka(H,"}",null,c):"quasi"==a?n(L,c):"new"==a?m(P(b)):m()}function C(a){return a.match(/[;\}\)\],]/)?n():n(z)}function B(a,b){return","==a?m(z):F(a,b,!1)}function F(a,b,c){var d=0==c?B:F,e=0==c?z:D;if("=>"==a)return m(p,c?M:O,q);if("operator"==a)return/\+\+|--/.test(b)||ta&&"!"==b?m(d):"?"==b?m(z,x(":"),e):m(e);if("quasi"==
-a)return n(L,d);if(";"!=a){if("("==a)return ka(D,")","call",d);if("."==a)return m(Z,d);if("["==a)return m(w("]"),C,x("]"),y,d);if(ta&&"as"==b)return K.marked="keyword",m(X,d);if("regexp"==a)return K.state.lastType=K.marked="operator",K.stream.backUp(K.stream.pos-K.stream.start-1),m(e)}}function L(a,b){return"quasi"!=a?n():"${"!=b.slice(b.length-2)?m(L):m(z,J)}function J(a){if("}"==a)return K.marked="string-2",K.state.tokenize=g,m(L)}function O(a){l(K.stream,K.state);return n("{"==a?A:z)}function M(a){l(K.stream,
-K.state);return n("{"==a?A:D)}function P(a){return function(b){return"."==b?m(a?S:N):"variable"==b&&ta?m(Wb,a?F:B):n(a?D:z)}}function N(a,b){if("target"==b)return K.marked="keyword",m(B)}function S(a,b){if("target"==b)return K.marked="keyword",m(F)}function U(a){return":"==a?m(y,A):n(B,x(";"),y)}function Z(a){if("variable"==a)return K.marked="property",m()}function H(a,b){if("async"==a)return K.marked="property",m(H);if("variable"==a||"keyword"==K.style){K.marked="property";if("get"==b||"set"==b)return m(Q);
-var c;ta&&K.state.fatArrowAt==K.stream.start&&(c=K.stream.match(/^\s*:\s*/,!1))&&(K.state.fatArrowAt=K.stream.pos+c[0].length);return m(aa)}if("number"==a||"string"==a)return K.marked=bb?"property":K.style+" property",m(aa);if("jsonld-keyword"==a)return m(aa);if("modifier"==a)return m(H);if("["==a)return m(z,x("]"),aa);if("spread"==a)return m(D,aa);if("*"==b)return K.marked="keyword",m(H);if(":"==a)return n(aa)}function Q(a){if("variable"!=a)return n(aa);K.marked="property";return m(xa)}function aa(a){if(":"==
-a)return m(D);if("("==a)return n(xa)}function ba(a,b,c){function d(e,g){return(c?-1<c.indexOf(e):","==e)?(e=K.state.lexical,"call"==e.info&&(e.pos=(e.pos||0)+1),m(function(c,d){return c==b||d==b?n():n(a)},d)):e==b||g==b?m():m(x(b))}return function(c,e){return c==b||e==b?m():n(a,d)}}function ka(a,b,c){for(var d=3;d<arguments.length;d++)K.cc.push(arguments[d]);return m(w(b,c),ba(a,b),y)}function fa(a){return"}"==a?m():n(A,fa)}function R(a,b){if(ta){if(":"==a)return m(X);if("?"==b)return m(R)}}function X(a,
-b){if("variable"==a||"void"==b){if("keyof"==b)return K.marked="keyword",m(X);K.marked="type";return m(Ta)}if("string"==a||"number"==a||"atom"==a)return m(Ta);if("["==a)return m(w("]"),ba(X,"]",","),y,Ta);if("{"==a)return m(w("}"),ba(Ba,"}",",;"),y,Ta);if("("==a)return m(ba(Za,")"),Ka)}function Ka(a){if("=>"==a)return m(X)}function Ba(a,b){if("variable"==a||"keyword"==K.style)return K.marked="property",m(Ba);if("?"==b)return m(Ba);if(":"==a)return m(X);if("["==a)return m(z,R,x("]"),Ba)}function Za(a){if("variable"==
-a)return m(Za);if(":"==a)return m(X)}function Ta(a,b){if("<"==b)return m(w(">"),ba(X,">"),y,Ta);if("|"==b||"."==a)return m(X);if("["==a)return m(x("]"),Ta);if("extends"==b)return m(X)}function Wb(a,b){if("<"==b)return m(w(">"),ba(X,">"),y,Ta)}function Eb(){return n(Aa,R,wa,Fb)}function Aa(a,b){if("modifier"==a)return m(Aa);if("variable"==a)return r(b),m();if("spread"==a)return m(Aa);if("["==a)return ka(Aa,"]");if("{"==a)return ka(Mc,"}")}function Mc(a,b){if("variable"==a&&!K.stream.match(/^\s*:/,
-!1))return r(b),m(wa);"variable"==a&&(K.marked="property");return"spread"==a?m(Aa):"}"==a?n():m(x(":"),Aa,wa)}function wa(a,b){if("="==b)return m(D)}function Fb(a){if(","==a)return m(Eb)}function Ga(a,b){if("keyword b"==a&&"else"==b)return m(w("form","else"),A,y)}function Xb(a){if("("==a)return m(w(")"),Nc,x(")"),y)}function Nc(a){return"var"==a?m(Eb,x(";"),gb):";"==a?m(gb):"variable"==a?m($a):n(z,x(";"),gb)}function $a(a,b){return"in"==b||"of"==b?(K.marked="keyword",m(z)):m(B,gb)}function gb(a,b){return";"==
-a?m(Ha):"in"==b||"of"==b?(K.marked="keyword",m(z)):n(z,x(";"),Ha)}function Ha(a){")"!=a&&m(z)}function xa(a,b){if("*"==b)return K.marked="keyword",m(xa);if("variable"==a)return r(b),m(xa);if("("==a)return m(p,w(")"),ba(ab,")"),y,R,A,q);if(ta&&"<"==b)return m(w(">"),ba(X,">"),y,xa)}function ab(a,b){"@"==b&&m(z,ab);return"spread"==a||"modifier"==a?m(ab):n(Aa,R,wa)}function qd(a,b){return"variable"==a?Ua(a,b):Ca(a,b)}function Ua(a,b){if("variable"==a)return r(b),m(Ca)}function Ca(a,b){if("<"==b)return m(w(">"),
-ba(X,">"),y,Ca);if("extends"==b||"implements"==b||ta&&","==a)return m(ta?X:z,Ca);if("{"==a)return m(w("}"),ha,y)}function ha(a,b){if("modifier"==a||"async"==a||"variable"==a&&("static"==b||"get"==b||"set"==b)&&K.stream.match(/^\s+[\w$\xa1-\uffff]/,!1))return K.marked="keyword",m(ha);if("variable"==a||"keyword"==K.style)return K.marked="property",m(ta?da:xa,ha);if("["==a)return m(z,x("]"),ta?da:xa,ha);if("*"==b)return K.marked="keyword",m(ha);if(";"==a)return m(ha);if("}"==a)return m();if("@"==b)return m(z,
-ha)}function da(a,b){return"?"==b?m(da):":"==a?m(X,wa):"="==b?m(D):n(xa)}function ia(a,b){return"*"==b?(K.marked="keyword",m(ob,x(";"))):"default"==b?(K.marked="keyword",m(z,x(";"))):"{"==a?m(ba($b,"}"),ob,x(";")):n(A)}function $b(a,b){if("as"==b)return K.marked="keyword",m(x("variable"));if("variable"==a)return n(D,$b)}function Da(a){return"string"==a?m():n(La,na,ob)}function La(a,b){if("{"==a)return ka(La,"}");"variable"==a&&r(b);"*"==b&&(K.marked="keyword");return m(Qc)}function na(a){if(","==
-a)return m(La,na)}function Qc(a,b){if("as"==b)return K.marked="keyword",m(La)}function ob(a,b){if("from"==b)return K.marked="keyword",m(z)}function pb(a){return"]"==a?m():n(ba(D,"]"))}function ac(a,c,d){return c.tokenize==b&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(c.lastType)||"quasi"==c.lastType&&/\{\s*$/.test(a.string.slice(0,a.pos-(d||0)))}var hb=f.indentUnit,Rc=h.statementIndent,bb=h.jsonld,Na=h.json||bb,ta=h.typescript,Oa=h.wordCharacters||/[\w$\xa1-\uffff]/,
-Ib=function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("keyword d"),g=a("operator"),f={type:"atom",style:"atom"};b={"if":a("if"),"while":b,"with":b,"else":c,"do":c,"try":c,"finally":c,"return":e,"break":e,"continue":e,"new":a("new"),"delete":d,"void":d,"throw":d,"debugger":a("debugger"),"var":a("var"),"const":a("var"),let:a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),
-"in":g,"typeof":g,"instanceof":g,"true":f,"false":f,"null":f,undefined:f,NaN:f,Infinity:f,"this":a("this"),"class":a("class"),"super":a("atom"),yield:d,"export":a("export"),"import":a("import"),"extends":d,await:d};if(ta){c={type:"variable",style:"type"};d={"interface":a("class"),"implements":d,namespace:d,module:a("module"),"enum":a("module"),"public":a("modifier"),"private":a("modifier"),"protected":a("modifier"),"abstract":a("modifier"),readonly:a("modifier"),string:c,number:c,"boolean":c,any:c};
-for(var k in d)b[k]=d[k]}return b}(),bc=/[+\-*&%=<>!?|~^@]/,Sc=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,ib,Va,cc={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},K={state:null,column:null,marked:null,cc:null},dc={name:"this",next:{name:"arguments"}};y.lex=!0;return{startState:function(a){a={tokenize:b,lastType:"sof",cc:[],lexical:new k((a||0)-hb,0,"block",!1),localVars:h.localVars,context:h.localVars&&{vars:h.localVars},
-indented:a||0};h.globalVars&&"object"==typeof h.globalVars&&(a.globalVars=h.globalVars);return a},token:function(a,b){a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation(),l(a,b));if(b.tokenize!=e&&a.eatSpace())return null;var c=b.tokenize(a,b);if("comment"==ib)return c;b.lastType="operator"!=ib||"++"!=Va&&"--"!=Va?ib:"incdec";a:{var d=ib,g=Va,f=b.cc;K.state=b;K.stream=a;K.marked=null;K.cc=f;K.style=c;b.lexical.hasOwnProperty("align")||(b.lexical.align=!0);for(;;)if((f.length?
-f.pop():Na?z:A)(d,g)){for(;f.length&&f[f.length-1].lex;)f.pop()();if(K.marked){c=K.marked;break a}if(a="variable"==d)b:{for(a=b.localVars;a;a=a.next)if(a.name==g){a=!0;break b}for(b=b.context;b;b=b.prev)for(a=b.vars;a;a=a.next)if(a.name==g){a=!0;break b}a=void 0}if(a){c="variable-2";break a}break a}}return c},indent:function(c,d){if(c.tokenize==e)return a.Pass;if(c.tokenize!=b)return 0;var g=d&&d.charAt(0),f=c.lexical,k;if(!/^\s*else\b/.test(d))for(var l=c.cc.length-1;0<=l;--l){var m=c.cc[l];if(m==
-y)f=f.prev;else if(m!=Ga)break}for(;!("stat"!=f.type&&"form"!=f.type||"}"!=g&&(!(k=c.cc[c.cc.length-1])||k!=B&&k!=F||/^[,\.=+\-*:?[\(]/.test(d)));)f=f.prev;Rc&&")"==f.type&&"stat"==f.prev.type&&(f=f.prev);k=f.type;l=g==k;return"vardef"==k?f.indented+("operator"==c.lastType||","==c.lastType?f.info+1:0):"form"==k&&"{"==g?f.indented:"form"==k?f.indented+hb:"stat"==k?(g=f.indented,c="operator"==c.lastType||","==c.lastType||bc.test(d.charAt(0))||/[,.]/.test(d.charAt(0)),g+(c?Rc||hb:0)):"switch"!=f.info||
-l||0==h.doubleIndentSwitch?f.align?f.column+(l?0:1):f.indented+(l?0:hb):f.indented+(/^(?:case|default)\b/.test(d)?hb:2*hb)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Na?null:"/*",blockCommentEnd:Na?null:"*/",blockCommentContinue:Na?null:" * ",lineComment:Na?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Na?"json":"javascript",jsonldMode:bb,jsonMode:Na,expressionAllowed:ac,skipExpression:function(a){var b=a.cc[a.cc.length-1];b!=z&&b!=D||a.cc.pop()}}});a.registerHelper("wordChars",
-"javascript",/[\w$]/);a.defineMIME("text/javascript","javascript");a.defineMIME("text/ecmascript","javascript");a.defineMIME("application/javascript","javascript");a.defineMIME("application/x-javascript","javascript");a.defineMIME("application/ecmascript","javascript");a.defineMIME("application/json",{name:"javascript",json:!0});a.defineMIME("application/x-json",{name:"javascript",json:!0});a.defineMIME("application/ld+json",{name:"javascript",jsonld:!0});a.defineMIME("text/typescript",{name:"javascript",
-typescript:!0});a.defineMIME("application/typescript",{name:"javascript",typescript:!0})})(a(48))},function(h,f,a){(function(a){function f(a){this.options=a;this.from=this.to=0}function h(a,b){a=a.findMarks(t(b,0),t(b+1,0));for(var c=0;c<a.length;++c)if(a[c].__isFold&&a[c].find().from.line==b)return a[c]}function d(a){if("string"==typeof a){var b=document.createElement("div");b.className=a+" CodeMirror-guttermarker-subtle";return b}return a.cloneNode(!0)}function b(a,b,c){var e=a.state.foldGutter.options,
-g=b,f=a.foldOption(e,"minFoldSize"),k=a.foldOption(e,"rangeFinder");a.eachLine(b,c,function(b){var c=null;if(h(a,g))c=d(e.indicatorFolded);else{var l=t(g,0);(l=k&&k(a,l))&&l.to.line-l.from.line>=f&&(c=d(e.indicatorOpen))}a.setGutterMarker(b,e.gutter,c);++g})}function c(a){var c=a.getViewport(),d=a.state.foldGutter;d&&(a.operation(function(){b(a,c.from,c.to)}),d.from=c.from,d.to=c.to)}function e(a,b,c){var d=a.state.foldGutter;d&&(d=d.options,c==d.gutter&&((c=h(a,b))?c.clear():a.foldCode(t(b,0),d.rangeFinder)))}
-function g(a){var b=a.state.foldGutter;if(b){var d=b.options;b.from=b.to=0;clearTimeout(b.changeUpdate);b.changeUpdate=setTimeout(function(){c(a)},d.foldOnChangeTimeSpan||600)}}function l(a){var d=a.state.foldGutter;if(d){var e=d.options;clearTimeout(d.changeUpdate);d.changeUpdate=setTimeout(function(){var e=a.getViewport();d.from==d.to||20<e.from-d.to||20<d.from-e.to?c(a):a.operation(function(){e.from<d.from&&(b(a,e.from,d.from),d.from=e.from);e.to>d.to&&(b(a,d.to,e.to),d.to=e.to)})},e.updateViewportTimeSpan||
-400)}}function k(a,c){var d=a.state.foldGutter;d&&(c=c.line,c>=d.from&&c<d.to&&b(a,c,c+1))}a.defineOption("foldGutter",!1,function(b,d,h){h&&h!=a.Init&&(b.clearGutter(b.state.foldGutter.options.gutter),b.state.foldGutter=null,b.off("gutterClick",e),b.off("change",g),b.off("viewportChange",l),b.off("fold",k),b.off("unfold",k),b.off("swapDoc",g));d&&(h=b.state,!0===d&&(d={}),null==d.gutter&&(d.gutter="CodeMirror-foldgutter"),null==d.indicatorOpen&&(d.indicatorOpen="CodeMirror-foldgutter-open"),null==
-d.indicatorFolded&&(d.indicatorFolded="CodeMirror-foldgutter-folded"),h.foldGutter=new f(d),c(b),b.on("gutterClick",e),b.on("change",g),b.on("viewportChange",l),b.on("fold",k),b.on("unfold",k),b.on("swapDoc",g))});var t=a.Pos})(a(48),a(190))},function(h,f,a){(function(a){a.registerHelper("fold","brace",function(f,h){function d(d){for(var g=h.ch,k=0;;)if(g=0>=g?-1:c.lastIndexOf(d,g-1),-1==g){if(1==k)break;k=1;g=c.length}else{if(1==k&&g<h.ch)break;e=f.getTokenTypeAt(a.Pos(b,g+1));if(!/^(comment|string)/.test(e))return g+
-1;--g}}var b=h.line,c=f.getLine(b),e,g="{",l="}",k=d("{");null==k&&(g="[",l="]",k=d("["));if(null!=k){var n=1,m=f.lastLine(),r=b;a:for(;r<=m;++r)for(var p=f.getLine(r),q=r==b?k:0;;){var w=p.indexOf(g,q);q=p.indexOf(l,q);0>w&&(w=p.length);0>q&&(q=p.length);q=Math.min(w,q);if(q==p.length)break;if(f.getTokenTypeAt(a.Pos(r,q+1))==e)if(q==w)++n;else if(!--n){var y=r;var x=q;break a}++q}if(null!=y&&(b!=y||x!=k))return{from:a.Pos(b,k),to:a.Pos(y,x)}}});a.registerHelper("fold","import",function(f,h){function d(b){if(b<
-f.firstLine()||b>f.lastLine())return null;var c=f.getTokenAt(a.Pos(b,1));/\S/.test(c.string)||(c=f.getTokenAt(a.Pos(b,c.end+1)));if("keyword"!=c.type||"import"!=c.string)return null;var d=b;for(b=Math.min(f.lastLine(),b+10);d<=b;++d){var e=f.getLine(d).indexOf(";");if(-1!=e)return{startCh:c.end,end:a.Pos(d,e)}}}h=h.line;var b=d(h),c;if(!b||d(h-1)||(c=d(h-2))&&c.end.line==h-1)return null;for(c=b.end;;){var e=d(c.line+1);if(null==e)break;c=e.end}return{from:f.clipPos(a.Pos(h,b.startCh+1)),to:c}});a.registerHelper("fold",
-"include",function(f,h){function d(b){if(b<f.firstLine()||b>f.lastLine())return null;var c=f.getTokenAt(a.Pos(b,1));/\S/.test(c.string)||(c=f.getTokenAt(a.Pos(b,c.end+1)));if("meta"==c.type&&"#include"==c.string.slice(0,8))return c.start+8}h=h.line;var b=d(h);if(null==b||null!=d(h-1))return null;for(var c=h;null!=d(c+1);)++c;return{from:a.Pos(h,b+1),to:f.clipPos(a.Pos(c))}})})(a(48))},function(h,f){},function(h,f){},function(h,f,a){function q(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function p(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}a.d(f,"a",function(){return d});h=a(355);a.n(h);a=a(1);var n=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=
-d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,d,g){d&&a(b.prototype,d);g&&a(b,g);return b}}(),d=function(a){function b(a){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var c=q(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.selectedLayer=a;c.element=document.createElement("div");c.element.className="neuroglancer-annotation-tool-status-widget";c.registerDisposer(a.changed.add(function(){return c.selectedLayerChanged()}));
-c.selectedLayerChanged();return c}p(b,a);n(b,[{key:"selectedLayerChanged",value:function(){var a=this,b=this.unbindPreviousLayer;void 0!==b&&b();b=this.selectedLayer.layer;void 0!==b&&(this.unbindPreviousLayer=b.specificationChanged.add(function(){a.updateView()}));this.updateView()}},{key:"disposed",value:function(){var a=this.unbindPreviousLayer;void 0!==a&&a();this.unbindPreviousLayer=void 0}},{key:"getDescriptionText",value:function(){var a=this.selectedLayer.layer;if(void 0!==a&&(a=a.layer,null!==
-a&&(a=a.tool.value,void 0!==a)))return a.description}},{key:"updateView",value:function(){this.element.textContent=this.getDescriptionText()||""}}]);return b}(a.a)},function(h,f){},function(h,f,a){function q(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);
-a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}a.d(f,"a",function(){return e});var n=a(9);h=a(1);var d=a(8),b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),c=function l(a,b,c){null===
-a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return l(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},e=function(a){function e(a,b){b=void 0===b?{}:b;if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var c=q(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));c.model=a;c.element=document.createElement("label");c.inputElement=document.createElement("input");
-var d=b;b=d.validator;d=d.label;var f=c.element,k=c.inputElement;void 0===b&&(b=a instanceof n.c?a.validator:function(a){return a});c.validator=b;void 0!==d&&(f.textContent=d);f.appendChild(k);f.className="neuroglancer-number-input";k.type="input";c.registerDisposer(c.model.changed.add(function(){return c.updateView()}));c.registerEventListener(k,"change",function(){return c.updateModel()});c.updateView();return c}p(e,a);b(e,[{key:"updateView",value:function(){this.inputElement.value=""+this.model.value}},
-{key:"updateModel",value:function(){var a=parseFloat(this.inputElement.value.trim());if(Number.isNaN(a))this.updateView();else try{a=this.validator(a),this.model.value=a}catch(m){this.updateView()}}},{key:"disposed",value:function(){Object(d.b)(this.element);c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}}]);return e}(h.a)},function(h,f){},function(h,f,a){f.a=function(){return Object(q.c)(document,"contextmenu",function(a){a.preventDefault()})};f.b=function(){return Object(q.c)(document,
-"wheel",function(a){a.ctrlKey&&a.preventDefault()})};var q=a(1)},function(h,f,a){function q(){var a=g.SingleMeshUserLayer.prototype.addRenderLayer;g.SingleMeshUserLayer.prototype.addRenderLayer=function(b){b instanceof l.c&&Object(r.a)(b);a.call(this,b)}}function p(){var a=c.ImageUserLayer.prototype.transformPickedValue;c.ImageUserLayer.prototype.transformPickedValue=function(b){b=a.call(this,b);null===b&&(b=void 0);return b}}function n(){var a=e.SegmentationUserLayer.prototype.addRenderLayer;e.SegmentationUserLayer.prototype.addRenderLayer=
-function(b){b instanceof k.a&&(b.segmentColorShaderManager=new u.b("segmentColorHash"));a.call(this,b)}}function d(){e.SegmentationUserLayer.prototype.addMesh=function(a){this.meshLayer=new m.a(this.manager.chunkManager,a,this.displayState);this.addRenderLayer(this.meshLayer)}}f.a=function(a){a=a.globals||{};v||(a.useNehubaLayout&&(b.c.clear(),b.c.set("4panel",{factory:function(a,b,c,d){return new t.a(a,b,c,d)}}),b.c.set("xy",{factory:function(a,b,c,d){return new t.a(a,b,c,d)}})),a.hideNullImageValues&&
-p(),a.useCustomSegmentColors&&n(),a.useNehubaMeshLayer&&d(),a.useNehubaSingleMeshLayer&&q(),v=!0)};var b=a(83),c=a(107),e=a(65),g=a(176),l=a(116),k=a(175),t=a(121),m=a(123),r=a(362),u=a(122),v=!1},function(h,f,a){function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function n(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)}a.d(f,"a",function(){return l});a.d(f,"b",function(){return k});h=a(1);var d=a(2),b=a(23),c=a(25),e=a(52),g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=
-!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),l=function(a){function f(a,b,g){q(this,f);var k=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));k.gl=a;k.copyVertexPositionsBuffer=Object(e.a)(k.gl);k.textureCoordinateAdjustment=new Float32Array(4);k.discardColor=d.u.fromValues(.5,.5,.5,1);var h=new c.a(a);h.addVarying("vec2","vTexCoord");h.addUniform("sampler2D","uSampler");h.addInitializer(function(b){a.uniform1i(b.uniform("uSampler"),
-0)});h.addUniform("vec4","uColorFactor");h.addUniform("vec4","uBackgroundColor");h.addUniform("mat4","uProjectionMatrix");h.addUniform("vec4","uTextureCoordinateAdjustment");h.addUniform("vec4","uDiscardColor");h.require(b);h.setFragmentMain("none"===g?"\nvec4 sampledColor = texture(uSampler, vTexCoord);\nif (sampledColor.a == 0.0) {\n  sampledColor = uBackgroundColor;\n}\nemit(sampledColor * uColorFactor, vec4(0,0,0,0));\n":"\nvec4 sampledColor = texture(uSampler, vTexCoord);\nif (sampledColor.a == 0.0) {\n  sampledColor = uBackgroundColor;\n}\nif (sampledColor.r "+
-g+" uDiscardColor.r && sampledColor.g "+g+" uDiscardColor.g && sampledColor.b "+g+" uDiscardColor.b) discard;\nelse emit(sampledColor * uColorFactor, vec4(0,0,0,0));\n");h.addAttribute("vec4","aVertexPosition");h.setVertexMain("\nvTexCoord = uTextureCoordinateAdjustment.xy + 0.5 * (aVertexPosition.xy + 1.0) * uTextureCoordinateAdjustment.zw;\ngl_Position = uProjectionMatrix * aVertexPosition;\n");k.shader=k.registerDisposer(h.build());return k}n(f,a);g(f,[{key:"draw",value:function(a,b,c,d,e,g,f,
-k){var h=this.gl,l=this.shader,m=this.textureCoordinateAdjustment;m[0]=e;m[1]=g;m[2]=f-e;m[3]=k-g;l.bind();h.activeTexture(h.TEXTURE0);h.bindTexture(h.TEXTURE_2D,a);h.uniformMatrix4fv(l.uniform("uProjectionMatrix"),!1,b);h.uniform4fv(l.uniform("uColorFactor"),c);h.uniform4fv(l.uniform("uBackgroundColor"),d);h.uniform4fv(l.uniform("uTextureCoordinateAdjustment"),m);h.uniform4fv(l.uniform("uDiscardColor"),this.discardColor);a=l.attribute("aVertexPosition");this.copyVertexPositionsBuffer.bindToVertexAttrib(a,
-2);h.drawArrays(h.TRIANGLE_FAN,0,4);h.disableVertexAttribArray(a);h.bindTexture(h.TEXTURE_2D,null)}},{key:"setDiscardColor",value:function(a){this.discardColor=a}}],[{key:"get",value:function(a,c,d){return a.memoize.get("nehuba/NehubaSliceViewRenderHelper:"+Object(b.a)(c)+":"+d,function(){return new f(a,c,d)})}}]);return f}(h.a),k=function(a){function d(a,b){q(this,d);var g=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));g.gl=a;g.copyVertexPositionsBuffer=Object(e.a)(g.gl);a=new c.a(a);
-a.addUniform("mat4","uProjectionMatrix");a.addUniform("vec4","uColor");a.require(b);a.setFragmentMain("\nemit(uColor, vec4(0.0));\n");a.addAttribute("vec4","aVertexPosition");a.setVertexMain("\ngl_Position = uProjectionMatrix * aVertexPosition;\n");g.shader=g.registerDisposer(a.build());return g}n(d,a);g(d,[{key:"draw",value:function(a,b,c){var d=this.gl,e=this.shader;e.bind();d.uniformMatrix4fv(e.uniform("uProjectionMatrix"),!1,a);d.uniform4fv(e.uniform("uColor"),b);a=e.attribute("aVertexPosition");
-this.copyVertexPositionsBuffer.bindToVertexAttrib(a,2);c&&(d.enable(d.POLYGON_OFFSET_FILL),d.polygonOffset(c.factor,c.units));d.depthMask(!1);d.enable(d.BLEND);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.drawArrays(d.TRIANGLE_FAN,0,4);d.disable(d.BLEND);d.depthMask(!0);d.polygonOffset(0,0);d.disable(d.POLYGON_OFFSET_FILL);d.disableVertexAttribArray(a)}}],[{key:"get",value:function(a,c){return a.memoize.get("nehuba/TransparentPlaneRenderHelper:"+Object(b.a)(c),function(){return new d(a,c)})}}]);
-return d}(h.a)},function(h,f){},function(h,f,a){function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}f.a=function(a){a.makeShaderManager=function(a){a=void 0===a?this.displayState.fragmentMain.value:a;return new e(this.displayState.attributeNames.value,
-this.source.info.vertexAttributes,a)};a.draw=function(a){if(a.emitColor||!a.alreadyEmittedPickID){var b=this.source.chunks.get(n.b);if(void 0!==b&&b.state===p.d.GPU_MEMORY){var c=this.getShader(a.emitter);if(null!==c){var e=this.gl,g=this.shaderManager;c.bind();g.beginLayer(e,c,a);a.extra||console.error("Bad configuration. Nehuba mesh layer is used by neuroglancer code.");var f=Object(d.c)(a.extra);g.setNavState(e,c,f.navState);g.setOctant(e,c,f.octant);g.setBackFaceColor(e,c,f.backFaceColor);f=a.pickIDs;
-g.beginObject(e,c,this.displayState.objectToDataTransform.transform);a.emitPickID&&g.setPickID(e,c,f.register(this,b.numIndices/3));g.drawFragment(e,c,b,this.countingBuffer);g.endLayer(e,c);a.extra.meshRendered=!0}}}}};var p=a(30),n=a(177);h=a(116);var d=a(123),b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),
-c=function l(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return l(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},e=function(a){function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var a=(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-return!a||"object"!==typeof a&&"function"!==typeof a?this:a}q(d,a);b(d,[{key:"defineShader",value:function(a){c(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"defineShader",this).call(this,a);a.addVarying("highp vec4","vNavPos");a.addUniform("highp mat4","uNavState");a.addUniform("highp vec4","uOctant");a.addUniform("highp vec4","uBackFaceColor");a.addVertexMain("\nvec4 position = uModelMatrix * vec4(vertexPosition, 1.0);\nvNavPos = uNavState * position * uOctant;\n");a.addFragmentCode(this.fragmentMain.replace("void main()",
-"void userMain()"));a.setFragmentMain("\nif (vNavPos.x > 0.0 && vNavPos.y > 0.0 && vNavPos.z > 0.0) {\n  discard;\n} else {\n  if (gl_FrontFacing) userMain();\n  else emit(uBackFaceColor, uPickID);\n}\n")}},{key:"setNavState",value:function(a,b,c){a.uniformMatrix4fv(b.uniform("uNavState"),!1,c)}},{key:"setOctant",value:function(a,b,c){a.uniform4fv(b.uniform("uOctant"),c)}},{key:"setBackFaceColor",value:function(a,b,c){a.uniform4fv(b.uniform("uBackFaceColor"),c)}}]);return d}(h.d)},function(h,f,a){f.a=
-function(a,d,b){var c=Object.assign({prefire:!0,share:!0},b),e=a instanceof q.a?a:a.s,g=a instanceof q.a?a:a.r;a=p.Observable.create(function(a){c.prefire&&a.next(d(e));var b=e.changed.add(function(){a.next(d(e))}),f=g.registerDisposer(function(){return a.complete()});return function(){b();g.unregisterDisposer(f)}});return c.share?c.prefire?a.publishReplay(1).refCount():a.share():a};var q=a(1),p=a(194);a.n(p)},function(h,f,a){h=a(12);f.Subject=h.Subject;f.AnonymousSubject=h.AnonymousSubject;h=a(0);
-f.Observable=h.Observable;a(366);a(369);a(372);a(375);a(377);a(380);a(382);a(385);a(389);a(392);a(395);a(397);a(400);a(403);a(408);a(410);a(412);a(415);a(417);a(419);a(422);a(425);a(428);a(431);a(434);a(436);a(438);a(444);a(446);a(448);a(450);a(452);a(454);a(456);a(458);a(459);a(460);a(462);a(464);a(466);a(468);a(470);a(472);a(474);a(476);a(478);a(480);a(483);a(484);a(486);a(488);a(490);a(492);a(494);a(496);a(497);a(499);a(500);a(502);a(504);a(509);a(511);a(513);a(515);a(517);a(519);a(521);a(523);
-a(524);a(526);a(528);a(530);a(531);a(532);a(533);a(534);a(536);a(538);a(539);a(540);a(541);a(543);a(546);a(548);a(550);a(552);a(554);a(556);a(557);a(558);a(560);a(562);a(564);a(566);a(568);a(570);a(572);a(574);a(576);a(578);a(580);a(582);a(584);a(586);a(588);a(590);a(598);a(600);a(602);a(604);a(606);a(608);a(610);a(612);a(613);a(615);a(616);a(618);a(620);a(621);a(623);a(625);a(627);a(629);a(631);a(633);a(635);a(637);a(638);h=a(11);f.Subscription=h.Subscription;h=a(3);f.Subscriber=h.Subscriber;h=a(89);
-f.AsyncSubject=h.AsyncSubject;h=a(93);f.ReplaySubject=h.ReplaySubject;h=a(215);f.BehaviorSubject=h.BehaviorSubject;h=a(214);f.ConnectableObservable=h.ConnectableObservable;h=a(69);f.Notification=h.Notification;h=a(94);f.EmptyError=h.EmptyError;h=a(72);f.ArgumentOutOfRangeError=h.ArgumentOutOfRangeError;h=a(88);f.ObjectUnsubscribedError=h.ObjectUnsubscribedError;h=a(220);f.TimeoutError=h.TimeoutError;h=a(196);f.UnsubscriptionError=h.UnsubscriptionError;h=a(219);f.TimeInterval=h.TimeInterval;h=a(221);
-f.Timestamp=h.Timestamp;h=a(640);f.TestScheduler=h.TestScheduler;h=a(225);f.VirtualTimeScheduler=h.VirtualTimeScheduler;h=a(207);f.AjaxResponse=h.AjaxResponse;f.AjaxError=h.AjaxError;f.AjaxTimeoutError=h.AjaxTimeoutError;h=a(216);var q=a(19),p=a(208),n=a(643),d=a(86),b=a(68);a=a(87);f.Scheduler={asap:h.asap,queue:p.queue,animationFrame:n.animationFrame,async:q.async};f.Symbol={rxSubscriber:d.rxSubscriber,observable:a.observable,iterator:b.iterator}},function(h,f,a){var q=a(3),p=a(86),n=a(197);f.toSubscriber=
-function(a,b,c){if(a){if(a instanceof q.Subscriber)return a;if(a[p.rxSubscriber])return a[p.rxSubscriber]()}return a||b||c?new q.Subscriber(a,b,c):new q.Subscriber(n.empty)}},function(h,f,a){h=a(0);a=a(367);h.Observable.bindCallback=a.bindCallback},function(h,f,a){h=a(368);f.bindCallback=h.BoundCallbackObservable.create},function(h,f,a){function q(a){var b=a.subject;b.next(a.value);b.complete()}function p(a){a.subject.error(a.err)}var n=this&&this.__extends||function(a,b){function c(){this.constructor=
-a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(0);var d=a(17),b=a(13),c=a(89);a=function(a){function e(b,c,d,e,g){a.call(this);this.callbackFunc=b;this.selector=c;this.args=d;this.context=e;this.scheduler=g}n(e,a);e.create=function(a,b,c){void 0===b&&(b=void 0);return function(){for(var d=[],g=0;g<arguments.length;g++)d[g-0]=arguments[g];return new e(a,b,d,this,c)}};e.prototype._subscribe=function(a){var g=this.callbackFunc,
-f=this.args,h=this.scheduler,l=this.subject;if(h)return h.schedule(e.dispatch,0,{source:this,subscriber:a,context:this.context});l||(l=this.subject=new c.AsyncSubject,h=function v(){for(var a=[],c=0;c<arguments.length;c++)a[c-0]=arguments[c];var e=v.source;c=e.selector;e=e.subject;c?(a=d.tryCatch(c).apply(this,a),a===b.errorObject?e.error(b.errorObject.e):(e.next(a),e.complete())):(e.next(1>=a.length?a[0]:a),e.complete())},h.source=this,d.tryCatch(g).apply(this.context,f.concat(h))===b.errorObject&&
-l.error(b.errorObject.e));return l.subscribe(a)};e.dispatch=function(a){var e=this,g=a.source,f=a.subscriber;a=a.context;var h=g.callbackFunc,l=g.args,n=g.scheduler,w=g.subject;if(!w){w=g.subject=new c.AsyncSubject;var y=function A(){for(var a=[],c=0;c<arguments.length;c++)a[c-0]=arguments[c];var g=A.source;c=g.selector;g=g.subject;c?(a=d.tryCatch(c).apply(this,a),a===b.errorObject?e.add(n.schedule(p,0,{err:b.errorObject.e,subject:g})):e.add(n.schedule(q,0,{value:a,subject:g}))):e.add(n.schedule(q,
-0,{value:1>=a.length?a[0]:a,subject:g}))};y.source=g;d.tryCatch(h).apply(a,l.concat(y))===b.errorObject&&w.error(b.errorObject.e)}e.add(w.subscribe(f))};return e}(h.Observable);f.BoundCallbackObservable=a},function(h,f,a){h=a(0);a=a(370);h.Observable.bindNodeCallback=a.bindNodeCallback},function(h,f,a){h=a(371);f.bindNodeCallback=h.BoundNodeCallbackObservable.create},function(h,f,a){function q(a){var d=this,g=a.source,f=a.subscriber;a=a.context;var h=g.callbackFunc,r=g.args,q=g.scheduler,v=g.subject;
-if(!v){v=g.subject=new e.AsyncSubject;var w=function x(){for(var a=[],e=0;e<arguments.length;e++)a[e-0]=arguments[e];var g=x.source;e=g.selector;g=g.subject;var f=a.shift();f?d.add(q.schedule(n,0,{err:f,subject:g})):e?(a=b.tryCatch(e).apply(this,a),a===c.errorObject?d.add(q.schedule(n,0,{err:c.errorObject.e,subject:g})):d.add(q.schedule(p,0,{value:a,subject:g}))):d.add(q.schedule(p,0,{value:1>=a.length?a[0]:a,subject:g}))};w.source=g;b.tryCatch(h).apply(a,r.concat(w))===c.errorObject&&d.add(q.schedule(n,
-0,{err:c.errorObject.e,subject:v}))}d.add(v.subscribe(f))}function p(a){var b=a.subject;b.next(a.value);b.complete()}function n(a){a.subject.error(a.err)}var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(0);var b=a(17),c=a(13),e=a(89);a=function(a){function g(b,c,d,e,g){a.call(this);this.callbackFunc=b;this.selector=c;this.args=d;this.context=e;this.scheduler=
-g}d(g,a);g.create=function(a,b,c){void 0===b&&(b=void 0);return function(){for(var d=[],e=0;e<arguments.length;e++)d[e-0]=arguments[e];return new g(a,b,d,this,c)}};g.prototype._subscribe=function(a){var d=this.callbackFunc,g=this.args,f=this.scheduler,k=this.subject;if(f)return f.schedule(q,0,{source:this,subscriber:a,context:this.context});k||(k=this.subject=new e.AsyncSubject,f=function w(){for(var a=[],d=0;d<arguments.length;d++)a[d-0]=arguments[d];var e=w.source;d=e.selector;e=e.subject;var g=
-a.shift();g?e.error(g):d?(a=b.tryCatch(d).apply(this,a),a===c.errorObject?e.error(c.errorObject.e):(e.next(a),e.complete())):(e.next(1>=a.length?a[0]:a),e.complete())},f.source=this,b.tryCatch(d).apply(this.context,g.concat(f))===c.errorObject&&k.error(c.errorObject.e));return k.subscribe(a)};return g}(h.Observable);f.BoundNodeCallbackObservable=a},function(h,f,a){h=a(0);a=a(373);h.Observable.combineLatest=a.combineLatest},function(h,f,a){var q=a(37),p=a(36),n=a(38),d=a(125);f.combineLatest=function(){for(var a=
-[],c=0;c<arguments.length;c++)a[c-0]=arguments[c];var e=c=null;q.isScheduler(a[a.length-1])&&(e=a.pop());"function"===typeof a[a.length-1]&&(c=a.pop());1===a.length&&p.isArray(a[0])&&(a=a[0]);return(new n.ArrayObservable(a,e)).lift(new d.CombineLatestOperator(c))}},function(h,f,a){var q=this&&this.__extends||function(a,f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(d,
-b,c){a.call(this);this.parent=d;this.outerValue=b;this.outerIndex=c;this.index=0}q(f,a);f.prototype._next=function(a){this.parent.notifyNext(this.outerValue,a,this.outerIndex,this.index++,this)};f.prototype._error=function(a){this.parent.notifyError(a,this);this.unsubscribe()};f.prototype._complete=function(){this.parent.notifyComplete(this);this.unsubscribe()};return f}(a(3).Subscriber);f.InnerSubscriber=h},function(h,f,a){h=a(0);a=a(376);h.Observable.concat=a.concat},function(h,f,a){h=a(126);f.concat=
-h.concatStatic},function(h,f,a){h=a(0);a=a(378);h.Observable.defer=a.defer},function(h,f,a){h=a(379);f.defer=h.DeferObservable.create},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(0);var p=a(6);a=a(5);h=function(a){function b(b){a.call(this);this.observableFactory=b}q(b,a);b.create=function(a){return new b(a)};b.prototype._subscribe=
-function(a){return new n(a,this.observableFactory)};return b}(h.Observable);f.DeferObservable=h;var n=function(a){function b(b,d){a.call(this,b);this.factory=d;this.tryDefer()}q(b,a);b.prototype.tryDefer=function(){try{this._callFactory()}catch(c){this._error(c)}};b.prototype._callFactory=function(){var a=this.factory();a&&this.add(p.subscribeToResult(this,a))};return b}(a.OuterSubscriber)},function(h,f,a){h=a(0);a=a(381);h.Observable.empty=a.empty},function(h,f,a){h=a(42);f.empty=h.EmptyObservable.create},
-function(h,f,a){h=a(0);a=a(383);h.Observable.forkJoin=a.forkJoin},function(h,f,a){h=a(384);f.forkJoin=h.ForkJoinObservable.create},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(0);var p=a(42),n=a(36),d=a(6);a=a(5);h=function(a){function c(b,c){a.call(this);this.sources=b;this.resultSelector=c}q(c,a);c.create=function(){for(var a=[],
-b=0;b<arguments.length;b++)a[b-0]=arguments[b];if(null===a||0===arguments.length)return new p.EmptyObservable;b=null;"function"===typeof a[a.length-1]&&(b=a.pop());1===a.length&&n.isArray(a[0])&&(a=a[0]);return 0===a.length?new p.EmptyObservable:new c(a,b)};c.prototype._subscribe=function(a){return new b(a,this.sources,this.resultSelector)};return c}(h.Observable);f.ForkJoinObservable=h;var b=function(a){function b(b,c,e){a.call(this,b);this.sources=c;this.resultSelector=e;this.haveValues=this.completed=
-0;this.total=b=c.length;this.values=Array(b);for(e=0;e<b;e++){var g=d.subscribeToResult(this,c[e],null,e);g&&(g.outerIndex=e,this.add(g))}}q(b,a);b.prototype.notifyNext=function(a,b,c,d,e){this.values[c]=b;e._hasValue||(e._hasValue=!0,this.haveValues++)};b.prototype.notifyComplete=function(a){var b=this.destination,c=this.haveValues,d=this.resultSelector,e=this.values,g=e.length;a._hasValue?(this.completed++,this.completed===g&&(c===g&&(a=d?d.apply(this,e):e,b.next(a)),b.complete())):b.complete()};
-return b}(a.OuterSubscriber)},function(h,f,a){h=a(0);a=a(386);h.Observable.from=a.from},function(h,f,a){h=a(201);f.from=h.FromObservable.create},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(16);h=a(0);var n=a(68);a=function(a){function c(c,e){a.call(this);this.scheduler=e;if(null==c)throw Error("iterator cannot be null.");if((e=c[n.iterator])||
-"string"!==typeof c)if(e||void 0===c.length){if(!e)throw new TypeError("object is not iterable");c=c[n.iterator]()}else c=new b(c);else c=new d(c);this.iterator=c}q(c,a);c.create=function(a,b){return new c(a,b)};c.dispatch=function(a){var b=a.index,c=a.iterator,d=a.subscriber;if(a.hasError)d.error(a.error);else{var e=c.next();e.done?d.complete():(d.next(e.value),a.index=b+1,d.closed?"function"===typeof c.return&&c.return():this.schedule(a))}};c.prototype._subscribe=function(a){var b=this.iterator,
-d=this.scheduler;if(d)return d.schedule(c.dispatch,0,{index:0,iterator:b,subscriber:a});do{d=b.next();if(d.done){a.complete();break}else a.next(d.value);if(a.closed){"function"===typeof b.return&&b.return();break}}while(1)};return c}(h.Observable);f.IteratorObservable=a;var d=function(){function a(a,b,c){void 0===b&&(b=0);void 0===c&&(c=a.length);this.str=a;this.idx=b;this.len=c}a.prototype[n.iterator]=function(){return this};a.prototype.next=function(){return this.idx<this.len?{done:!1,value:this.str.charAt(this.idx++)}:
-{done:!0,value:void 0}};return a}(),b=function(){function a(a,b,d){void 0===b&&(b=0);if(void 0===d)if(d=+a.length,isNaN(d))d=0;else if(0!==d&&"number"===typeof d&&p.root.isFinite(d)){var e=+d;e=0===e?e:isNaN(e)?e:0>e?-1:1;d=e*Math.floor(Math.abs(d));d=0>=d?0:d>c?c:d}this.arr=a;this.idx=b;this.len=d}a.prototype[n.iterator]=function(){return this};a.prototype.next=function(){return this.idx<this.len?{done:!1,value:this.arr[this.idx++]}:{done:!0,value:void 0}};return a}(),c=Math.pow(2,53)-1},function(h,
-f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(0);var p=a(124),n=a(42);a=function(a){function b(b,d){a.call(this);this.arrayLike=b;this.scheduler=d;d||1!==b.length||(this._isScalar=!0,this.value=b[0])}q(b,a);b.create=function(a,d){var c=a.length;return 0===c?new n.EmptyObservable:1===c?new p.ScalarObservable(a[0],d):new b(a,d)};b.dispatch=function(a){var b=
-a.arrayLike,c=a.index,d=a.subscriber;d.closed||(c>=a.length?d.complete():(d.next(b[c]),a.index=c+1,this.schedule(a)))};b.prototype._subscribe=function(a){var c=this.arrayLike,d=this.scheduler,f=c.length;if(d)return d.schedule(b.dispatch,0,{arrayLike:c,index:0,length:f,subscriber:a});for(d=0;d<f&&!a.closed;d++)a.next(c[d]);a.complete()};return b}(h.Observable);f.ArrayLikeObservable=a},function(h,f,a){h=a(0);a=a(390);h.Observable.fromEvent=a.fromEvent},function(h,f,a){h=a(391);f.fromEvent=h.FromEventObservable.create},
-function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(0);var p=a(17),n=a(85),d=a(13),b=a(11),c=Object.prototype.toString;a=function(a){function e(b,c,d,e){a.call(this);this.sourceObj=b;this.eventName=c;this.selector=d;this.options=e}q(e,a);e.create=function(a,b,c,d){n.isFunction(c)&&(d=c,c=void 0);return new e(a,b,d,c)};e.setupSubscription=
-function(a,d,g,f,h){if(a&&"[object NodeList]"===c.call(a)||a&&"[object HTMLCollection]"===c.call(a))for(var k=0,l=a.length;k<l;k++)e.setupSubscription(a[k],d,g,f,h);else if(a&&"function"===typeof a.addEventListener&&"function"===typeof a.removeEventListener){a.addEventListener(d,g,h);var m=function(){return a.removeEventListener(d,g)}}else if(a&&"function"===typeof a.on&&"function"===typeof a.off)a.on(d,g),m=function(){return a.off(d,g)};else if(a&&"function"===typeof a.addListener&&"function"===
-typeof a.removeListener)a.addListener(d,g),m=function(){return a.removeListener(d,g)};else throw new TypeError("Invalid event target");f.add(new b.Subscription(m))};e.prototype._subscribe=function(a){var b=this.selector;e.setupSubscription(this.sourceObj,this.eventName,b?function(){for(var c=[],e=0;e<arguments.length;e++)c[e-0]=arguments[e];c=p.tryCatch(b).apply(void 0,c);c===d.errorObject?a.error(d.errorObject.e):a.next(c)}:function(b){return a.next(b)},a,this.options)};return e}(h.Observable);f.FromEventObservable=
-a},function(h,f,a){h=a(0);a=a(393);h.Observable.fromEventPattern=a.fromEventPattern},function(h,f,a){h=a(394);f.fromEventPattern=h.FromEventPatternObservable.create},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(85);h=a(0);var n=a(11);a=function(a){function b(b,d,g){a.call(this);this.addHandler=b;this.removeHandler=d;this.selector=g}
-q(b,a);b.create=function(a,d,g){return new b(a,d,g)};b.prototype._subscribe=function(a){var b=this,c=this.removeHandler,d=this.selector?function(){for(var c=[],d=0;d<arguments.length;d++)c[d-0]=arguments[d];b._callSelector(a,c)}:function(b){a.next(b)},f=this._callAddHandler(d,a);p.isFunction(c)&&a.add(new n.Subscription(function(){c(d,f)}))};b.prototype._callSelector=function(a,b){try{var c=this.selector.apply(this,b);a.next(c)}catch(l){a.error(l)}};b.prototype._callAddHandler=function(a,b){try{return this.addHandler(a)||
-null}catch(g){b.error(g)}};return b}(h.Observable);f.FromEventPatternObservable=a},function(h,f,a){h=a(0);a=a(396);h.Observable.fromPromise=a.fromPromise},function(h,f,a){h=a(202);f.fromPromise=h.PromiseObservable.create},function(h,f,a){h=a(0);a=a(398);h.Observable.generate=a.generate},function(h,f,a){h=a(399);f.generate=h.GenerateObservable.create},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=
-null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(0);var p=a(37),n=function(a){return a};a=function(a){function b(b,d,g,f,k){a.call(this);this.initialState=b;this.condition=d;this.iterate=g;this.resultSelector=f;this.scheduler=k}q(b,a);b.create=function(a,d,g,f,k){return 1==arguments.length?new b(a.initialState,a.condition,a.iterate,a.resultSelector||n,a.scheduler):void 0===f||p.isScheduler(f)?new b(a,d,g,n,f):new b(a,d,g,f,k)};b.prototype._subscribe=function(a){var c=this.initialState;
-if(this.scheduler)return this.scheduler.schedule(b.dispatch,0,{subscriber:a,iterate:this.iterate,condition:this.condition,resultSelector:this.resultSelector,state:c});var d=this.condition,f=this.resultSelector,k=this.iterate;do{if(d){var h=void 0;try{h=d(c)}catch(m){a.error(m);break}if(!h){a.complete();break}}h=void 0;try{h=f(c)}catch(m){a.error(m);break}a.next(h);if(a.closed)break;try{c=k(c)}catch(m){a.error(m);break}}while(1)};b.dispatch=function(a){var b=a.subscriber,c=a.condition;if(!b.closed){if(a.needIterate)try{a.state=
-a.iterate(a.state)}catch(t){b.error(t);return}else a.needIterate=!0;if(c){var d=void 0;try{d=c(a.state)}catch(t){b.error(t);return}if(!d){b.complete();return}if(b.closed)return}try{var f=a.resultSelector(a.state)}catch(t){b.error(t);return}if(!b.closed&&(b.next(f),!b.closed))return this.schedule(a)}};return b}(h.Observable);f.GenerateObservable=a},function(h,f,a){h=a(0);a=a(401);h.Observable.if=a._if},function(h,f,a){h=a(402);f._if=h.IfObservable.create},function(h,f,a){var q=this&&this.__extends||
-function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(0);var p=a(6);a=a(5);h=function(a){function b(b,d,g){a.call(this);this.condition=b;this.thenSource=d;this.elseSource=g}q(b,a);b.create=function(a,d,g){return new b(a,d,g)};b.prototype._subscribe=function(a){return new n(a,this.condition,this.thenSource,this.elseSource)};return b}(h.Observable);f.IfObservable=h;var n=function(a){function b(b,
-d,g,f){a.call(this,b);this.condition=d;this.thenSource=g;this.elseSource=f;this.tryIf()}q(b,a);b.prototype.tryIf=function(){var a=this.condition,b=this.thenSource,d=this.elseSource,f;try{(a=(f=a())?b:d)?this.add(p.subscribeToResult(this,a)):this._complete()}catch(k){this._error(k)}};return b}(a.OuterSubscriber)},function(h,f,a){h=a(0);a=a(404);h.Observable.interval=a.interval},function(h,f,a){h=a(405);f.interval=h.IntervalObservable.create},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=
-a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(91);h=a(0);var n=a(19);a=function(a){function b(b,d){void 0===b&&(b=0);void 0===d&&(d=n.async);a.call(this);this.period=b;this.scheduler=d;if(!p.isNumeric(b)||0>b)this.period=0;d&&"function"===typeof d.schedule||(this.scheduler=n.async)}q(b,a);b.create=function(a,d){void 0===a&&(a=0);void 0===d&&(d=n.async);return new b(a,d)};b.dispatch=function(a){var b=a.subscriber,c=a.period;
-b.next(a.index);b.closed||(a.index+=1,this.schedule(a,c))};b.prototype._subscribe=function(a){var c=this.period;a.add(this.scheduler.schedule(b.dispatch,c,{index:0,subscriber:a,period:c}))};return b}(h.Observable);f.IntervalObservable=a},function(h,f,a){var q=this&&this.__extends||function(a,f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(d,b){a.call(this)}q(f,a);f.prototype.schedule=
-function(a,b){return this};return f}(a(11).Subscription);f.Action=h},function(h,f,a){h=function(){function a(f,h){void 0===h&&(h=a.now);this.SchedulerAction=f;this.now=h}a.prototype.schedule=function(a,f,d){void 0===f&&(f=0);return(new this.SchedulerAction(this,a)).schedule(d,f)};a.now=Date.now?Date.now:function(){return+new Date};return a}();f.Scheduler=h},function(h,f,a){h=a(0);a=a(409);h.Observable.merge=a.merge},function(h,f,a){h=a(203);f.merge=h.mergeStatic},function(h,f,a){h=a(0);a=a(411);h.Observable.race=
-a.race},function(h,f,a){h=a(204);f.race=h.raceStatic},function(h,f,a){h=a(0);a=a(413);h.Observable.never=a.never},function(h,f,a){h=a(414);f.never=h.NeverObservable.create},function(h,f,a){var q=this&&this.__extends||function(a,d){function b(){this.constructor=a}for(var c in d)d.hasOwnProperty(c)&&(a[c]=d[c]);a.prototype=null===d?Object.create(d):(b.prototype=d.prototype,new b)};h=a(0);var p=a(205);a=function(a){function d(){a.call(this)}q(d,a);d.create=function(){return new d};d.prototype._subscribe=
-function(a){p.noop()};return d}(h.Observable);f.NeverObservable=a},function(h,f,a){h=a(0);a=a(416);h.Observable.of=a.of},function(h,f,a){h=a(38);f.of=h.ArrayObservable.of},function(h,f,a){h=a(0);a=a(418);h.Observable.onErrorResumeNext=a.onErrorResumeNext},function(h,f,a){h=a(206);f.onErrorResumeNext=h.onErrorResumeNextStatic},function(h,f,a){h=a(0);a=a(420);h.Observable.pairs=a.pairs},function(h,f,a){h=a(421);f.pairs=h.PairsObservable.create},function(h,f,a){function q(a){var d=a.obj,b=a.keys,c=a.index,
-e=a.subscriber;c===a.length?e.complete():(b=b[c],e.next([b,d[b]]),a.index=c+1,this.schedule(a))}var p=this&&this.__extends||function(a,d){function b(){this.constructor=a}for(var c in d)d.hasOwnProperty(c)&&(a[c]=d[c]);a.prototype=null===d?Object.create(d):(b.prototype=d.prototype,new b)};h=function(a){function d(b,c){a.call(this);this.obj=b;this.scheduler=c;this.keys=Object.keys(b)}p(d,a);d.create=function(a,c){return new d(a,c)};d.prototype._subscribe=function(a){var b=this.keys,d=this.scheduler,
-g=b.length;if(d)return d.schedule(q,0,{obj:this.obj,keys:b,length:g,index:0,subscriber:a});for(d=0;d<g;d++){var f=b[d];a.next([f,this.obj[f]])}a.complete()};return d}(a(0).Observable);f.PairsObservable=h},function(h,f,a){h=a(0);a=a(423);h.Observable.range=a.range},function(h,f,a){h=a(424);f.range=h.RangeObservable.create},function(h,f,a){var q=this&&this.__extends||function(a,f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=
-f.prototype,new d)};h=function(a){function f(d,b,c){a.call(this);this.start=d;this._count=b;this.scheduler=c}q(f,a);f.create=function(a,b,c){void 0===a&&(a=0);void 0===b&&(b=0);return new f(a,b,c)};f.dispatch=function(a){var b=a.start,c=a.index,d=a.subscriber;c>=a.count?d.complete():(d.next(b),d.closed||(a.index=c+1,a.start=b+1,this.schedule(a)))};f.prototype._subscribe=function(a){var b=0,c=this.start,d=this._count,g=this.scheduler;if(g)return g.schedule(f.dispatch,0,{index:b,count:d,start:c,subscriber:a});
-do{if(b++>=d){a.complete();break}a.next(c++);if(a.closed)break}while(1)};return f}(a(0).Observable);f.RangeObservable=h},function(h,f,a){h=a(0);a=a(426);h.Observable.using=a.using},function(h,f,a){h=a(427);f.using=h.UsingObservable.create},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(0);var p=a(6);a=a(5);h=function(a){function b(b,
-d){a.call(this);this.resourceFactory=b;this.observableFactory=d}q(b,a);b.create=function(a,d){return new b(a,d)};b.prototype._subscribe=function(a){var b=this.resourceFactory,c=this.observableFactory;try{var d=b();return new n(a,d,c)}catch(k){a.error(k)}};return b}(h.Observable);f.UsingObservable=h;var n=function(a){function b(b,d,g){a.call(this,b);this.resource=d;this.observableFactory=g;b.add(d);this.tryUse()}q(b,a);b.prototype.tryUse=function(){try{var a=this.observableFactory.call(this,this.resource);
-a&&this.add(p.subscribeToResult(this,a))}catch(e){this._error(e)}};return b}(a.OuterSubscriber)},function(h,f,a){h=a(0);a=a(429);h.Observable.throw=a._throw},function(h,f,a){h=a(430);f._throw=h.ErrorObservable.create},function(h,f,a){var q=this&&this.__extends||function(a,f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(d,b){a.call(this);this.error=d;this.scheduler=b}q(f,
-a);f.create=function(a,b){return new f(a,b)};f.dispatch=function(a){a.subscriber.error(a.error)};f.prototype._subscribe=function(a){var b=this.error,c=this.scheduler;a.syncErrorThrowable=!0;if(c)return c.schedule(f.dispatch,0,{error:b,subscriber:a});a.error(b)};return f}(a(0).Observable);f.ErrorObservable=h},function(h,f,a){h=a(0);a=a(432);h.Observable.timer=a.timer},function(h,f,a){h=a(433);f.timer=h.TimerObservable.create},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=
-a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(91);h=a(0);var n=a(19),d=a(37),b=a(92);a=function(a){function c(c,e,f){void 0===c&&(c=0);a.call(this);this.period=-1;this.dueTime=0;p.isNumeric(e)?this.period=1>Number(e)&&1||Number(e):d.isScheduler(e)&&(f=e);d.isScheduler(f)||(f=n.async);this.scheduler=f;this.dueTime=b.isDate(c)?+c-this.scheduler.now():c}q(c,a);c.create=function(a,b,d){void 0===a&&(a=0);return new c(a,b,d)};
-c.dispatch=function(a){var b=a.index,c=a.period,d=a.subscriber;d.next(b);if(!d.closed){if(-1===c)return d.complete();a.index=b+1;this.schedule(a,c)}};c.prototype._subscribe=function(a){return this.scheduler.schedule(c.dispatch,this.dueTime,{index:0,period:this.period,subscriber:a})};return c}(h.Observable);f.TimerObservable=a},function(h,f,a){h=a(0);a=a(435);h.Observable.zip=a.zip},function(h,f,a){h=a(128);f.zip=h.zipStatic},function(h,f,a){h=a(0);a=a(437);h.Observable.ajax=a.ajax},function(h,f,a){h=
-a(207);f.ajax=h.AjaxObservable.create},function(h,f,a){h=a(0);a=a(439);h.Observable.webSocket=a.webSocket},function(h,f,a){h=a(440);f.webSocket=h.WebSocketSubject.create},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(12),n=a(3),d=a(0),b=a(11),c=a(16),e=a(93),g=a(17),l=a(13),k=a(443);h=function(a){function f(b,g){if(b instanceof d.Observable)a.call(this,
-g,b);else{a.call(this);this.WebSocketCtor=c.root.WebSocket;this._output=new p.Subject;"string"===typeof b?this.url=b:k.assign(this,b);if(!this.WebSocketCtor)throw Error("no WebSocket constructor can be found");this.destination=new e.ReplaySubject}}q(f,a);f.prototype.resultSelector=function(a){return JSON.parse(a.data)};f.create=function(a){return new f(a)};f.prototype.lift=function(a){var b=new f(this,this.destination);b.operator=a;return b};f.prototype._resetState=function(){this.socket=null;this.source||
-(this.destination=new e.ReplaySubject);this._output=new p.Subject};f.prototype.multiplex=function(a,b,c){var e=this;return new d.Observable(function(d){var f=g.tryCatch(a)();f===l.errorObject?d.error(l.errorObject.e):e.next(f);var k=e.subscribe(function(a){var b=g.tryCatch(c)(a);b===l.errorObject?d.error(l.errorObject.e):b&&d.next(a)},function(a){return d.error(a)},function(){return d.complete()});return function(){var a=g.tryCatch(b)();a===l.errorObject?d.error(l.errorObject.e):e.next(a);k.unsubscribe()}})};
-f.prototype._connectSocket=function(){var a=this,c=this.WebSocketCtor,d=this._output,f=null;try{this.socket=f=this.protocol?new c(this.url,this.protocol):new c(this.url),this.binaryType&&(this.socket.binaryType=this.binaryType)}catch(x){d.error(x);return}var k=new b.Subscription(function(){a.socket=null;f&&1===f.readyState&&f.close()});f.onopen=function(b){var c=a.openObserver;c&&c.next(b);b=a.destination;a.destination=n.Subscriber.create(function(a){return 1===f.readyState&&f.send(a)},function(b){var c=
-a.closingObserver;c&&c.next(void 0);b&&b.code?f.close(b.code,b.reason):d.error(new TypeError("WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }"));a._resetState()},function(){var b=a.closingObserver;b&&b.next(void 0);f.close();a._resetState()});b&&b instanceof e.ReplaySubject&&k.add(b.subscribe(a.destination))};f.onerror=function(b){a._resetState();d.error(b)};f.onclose=function(b){a._resetState();var c=a.closeObserver;
-c&&c.next(b);b.wasClean?d.complete():d.error(b)};f.onmessage=function(b){b=g.tryCatch(a.resultSelector)(b);b===l.errorObject?d.error(l.errorObject.e):d.next(b)}};f.prototype._subscribe=function(a){var c=this,d=this.source;if(d)return d.subscribe(a);this.socket||this._connectSocket();d=new b.Subscription;d.add(this._output.subscribe(a));d.add(function(){var a=c.socket;0===c._output.observers.length&&(a&&1===a.readyState&&a.close(),c._resetState())});return d};f.prototype.unsubscribe=function(){var b=
-this.source,c=this.socket;c&&1===c.readyState&&(c.close(),this._resetState());a.prototype.unsubscribe.call(this);b||(this.destination=new e.ReplaySubject)};return f}(p.AnonymousSubject);f.WebSocketSubject=h},function(h,f,a){var q=this&&this.__extends||function(a,f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(d,b){a.call(this,d,b);this.scheduler=d;this.work=b}q(f,a);f.prototype.schedule=
-function(d,b){void 0===b&&(b=0);if(0<b)return a.prototype.schedule.call(this,d,b);this.delay=b;this.state=d;this.scheduler.flush(this);return this};f.prototype.execute=function(d,b){return 0<b||this.closed?a.prototype.execute.call(this,d,b):this._execute(d,b)};f.prototype.requestAsyncId=function(d,b,c){void 0===c&&(c=0);return null!==c&&0<c||null===c&&0<this.delay?a.prototype.requestAsyncId.call(this,d,b,c):d.flush(this)};return f}(a(70).AsyncAction);f.QueueAction=h},function(h,f,a){var q=this&&this.__extends||
-function(a,f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(){a.apply(this,arguments)}q(f,a);return f}(a(71).AsyncScheduler);f.QueueScheduler=h},function(h,f,a){function q(a){for(var d=[],b=1;b<arguments.length;b++)d[b-1]=arguments[b];b=d.length;for(var c=0;c<b;c++){var e=d[c],g;for(g in e)e.hasOwnProperty(g)&&(a[g]=e[g])}return a}function p(a){return a.Object.assign||
-q}h=a(16);f.assignImpl=q;f.getAssign=p;f.assign=p(h.root)},function(h,f,a){h=a(0);a=a(445);h.Observable.prototype.buffer=a.buffer},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(5);var p=a(6);f.buffer=function(a){return this.lift(new n(a))};var n=function(){function a(a){this.closingNotifier=a}a.prototype.call=function(a,b){return b.subscribe(new d(a,
-this.closingNotifier))};return a}(),d=function(a){function b(b,c){a.call(this,b);this.buffer=[];this.add(p.subscribeToResult(this,c))}q(b,a);b.prototype._next=function(a){this.buffer.push(a)};b.prototype.notifyNext=function(a,b,c,d,f){a=this.buffer;this.buffer=[];this.destination.next(a)};return b}(h.OuterSubscriber)},function(h,f,a){h=a(0);a=a(447);h.Observable.prototype.bufferCount=a.bufferCount},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&
-(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(3);f.bufferCount=function(a,c){void 0===c&&(c=null);return this.lift(new p(a,c))};var p=function(){function a(a,b){this.bufferSize=a;this.subscriberClass=(this.startBufferEvery=b)&&a!==b?d:n}a.prototype.call=function(a,b){return b.subscribe(new this.subscriberClass(a,this.bufferSize,this.startBufferEvery))};return a}(),n=function(a){function b(b,c){a.call(this,b);this.bufferSize=c;this.buffer=[]}q(b,a);b.prototype._next=
-function(a){var b=this.buffer;b.push(a);b.length==this.bufferSize&&(this.destination.next(b),this.buffer=[])};b.prototype._complete=function(){var b=this.buffer;0<b.length&&this.destination.next(b);a.prototype._complete.call(this)};return b}(h.Subscriber),d=function(a){function b(b,c,d){a.call(this,b);this.bufferSize=c;this.startBufferEvery=d;this.buffers=[];this.count=0}q(b,a);b.prototype._next=function(a){var b=this.bufferSize,c=this.startBufferEvery,d=this.buffers,e=this.count;this.count++;0===
-e%c&&d.push([]);for(c=d.length;c--;)e=d[c],e.push(a),e.length===b&&(d.splice(c,1),this.destination.next(e))};b.prototype._complete=function(){for(var b=this.buffers,c=this.destination;0<b.length;){var d=b.shift();0<d.length&&c.next(d)}a.prototype._complete.call(this)};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(449);h.Observable.prototype.bufferTime=a.bufferTime},function(h,f,a){function q(a){var b=a.subscriber,c=a.context;c&&b.closeContext(c);b.closed||(a.context=b.openContext(),a.context.closeAction=
-this.schedule(a,a.bufferTimeSpan))}function p(a){var b=a.bufferCreationInterval,c=a.bufferTimeSpan,d=a.subscriber,e=a.scheduler,g=d.openContext();d.closed||(d.add(g.closeAction=e.schedule(n,c,{subscriber:d,context:g})),this.schedule(a,b))}function n(a){a.subscriber.closeContext(a.context)}var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},b=a(19);h=a(3);var c=
-a(37);f.bufferTime=function(a){var d=arguments.length,g=b.async;c.isScheduler(arguments[arguments.length-1])&&(g=arguments[arguments.length-1],d--);var f=null;2<=d&&(f=arguments[1]);var k=Number.POSITIVE_INFINITY;3<=d&&(k=arguments[2]);return this.lift(new e(a,f,k,g))};var e=function(){function a(a,b,c,d){this.bufferTimeSpan=a;this.bufferCreationInterval=b;this.maxBufferSize=c;this.scheduler=d}a.prototype.call=function(a,b){return b.subscribe(new l(a,this.bufferTimeSpan,this.bufferCreationInterval,
-this.maxBufferSize,this.scheduler))};return a}(),g=function(){return function(){this.buffer=[]}}(),l=function(a){function b(b,c,d,e,g){a.call(this,b);this.bufferTimeSpan=c;this.bufferCreationInterval=d;this.maxBufferSize=e;this.scheduler=g;this.contexts=[];b=this.openContext();(this.timespanOnly=null==d||0>d)?this.add(b.closeAction=g.schedule(q,c,{subscriber:this,context:b,bufferTimeSpan:c})):(e={bufferTimeSpan:c,bufferCreationInterval:d,subscriber:this,scheduler:g},this.add(b.closeAction=g.schedule(n,
-c,{subscriber:this,context:b})),this.add(g.schedule(p,d,e)))}d(b,a);b.prototype._next=function(a){for(var b=this.contexts,c=b.length,d,e=0;e<c;e++){var g=b[e],f=g.buffer;f.push(a);f.length==this.maxBufferSize&&(d=g)}if(d)this.onBufferFull(d)};b.prototype._error=function(b){this.contexts.length=0;a.prototype._error.call(this,b)};b.prototype._complete=function(){for(var b=this.contexts,c=this.destination;0<b.length;){var d=b.shift();c.next(d.buffer)}a.prototype._complete.call(this)};b.prototype._unsubscribe=
-function(){this.contexts=null};b.prototype.onBufferFull=function(a){this.closeContext(a);a=a.closeAction;a.unsubscribe();this.remove(a);if(!this.closed&&this.timespanOnly){a=this.openContext();var b=this.bufferTimeSpan;this.add(a.closeAction=this.scheduler.schedule(q,b,{subscriber:this,context:a,bufferTimeSpan:b}))}};b.prototype.openContext=function(){var a=new g;this.contexts.push(a);return a};b.prototype.closeContext=function(a){this.destination.next(a.buffer);var b=this.contexts;0<=(b?b.indexOf(a):
--1)&&b.splice(b.indexOf(a),1)};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(451);h.Observable.prototype.bufferToggle=a.bufferToggle},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(11),n=a(6);h=a(5);f.bufferToggle=function(a,b){return this.lift(new d(a,b))};var d=function(){function a(a,b){this.openings=a;this.closingSelector=b}
-a.prototype.call=function(a,c){return c.subscribe(new b(a,this.openings,this.closingSelector))};return a}(),b=function(a){function b(b,c,d){a.call(this,b);this.openings=c;this.closingSelector=d;this.contexts=[];this.add(n.subscribeToResult(this,c))}q(b,a);b.prototype._next=function(a){for(var b=this.contexts,c=b.length,d=0;d<c;d++)b[d].buffer.push(a)};b.prototype._error=function(b){for(var c=this.contexts;0<c.length;){var d=c.shift();d.subscription.unsubscribe();d.buffer=null;d.subscription=null}this.contexts=
-null;a.prototype._error.call(this,b)};b.prototype._complete=function(){for(var b=this.contexts;0<b.length;){var c=b.shift();this.destination.next(c.buffer);c.subscription.unsubscribe();c.buffer=null;c.subscription=null}this.contexts=null;a.prototype._complete.call(this)};b.prototype.notifyNext=function(a,b,c,d,e){a?this.closeBuffer(a):this.openBuffer(b)};b.prototype.notifyComplete=function(a){this.closeBuffer(a.context)};b.prototype.openBuffer=function(a){try{var b=this.closingSelector.call(this,
-a);b&&this.trySubscribe(b)}catch(k){this._error(k)}};b.prototype.closeBuffer=function(a){var b=this.contexts;if(b&&a){var c=a.subscription;this.destination.next(a.buffer);b.splice(b.indexOf(a),1);this.remove(c);c.unsubscribe()}};b.prototype.trySubscribe=function(a){var b=this.contexts,c=new p.Subscription,d={buffer:[],subscription:c};b.push(d);a=n.subscribeToResult(this,a,d);!a||a.closed?this.closeBuffer(d):(a.context=d,this.add(a),c.add(a))};return b}(h.OuterSubscriber)},function(h,f,a){h=a(0);a=
-a(453);h.Observable.prototype.bufferWhen=a.bufferWhen},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(11),n=a(17),d=a(13);h=a(5);var b=a(6);f.bufferWhen=function(a){return this.lift(new c(a))};var c=function(){function a(a){this.closingSelector=a}a.prototype.call=function(a,b){return b.subscribe(new e(a,this.closingSelector))};return a}(),
-e=function(a){function c(b,c){a.call(this,b);this.closingSelector=c;this.subscribing=!1;this.openBuffer()}q(c,a);c.prototype._next=function(a){this.buffer.push(a)};c.prototype._complete=function(){var b=this.buffer;b&&this.destination.next(b);a.prototype._complete.call(this)};c.prototype._unsubscribe=function(){this.buffer=null;this.subscribing=!1};c.prototype.notifyNext=function(a,b,c,d,e){this.openBuffer()};c.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()};
-c.prototype.openBuffer=function(){var a=this.closingSubscription;a&&(this.remove(a),a.unsubscribe());(a=this.buffer)&&this.destination.next(a);this.buffer=[];var c=n.tryCatch(this.closingSelector)();c===d.errorObject?this.error(d.errorObject.e):(this.closingSubscription=a=new p.Subscription,this.add(a),this.subscribing=!0,a.add(b.subscribeToResult(this,c)),this.subscribing=!1)};return c}(h.OuterSubscriber)},function(h,f,a){h=a(0);a=a(455);h.Observable.prototype.catch=a._catch;h.Observable.prototype._catch=
-a._catch},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(5);var p=a(6);f._catch=function(a){a=new n(a);var b=this.lift(a);return a.caught=b};var n=function(){function a(a){this.selector=a}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.selector,this.caught))};return a}(),d=function(a){function b(b,c,d){a.call(this,b);this.selector=
-c;this.caught=d}q(b,a);b.prototype.error=function(b){if(!this.isStopped){var c=void 0;try{c=this.selector(b,this.caught)}catch(l){a.prototype.error.call(this,l);return}this._unsubscribeAndRecycle();this.add(p.subscribeToResult(this,c))}};return b}(h.OuterSubscriber)},function(h,f,a){h=a(0);a=a(457);h.Observable.prototype.combineAll=a.combineAll},function(h,f,a){var q=a(125);f.combineAll=function(a){return this.lift(new q.CombineLatestOperator(a))}},function(h,f,a){h=a(0);a=a(125);h.Observable.prototype.combineLatest=
-a.combineLatest},function(h,f,a){h=a(0);a=a(126);h.Observable.prototype.concat=a.concat},function(h,f,a){h=a(0);a=a(461);h.Observable.prototype.concatAll=a.concatAll},function(h,f,a){var q=a(90);f.concatAll=function(){return this.lift(new q.MergeAllOperator(1))}},function(h,f,a){h=a(0);a=a(463);h.Observable.prototype.concatMap=a.concatMap},function(h,f,a){var q=a(209);f.concatMap=function(a,f){return this.lift(new q.MergeMapOperator(a,f,1))}},function(h,f,a){h=a(0);a=a(465);h.Observable.prototype.concatMapTo=
-a.concatMapTo},function(h,f,a){var q=a(210);f.concatMapTo=function(a,f){return this.lift(new q.MergeMapToOperator(a,f,1))}},function(h,f,a){h=a(0);a=a(467);h.Observable.prototype.count=a.count},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);f.count=function(a){return this.lift(new p(a,this))};var p=function(){function a(a,c){this.predicate=
-a;this.source=c}a.prototype.call=function(a,c){return c.subscribe(new n(a,this.predicate,this.source))};return a}(),n=function(a){function b(b,d,g){a.call(this,b);this.predicate=d;this.source=g;this.index=this.count=0}q(b,a);b.prototype._next=function(a){this.predicate?this._tryPredicate(a):this.count++};b.prototype._tryPredicate=function(a){try{var b=this.predicate(a,this.index++,this.source)}catch(g){this.destination.error(g);return}b&&this.count++};b.prototype._complete=function(){this.destination.next(this.count);
-this.destination.complete()};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(469);h.Observable.prototype.dematerialize=a.dematerialize},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);f.dematerialize=function(){return this.lift(new p)};var p=function(){function a(){}a.prototype.call=function(a,c){return c.subscribe(new n(a))};return a}(),
-n=function(a){function b(b){a.call(this,b)}q(b,a);b.prototype._next=function(a){a.observe(this.destination)};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(471);h.Observable.prototype.debounce=a.debounce},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(5);var p=a(6);f.debounce=function(a){return this.lift(new n(a))};var n=function(){function a(a){this.durationSelector=
-a}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.durationSelector))};return a}(),d=function(a){function b(b,c){a.call(this,b);this.durationSelector=c;this.hasValue=!1;this.durationSubscription=null}q(b,a);b.prototype._next=function(a){try{var b=this.durationSelector.call(this,a);b&&this._tryNext(a,b)}catch(l){this.destination.error(l)}};b.prototype._complete=function(){this.emitValue();this.destination.complete()};b.prototype._tryNext=function(a,b){var c=this.durationSubscription;
-this.value=a;this.hasValue=!0;c&&(c.unsubscribe(),this.remove(c));c=p.subscribeToResult(this,b);c.closed||this.add(this.durationSubscription=c)};b.prototype.notifyNext=function(a,b,c,d,f){this.emitValue()};b.prototype.notifyComplete=function(){this.emitValue()};b.prototype.emitValue=function(){if(this.hasValue){var b=this.value,c=this.durationSubscription;c&&(this.durationSubscription=null,c.unsubscribe(),this.remove(c));this.value=null;this.hasValue=!1;a.prototype._next.call(this,b)}};return b}(h.OuterSubscriber)},
-function(h,f,a){h=a(0);a=a(473);h.Observable.prototype.debounceTime=a.debounceTime},function(h,f,a){function q(a){a.debouncedNext()}var p=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);var n=a(19);f.debounceTime=function(a,b){void 0===b&&(b=n.async);return this.lift(new d(a,b))};var d=function(){function a(a,b){this.dueTime=a;this.scheduler=b}a.prototype.call=
-function(a,c){return c.subscribe(new b(a,this.dueTime,this.scheduler))};return a}(),b=function(a){function b(b,c,d){a.call(this,b);this.dueTime=c;this.scheduler=d;this.lastValue=this.debouncedSubscription=null;this.hasValue=!1}p(b,a);b.prototype._next=function(a){this.clearDebounce();this.lastValue=a;this.hasValue=!0;this.add(this.debouncedSubscription=this.scheduler.schedule(q,this.dueTime,this))};b.prototype._complete=function(){this.debouncedNext();this.destination.complete()};b.prototype.debouncedNext=
-function(){this.clearDebounce();this.hasValue&&(this.destination.next(this.lastValue),this.lastValue=null,this.hasValue=!1)};b.prototype.clearDebounce=function(){var a=this.debouncedSubscription;null!==a&&(this.remove(a),a.unsubscribe(),this.debouncedSubscription=null)};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(475);h.Observable.prototype.defaultIfEmpty=a.defaultIfEmpty},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&
-(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);f.defaultIfEmpty=function(a){void 0===a&&(a=null);return this.lift(new p(a))};var p=function(){function a(a){this.defaultValue=a}a.prototype.call=function(a,c){return c.subscribe(new n(a,this.defaultValue))};return a}(),n=function(a){function b(b,d){a.call(this,b);this.defaultValue=d;this.isEmpty=!0}q(b,a);b.prototype._next=function(a){this.isEmpty=!1;this.destination.next(a)};b.prototype._complete=function(){this.isEmpty&&
-this.destination.next(this.defaultValue);this.destination.complete()};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(477);h.Observable.prototype.delay=a.delay},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(19),n=a(92);h=a(3);var d=a(69);f.delay=function(a,c){void 0===c&&(c=p.async);a=n.isDate(a)?+a-c.now():Math.abs(a);return this.lift(new b(a,
-c))};var b=function(){function a(a,b){this.delay=a;this.scheduler=b}a.prototype.call=function(a,b){return b.subscribe(new c(a,this.delay,this.scheduler))};return a}(),c=function(a){function b(b,c,d){a.call(this,b);this.delay=c;this.scheduler=d;this.queue=[];this.errored=this.active=!1}q(b,a);b.dispatch=function(a){for(var b=a.source,c=b.queue,d=a.scheduler,e=a.destination;0<c.length&&0>=c[0].time-d.now();)c.shift().notification.observe(e);0<c.length?(b=Math.max(0,c[0].time-d.now()),this.schedule(a,
-b)):b.active=!1};b.prototype._schedule=function(a){this.active=!0;this.add(a.schedule(b.dispatch,this.delay,{source:this,destination:this.destination,scheduler:a}))};b.prototype.scheduleNotification=function(a){if(!0!==this.errored){var b=this.scheduler;a=new e(b.now()+this.delay,a);this.queue.push(a);!1===this.active&&this._schedule(b)}};b.prototype._next=function(a){this.scheduleNotification(d.Notification.createNext(a))};b.prototype._error=function(a){this.errored=!0;this.queue=[];this.destination.error(a)};
-b.prototype._complete=function(){this.scheduleNotification(d.Notification.createComplete())};return b}(h.Subscriber),e=function(){return function(a,b){this.time=a;this.notification=b}}()},function(h,f,a){h=a(0);a=a(479);h.Observable.prototype.delayWhen=a.delayWhen},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);var p=a(0),n=a(5),d=
-a(6);f.delayWhen=function(a,c){return c?(new e(this,c)).lift(new b(a)):this.lift(new b(a))};var b=function(){function a(a){this.delayDurationSelector=a}a.prototype.call=function(a,b){return b.subscribe(new c(a,this.delayDurationSelector))};return a}(),c=function(a){function b(b,c){a.call(this,b);this.delayDurationSelector=c;this.completed=!1;this.delayNotifierSubscriptions=[];this.values=[]}q(b,a);b.prototype.notifyNext=function(a,b,c,d,e){this.destination.next(a);this.removeSubscription(e);this.tryComplete()};
-b.prototype.notifyError=function(a,b){this._error(a)};b.prototype.notifyComplete=function(a){(a=this.removeSubscription(a))&&this.destination.next(a);this.tryComplete()};b.prototype._next=function(a){try{var b=this.delayDurationSelector(a);b&&this.tryDelay(b,a)}catch(r){this.destination.error(r)}};b.prototype._complete=function(){this.completed=!0;this.tryComplete()};b.prototype.removeSubscription=function(a){a.unsubscribe();a=this.delayNotifierSubscriptions.indexOf(a);var b=null;-1!==a&&(b=this.values[a],
-this.delayNotifierSubscriptions.splice(a,1),this.values.splice(a,1));return b};b.prototype.tryDelay=function(a,b){(a=d.subscribeToResult(this,a,b))&&!a.closed&&(this.add(a),this.delayNotifierSubscriptions.push(a));this.values.push(b)};b.prototype.tryComplete=function(){this.completed&&0===this.delayNotifierSubscriptions.length&&this.destination.complete()};return b}(n.OuterSubscriber),e=function(a){function b(b,c){a.call(this);this.source=b;this.subscriptionDelay=c}q(b,a);b.prototype._subscribe=function(a){this.subscriptionDelay.subscribe(new g(a,
-this.source))};return b}(p.Observable),g=function(a){function b(b,c){a.call(this);this.parent=b;this.source=c;this.sourceSubscribed=!1}q(b,a);b.prototype._next=function(a){this.subscribeToSource()};b.prototype._error=function(a){this.unsubscribe();this.parent.error(a)};b.prototype._complete=function(){this.subscribeToSource()};b.prototype.subscribeToSource=function(){this.sourceSubscribed||(this.sourceSubscribed=!0,this.unsubscribe(),this.source.subscribe(this.parent))};return b}(h.Subscriber)},function(h,
-f,a){h=a(0);a=a(481);h.Observable.prototype.distinct=a.distinct},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(5);var p=a(6),n=a(482);f.distinct=function(a,b){return this.lift(new d(a,b))};var d=function(){function a(a,b){this.keySelector=a;this.flushes=b}a.prototype.call=function(a,c){return c.subscribe(new b(a,this.keySelector,this.flushes))};
-return a}(),b=function(a){function b(b,c,d){a.call(this,b);this.keySelector=c;this.values=new n.Set;d&&this.add(p.subscribeToResult(this,d))}q(b,a);b.prototype.notifyNext=function(a,b,c,d,e){this.values.clear()};b.prototype.notifyError=function(a,b){this._error(a)};b.prototype._next=function(a){this.keySelector?this._useKeySelector(a):this._finalizeNext(a,a)};b.prototype._useKeySelector=function(a){var b=this.destination;try{var c=this.keySelector(a)}catch(t){b.error(t);return}this._finalizeNext(c,
-a)};b.prototype._finalizeNext=function(a,b){var c=this.values;c.has(a)||(c.add(a),this.destination.next(b))};return b}(h.OuterSubscriber);f.DistinctSubscriber=b},function(h,f,a){function q(){return function(){function a(){this._values=[]}a.prototype.add=function(a){this.has(a)||this._values.push(a)};a.prototype.has=function(a){return-1!==this._values.indexOf(a)};Object.defineProperty(a.prototype,"size",{get:function(){return this._values.length},enumerable:!0,configurable:!0});a.prototype.clear=function(){this._values.length=
-0};return a}()}h=a(16);f.minimalSetImpl=q;f.Set=h.root.Set||q()},function(h,f,a){h=a(0);a=a(211);h.Observable.prototype.distinctUntilChanged=a.distinctUntilChanged},function(h,f,a){h=a(0);a=a(485);h.Observable.prototype.distinctUntilKeyChanged=a.distinctUntilKeyChanged},function(h,f,a){var q=a(211);f.distinctUntilKeyChanged=function(a,f){return q.distinctUntilChanged.call(this,function(d,b){return f?f(d[a],b[a]):d[a]===b[a]})}},function(h,f,a){h=a(0);a=a(487);h.Observable.prototype.do=a._do;h.Observable.prototype._do=
-a._do},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)},p=a(3);f._do=function(a,c,d){return this.lift(new n(a,c,d))};var n=function(){function a(a,b,d){this.nextOrObserver=a;this.error=b;this.complete=d}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.nextOrObserver,this.error,this.complete))};return a}(),d=function(a){function b(b,
-c,d,f){a.call(this,b);b=new p.Subscriber(c,d,f);b.syncErrorThrowable=!0;this.add(b);this.safeSubscriber=b}q(b,a);b.prototype._next=function(a){var b=this.safeSubscriber;b.next(a);b.syncErrorThrown?this.destination.error(b.syncErrorValue):this.destination.next(a)};b.prototype._error=function(a){var b=this.safeSubscriber;b.error(a);b.syncErrorThrown?this.destination.error(b.syncErrorValue):this.destination.error(a)};b.prototype._complete=function(){var a=this.safeSubscriber;a.complete();a.syncErrorThrown?
-this.destination.error(a.syncErrorValue):this.destination.complete()};return b}(p.Subscriber)},function(h,f,a){h=a(0);a=a(489);h.Observable.prototype.exhaust=a.exhaust},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(5);var p=a(6);f.exhaust=function(){return this.lift(new n)};var n=function(){function a(){}a.prototype.call=function(a,
-b){return b.subscribe(new d(a))};return a}(),d=function(a){function b(b){a.call(this,b);this.hasSubscription=this.hasCompleted=!1}q(b,a);b.prototype._next=function(a){this.hasSubscription||(this.hasSubscription=!0,this.add(p.subscribeToResult(this,a)))};b.prototype._complete=function(){this.hasCompleted=!0;this.hasSubscription||this.destination.complete()};b.prototype.notifyComplete=function(a){this.remove(a);this.hasSubscription=!1;this.hasCompleted&&this.destination.complete()};return b}(h.OuterSubscriber)},
-function(h,f,a){h=a(0);a=a(491);h.Observable.prototype.exhaustMap=a.exhaustMap},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(5);var p=a(6);f.exhaustMap=function(a,c){return this.lift(new n(a,c))};var n=function(){function a(a,b){this.project=a;this.resultSelector=b}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.project,
-this.resultSelector))};return a}(),d=function(a){function b(b,c,d){a.call(this,b);this.project=c;this.resultSelector=d;this.hasCompleted=this.hasSubscription=!1;this.index=0}q(b,a);b.prototype._next=function(a){this.hasSubscription||this.tryNext(a)};b.prototype.tryNext=function(a){var b=this.index++,c=this.destination;try{var d=this.project(a,b);this.hasSubscription=!0;this.add(p.subscribeToResult(this,d,a,b))}catch(t){c.error(t)}};b.prototype._complete=function(){this.hasCompleted=!0;this.hasSubscription||
-this.destination.complete()};b.prototype.notifyNext=function(a,b,c,d,f){f=this.destination;this.resultSelector?this.trySelectResult(a,b,c,d):f.next(b)};b.prototype.trySelectResult=function(a,b,c,d){var e=this.resultSelector,g=this.destination;try{var f=e(a,b,c,d);g.next(f)}catch(u){g.error(u)}};b.prototype.notifyError=function(a){this.destination.error(a)};b.prototype.notifyComplete=function(a){this.remove(a);this.hasSubscription=!1;this.hasCompleted&&this.destination.complete()};return b}(h.OuterSubscriber)},
-function(h,f,a){h=a(0);a=a(493);h.Observable.prototype.expand=a.expand},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(17),n=a(13);h=a(5);var d=a(6);f.expand=function(a,c,d){void 0===c&&(c=Number.POSITIVE_INFINITY);void 0===d&&(d=void 0);c=1>(c||0)?Number.POSITIVE_INFINITY:c;return this.lift(new b(a,c,d))};var b=function(){function a(a,
-b,c){this.project=a;this.concurrent=b;this.scheduler=c}a.prototype.call=function(a,b){return b.subscribe(new c(a,this.project,this.concurrent,this.scheduler))};return a}();f.ExpandOperator=b;var c=function(a){function b(b,c,d,e){a.call(this,b);this.project=c;this.concurrent=d;this.scheduler=e;this.active=this.index=0;this.hasCompleted=!1;d<Number.POSITIVE_INFINITY&&(this.buffer=[])}q(b,a);b.dispatch=function(a){a.subscriber.subscribeToProjection(a.result,a.value,a.index)};b.prototype._next=function(a){var c=
-this.destination;if(c.closed)this._complete();else{var d=this.index++;if(this.active<this.concurrent){c.next(a);var e=p.tryCatch(this.project)(a,d);e===n.errorObject?c.error(n.errorObject.e):this.scheduler?this.add(this.scheduler.schedule(b.dispatch,0,{subscriber:this,result:e,value:a,index:d})):this.subscribeToProjection(e,a,d)}else this.buffer.push(a)}};b.prototype.subscribeToProjection=function(a,b,c){this.active++;this.add(d.subscribeToResult(this,a,b,c))};b.prototype._complete=function(){(this.hasCompleted=
-!0,0===this.active)&&this.destination.complete()};b.prototype.notifyNext=function(a,b,c,d,e){this._next(b)};b.prototype.notifyComplete=function(a){var b=this.buffer;this.remove(a);this.active--;b&&0<b.length&&this._next(b.shift());this.hasCompleted&&0===this.active&&this.destination.complete()};return b}(h.OuterSubscriber);f.ExpandSubscriber=c},function(h,f,a){h=a(0);a=a(495);h.Observable.prototype.elementAt=a.elementAt},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=
-a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(3);var p=a(72);f.elementAt=function(a,c){return this.lift(new n(a,c))};var n=function(){function a(a,b){this.index=a;this.defaultValue=b;if(0>a)throw new p.ArgumentOutOfRangeError;}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.index,this.defaultValue))};return a}(),d=function(a){function b(b,c,d){a.call(this,b);this.index=c;this.defaultValue=d}q(b,a);b.prototype._next=
-function(a){0===this.index--&&(this.destination.next(a),this.destination.complete())};b.prototype._complete=function(){var a=this.destination;0<=this.index&&("undefined"!==typeof this.defaultValue?a.next(this.defaultValue):a.error(new p.ArgumentOutOfRangeError));a.complete()};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(212);h.Observable.prototype.filter=a.filter},function(h,f,a){h=a(0);a=a(498);h.Observable.prototype.finally=a._finally;h.Observable.prototype._finally=a._finally},function(h,
-f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(3);var p=a(11);f._finally=function(a){return this.lift(new n(a))};var n=function(){function a(a){this.callback=a}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.callback))};return a}(),d=function(a){function b(b,c){a.call(this,b);this.add(new p.Subscription(c))}q(b,a);return b}(h.Subscriber)},
-function(h,f,a){h=a(0);a=a(213);h.Observable.prototype.find=a.find},function(h,f,a){h=a(0);a=a(501);h.Observable.prototype.findIndex=a.findIndex},function(h,f,a){var q=a(213);f.findIndex=function(a,f){return this.lift(new q.FindValueOperator(a,this,!0,f))}},function(h,f,a){h=a(0);a=a(503);h.Observable.prototype.first=a.first},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):
-(b.prototype=c.prototype,new b)};h=a(3);var p=a(94);f.first=function(a,c,d){return this.lift(new n(a,c,d,this))};var n=function(){function a(a,b,d,f){this.predicate=a;this.resultSelector=b;this.defaultValue=d;this.source=f}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.predicate,this.resultSelector,this.defaultValue,this.source))};return a}(),d=function(a){function b(b,c,d,f,h){a.call(this,b);this.predicate=c;this.resultSelector=d;this.defaultValue=f;this.source=h;this.index=0;this._emitted=
-this.hasCompleted=!1}q(b,a);b.prototype._next=function(a){var b=this.index++;this.predicate?this._tryPredicate(a,b):this._emit(a,b)};b.prototype._tryPredicate=function(a,b){try{var c=this.predicate(a,b,this.source)}catch(k){this.destination.error(k);return}c&&this._emit(a,b)};b.prototype._emit=function(a,b){this.resultSelector?this._tryResultSelector(a,b):this._emitFinal(a)};b.prototype._tryResultSelector=function(a,b){try{var c=this.resultSelector(a,b)}catch(k){this.destination.error(k);return}this._emitFinal(c)};
-b.prototype._emitFinal=function(a){var b=this.destination;this._emitted||(this._emitted=!0,b.next(a),b.complete(),this.hasCompleted=!0)};b.prototype._complete=function(){var a=this.destination;this.hasCompleted||"undefined"===typeof this.defaultValue?this.hasCompleted||a.error(new p.EmptyError):(a.next(this.defaultValue),a.complete())};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(505);h.Observable.prototype.groupBy=a.groupBy},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=
-a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);var p=a(11),n=a(0),d=a(12),b=a(506),c=a(508);f.groupBy=function(a,b,c,d){return this.lift(new e(a,b,c,d))};var e=function(){function a(a,b,c,d){this.keySelector=a;this.elementSelector=b;this.durationSelector=c;this.subjectSelector=d}a.prototype.call=function(a,b){return b.subscribe(new g(a,this.keySelector,this.elementSelector,this.durationSelector,this.subjectSelector))};
-return a}(),g=function(a){function e(b,c,d,e,g){a.call(this,b);this.keySelector=c;this.elementSelector=d;this.durationSelector=e;this.subjectSelector=g;this.groups=null;this.attemptedToUnsubscribe=!1;this.count=0}q(e,a);e.prototype._next=function(a){try{var b=this.keySelector(a)}catch(w){this.error(w);return}this._group(a,b)};e.prototype._group=function(a,e){var g=this.groups;g||(g=this.groups="string"===typeof e?new c.FastMap:new b.Map);var f=g.get(e);if(this.elementSelector)try{var h=this.elementSelector(a)}catch(A){this.error(A)}else h=
-a;if(!f&&(f=this.subjectSelector?this.subjectSelector():new d.Subject,g.set(e,f),a=new k(e,f,this),this.destination.next(a),this.durationSelector)){a=void 0;try{a=this.durationSelector(new k(e,f))}catch(A){this.error(A);return}this.add(a.subscribe(new l(e,f,this)))}f.closed||f.next(h)};e.prototype._error=function(a){var b=this.groups;b&&(b.forEach(function(b,c){b.error(a)}),b.clear());this.destination.error(a)};e.prototype._complete=function(){var a=this.groups;a&&(a.forEach(function(a,b){a.complete()}),
-a.clear());this.destination.complete()};e.prototype.removeGroup=function(a){this.groups.delete(a)};e.prototype.unsubscribe=function(){this.closed||(this.attemptedToUnsubscribe=!0,0===this.count&&a.prototype.unsubscribe.call(this))};return e}(h.Subscriber),l=function(a){function b(b,c,d){a.call(this,c);this.key=b;this.group=c;this.parent=d}q(b,a);b.prototype._next=function(a){this.complete()};b.prototype._unsubscribe=function(){var a=this.parent,b=this.key;this.key=this.parent=null;a&&a.removeGroup(b)};
-return b}(h.Subscriber),k=function(a){function b(b,c,d){a.call(this);this.key=b;this.groupSubject=c;this.refCountSubscription=d}q(b,a);b.prototype._subscribe=function(a){var b=new p.Subscription,c=this.refCountSubscription,d=this.groupSubject;c&&!c.closed&&b.add(new t(c));b.add(d.subscribe(a));return b};return b}(n.Observable);f.GroupedObservable=k;var t=function(a){function b(b){a.call(this);this.parent=b;b.count++}q(b,a);b.prototype.unsubscribe=function(){var b=this.parent;b.closed||this.closed||
-(a.prototype.unsubscribe.call(this),--b.count,0===b.count&&b.attemptedToUnsubscribe&&b.unsubscribe())};return b}(p.Subscription)},function(h,f,a){h=a(16);a=a(507);f.Map=h.root.Map||a.MapPolyfill},function(h,f,a){h=function(){function a(){this.size=0;this._values=[];this._keys=[]}a.prototype.get=function(a){a=this._keys.indexOf(a);return-1===a?void 0:this._values[a]};a.prototype.set=function(a,f){var d=this._keys.indexOf(a);-1===d?(this._keys.push(a),this._values.push(f),this.size++):this._values[d]=
-f;return this};a.prototype.delete=function(a){a=this._keys.indexOf(a);if(-1===a)return!1;this._values.splice(a,1);this._keys.splice(a,1);this.size--;return!0};a.prototype.clear=function(){this._keys.length=0;this.size=this._values.length=0};a.prototype.forEach=function(a,f){for(var d=0;d<this.size;d++)a.call(f,this._values[d],this._keys[d])};return a}();f.MapPolyfill=h},function(h,f,a){h=function(){function a(){this.values={}}a.prototype.delete=function(a){this.values[a]=null;return!0};a.prototype.set=
-function(a,f){this.values[a]=f;return this};a.prototype.get=function(a){return this.values[a]};a.prototype.forEach=function(a,f){var d=this.values,b;for(b in d)d.hasOwnProperty(b)&&null!==d[b]&&a.call(f,d[b],b)};a.prototype.clear=function(){this.values={}};return a}();f.FastMap=h},function(h,f,a){h=a(0);a=a(510);h.Observable.prototype.ignoreElements=a.ignoreElements},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=
-c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(3);var p=a(205);f.ignoreElements=function(){return this.lift(new n)};var n=function(){function a(){}a.prototype.call=function(a,b){return b.subscribe(new d(a))};return a}(),d=function(a){function b(){a.apply(this,arguments)}q(b,a);b.prototype._next=function(a){p.noop()};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(512);h.Observable.prototype.isEmpty=a.isEmpty},function(h,f,a){var q=this&&this.__extends||function(a,
-b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);f.isEmpty=function(){return this.lift(new p)};var p=function(){function a(){}a.prototype.call=function(a,c){return c.subscribe(new n(a))};return a}(),n=function(a){function b(b){a.call(this,b)}q(b,a);b.prototype.notifyComplete=function(a){var b=this.destination;b.next(a);b.complete()};b.prototype._next=function(a){this.notifyComplete(!1)};
-b.prototype._complete=function(){this.notifyComplete(!0)};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(514);h.Observable.prototype.audit=a.audit},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(17),n=a(13);h=a(5);var d=a(6);f.audit=function(a){return this.lift(new b(a))};var b=function(){function a(a){this.durationSelector=a}a.prototype.call=
-function(a,b){return b.subscribe(new c(a,this.durationSelector))};return a}(),c=function(a){function b(b,c){a.call(this,b);this.durationSelector=c;this.hasValue=!1}q(b,a);b.prototype._next=function(a){this.value=a;this.hasValue=!0;this.throttled||(a=p.tryCatch(this.durationSelector)(a),a===n.errorObject?this.destination.error(n.errorObject.e):(a=d.subscribeToResult(this,a),a.closed?this.clearThrottle():this.add(this.throttled=a)))};b.prototype.clearThrottle=function(){var a=this.value,b=this.hasValue,
-c=this.throttled;c&&(this.remove(c),this.throttled=null,c.unsubscribe());b&&(this.value=null,this.hasValue=!1,this.destination.next(a))};b.prototype.notifyNext=function(a,b,c,d){this.clearThrottle()};b.prototype.notifyComplete=function(){this.clearThrottle()};return b}(h.OuterSubscriber)},function(h,f,a){h=a(0);a=a(516);h.Observable.prototype.auditTime=a.auditTime},function(h,f,a){function q(a){a.clearThrottle()}var p=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&
-(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},n=a(19);h=a(3);f.auditTime=function(a,b){void 0===b&&(b=n.async);return this.lift(new d(a,b))};var d=function(){function a(a,b){this.duration=a;this.scheduler=b}a.prototype.call=function(a,c){return c.subscribe(new b(a,this.duration,this.scheduler))};return a}(),b=function(a){function b(b,c,d){a.call(this,b);this.duration=c;this.scheduler=d;this.hasValue=!1}p(b,a);b.prototype._next=function(a){this.value=a;this.hasValue=
-!0;this.throttled||this.add(this.throttled=this.scheduler.schedule(q,this.duration,this))};b.prototype.clearThrottle=function(){var a=this.value,b=this.hasValue,c=this.throttled;c&&(this.remove(c),this.throttled=null,c.unsubscribe());b&&(this.value=null,this.hasValue=!1,this.destination.next(a))};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(518);h.Observable.prototype.last=a.last},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&
-(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(3);var p=a(94);f.last=function(a,c,d){return this.lift(new n(a,c,d,this))};var n=function(){function a(a,b,d,f){this.predicate=a;this.resultSelector=b;this.defaultValue=d;this.source=f}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.predicate,this.resultSelector,this.defaultValue,this.source))};return a}(),d=function(a){function b(b,c,d,f,h){a.call(this,b);this.predicate=c;this.resultSelector=d;this.defaultValue=
-f;this.source=h;this.hasValue=!1;this.index=0;"undefined"!==typeof f&&(this.lastValue=f,this.hasValue=!0)}q(b,a);b.prototype._next=function(a){var b=this.index++;this.predicate?this._tryPredicate(a,b):this.resultSelector?this._tryResultSelector(a,b):(this.lastValue=a,this.hasValue=!0)};b.prototype._tryPredicate=function(a,b){try{var c=this.predicate(a,b,this.source)}catch(k){this.destination.error(k);return}c&&(this.resultSelector?this._tryResultSelector(a,b):(this.lastValue=a,this.hasValue=!0))};
-b.prototype._tryResultSelector=function(a,b){try{var c=this.resultSelector(a,b)}catch(k){this.destination.error(k);return}this.lastValue=c;this.hasValue=!0};b.prototype._complete=function(){var a=this.destination;this.hasValue?(a.next(this.lastValue),a.complete()):a.error(new p.EmptyError)};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(520);h.Observable.prototype.let=a.letProto;h.Observable.prototype.letBind=a.letProto},function(h,f,a){f.letProto=function(a){return a(this)}},function(h,f,a){h=
-a(0);a=a(522);h.Observable.prototype.every=a.every},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);f.every=function(a,b){return this.lift(new p(a,b,this))};var p=function(){function a(a,c,d){this.predicate=a;this.thisArg=c;this.source=d}a.prototype.call=function(a,c){return c.subscribe(new n(a,this.predicate,this.thisArg,this.source))};
-return a}(),n=function(a){function b(b,d,g,f){a.call(this,b);this.predicate=d;this.thisArg=g;this.source=f;this.index=0;this.thisArg=g||this}q(b,a);b.prototype.notifyComplete=function(a){this.destination.next(a);this.destination.complete()};b.prototype._next=function(a){var b=!1;try{b=this.predicate.call(this.thisArg,a,this.index++,this.source)}catch(g){this.destination.error(g);return}b||this.notifyComplete(!1)};b.prototype._complete=function(){this.notifyComplete(!0)};return b}(h.Subscriber)},function(h,
-f,a){h=a(0);a=a(129);h.Observable.prototype.map=a.map},function(h,f,a){h=a(0);a=a(525);h.Observable.prototype.mapTo=a.mapTo},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);f.mapTo=function(a){return this.lift(new p(a))};var p=function(){function a(a){this.value=a}a.prototype.call=function(a,c){return c.subscribe(new n(a,this.value))};
-return a}(),n=function(a){function b(b,d){a.call(this,b);this.value=d}q(b,a);b.prototype._next=function(a){this.destination.next(this.value)};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(527);h.Observable.prototype.materialize=a.materialize},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(3);var p=a(69);f.materialize=function(){return this.lift(new n)};
-var n=function(){function a(){}a.prototype.call=function(a,b){return b.subscribe(new d(a))};return a}(),d=function(a){function b(b){a.call(this,b)}q(b,a);b.prototype._next=function(a){this.destination.next(p.Notification.createNext(a))};b.prototype._error=function(a){var b=this.destination;b.next(p.Notification.createError(a));b.complete()};b.prototype._complete=function(){var a=this.destination;a.next(p.Notification.createComplete());a.complete()};return b}(h.Subscriber)},function(h,f,a){h=a(0);
-a=a(529);h.Observable.prototype.max=a.max},function(h,f,a){var q=a(130);f.max=function(a){return this.lift(new q.ReduceOperator("function"===typeof a?function(f,d){return 0<a(f,d)?f:d}:function(a,d){return a>d?a:d}))}},function(h,f,a){h=a(0);a=a(203);h.Observable.prototype.merge=a.merge},function(h,f,a){h=a(0);a=a(90);h.Observable.prototype.mergeAll=a.mergeAll},function(h,f,a){h=a(0);a=a(209);h.Observable.prototype.mergeMap=a.mergeMap;h.Observable.prototype.flatMap=a.mergeMap},function(h,f,a){h=a(0);
-a=a(210);h.Observable.prototype.flatMapTo=a.mergeMapTo;h.Observable.prototype.mergeMapTo=a.mergeMapTo},function(h,f,a){h=a(0);a=a(535);h.Observable.prototype.mergeScan=a.mergeScan},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(17),n=a(13),d=a(6);h=a(5);f.mergeScan=function(a,c,d){void 0===d&&(d=Number.POSITIVE_INFINITY);return this.lift(new b(a,
-c,d))};var b=function(){function a(a,b,c){this.accumulator=a;this.seed=b;this.concurrent=c}a.prototype.call=function(a,b){return b.subscribe(new c(a,this.accumulator,this.seed,this.concurrent))};return a}();f.MergeScanOperator=b;var c=function(a){function b(b,c,d,e){a.call(this,b);this.accumulator=c;this.acc=d;this.concurrent=e;this.hasCompleted=this.hasValue=!1;this.buffer=[];this.index=this.active=0}q(b,a);b.prototype._next=function(a){if(this.active<this.concurrent){var b=this.index++,c=p.tryCatch(this.accumulator)(this.acc,
-a),d=this.destination;c===n.errorObject?d.error(n.errorObject.e):(this.active++,this._innerSub(c,a,b))}else this.buffer.push(a)};b.prototype._innerSub=function(a,b,c){this.add(d.subscribeToResult(this,a,b,c))};b.prototype._complete=function(){this.hasCompleted=!0;0===this.active&&0===this.buffer.length&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete())};b.prototype.notifyNext=function(a,b,c,d,e){a=this.destination;this.acc=b;this.hasValue=!0;a.next(b)};b.prototype.notifyComplete=
-function(a){var b=this.buffer;this.remove(a);this.active--;0<b.length?this._next(b.shift()):0===this.active&&this.hasCompleted&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete())};return b}(h.OuterSubscriber);f.MergeScanSubscriber=c},function(h,f,a){h=a(0);a=a(537);h.Observable.prototype.min=a.min},function(h,f,a){var q=a(130);f.min=function(a){return this.lift(new q.ReduceOperator("function"===typeof a?function(f,d){return 0>a(f,d)?f:d}:function(a,d){return a<d?a:d}))}},
-function(h,f,a){h=a(0);a=a(49);h.Observable.prototype.multicast=a.multicast},function(h,f,a){h=a(0);a=a(127);h.Observable.prototype.observeOn=a.observeOn},function(h,f,a){h=a(0);a=a(206);h.Observable.prototype.onErrorResumeNext=a.onErrorResumeNext},function(h,f,a){h=a(0);a=a(542);h.Observable.prototype.pairwise=a.pairwise},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):
-(c.prototype=b.prototype,new c)};h=a(3);f.pairwise=function(){return this.lift(new p)};var p=function(){function a(){}a.prototype.call=function(a,c){return c.subscribe(new n(a))};return a}(),n=function(a){function b(b){a.call(this,b);this.hasPrev=!1}q(b,a);b.prototype._next=function(a){this.hasPrev?this.destination.next([this.prev,a]):this.hasPrev=!0;this.prev=a};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(544);h.Observable.prototype.partition=a.partition},function(h,f,a){var q=a(545),p=a(212);
-f.partition=function(a,d){return[p.filter.call(this,a,d),p.filter.call(this,q.not(a,d))]}},function(h,f,a){f.not=function(a,f){function h(){return!h.pred.apply(h.thisArg,arguments)}h.pred=a;h.thisArg=f;return h}},function(h,f,a){h=a(0);a=a(547);h.Observable.prototype.pluck=a.pluck},function(h,f,a){function q(a,d){return function(b){var c=b;for(b=0;b<d;b++)if(c=c[a[b]],"undefined"===typeof c)return;return c}}var p=a(129);f.pluck=function(){for(var a=[],d=0;d<arguments.length;d++)a[d-0]=arguments[d];
-d=a.length;if(0===d)throw Error("list of properties cannot be empty.");return p.map.call(this,q(a,d))}},function(h,f,a){h=a(0);a=a(549);h.Observable.prototype.publish=a.publish},function(h,f,a){var q=a(12),p=a(49);f.publish=function(a){return a?p.multicast.call(this,function(){return new q.Subject},a):p.multicast.call(this,new q.Subject)}},function(h,f,a){h=a(0);a=a(551);h.Observable.prototype.publishBehavior=a.publishBehavior},function(h,f,a){var q=a(215),p=a(49);f.publishBehavior=function(a){return p.multicast.call(this,
-new q.BehaviorSubject(a))}},function(h,f,a){h=a(0);a=a(553);h.Observable.prototype.publishReplay=a.publishReplay},function(h,f,a){var q=a(93),p=a(49);f.publishReplay=function(a,d,b){void 0===a&&(a=Number.POSITIVE_INFINITY);void 0===d&&(d=Number.POSITIVE_INFINITY);return p.multicast.call(this,new q.ReplaySubject(a,d,b))}},function(h,f,a){h=a(0);a=a(555);h.Observable.prototype.publishLast=a.publishLast},function(h,f,a){var q=a(89),p=a(49);f.publishLast=function(){return p.multicast.call(this,new q.AsyncSubject)}},
-function(h,f,a){h=a(0);a=a(204);h.Observable.prototype.race=a.race},function(h,f,a){h=a(0);a=a(130);h.Observable.prototype.reduce=a.reduce},function(h,f,a){h=a(0);a=a(559);h.Observable.prototype.repeat=a.repeat},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(3);var p=a(42);f.repeat=function(a){void 0===a&&(a=-1);return 0===a?new p.EmptyObservable:
-0>a?this.lift(new n(-1,this)):this.lift(new n(a-1,this))};var n=function(){function a(a,b){this.count=a;this.source=b}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.count,this.source))};return a}(),d=function(a){function b(b,c,d){a.call(this,b);this.count=c;this.source=d}q(b,a);b.prototype.complete=function(){if(!this.isStopped){var b=this.source,c=this.count;if(0===c)return a.prototype.complete.call(this);-1<c&&(this.count=c-1);b.subscribe(this._unsubscribeAndRecycle())}};return b}(h.Subscriber)},
-function(h,f,a){h=a(0);a=a(561);h.Observable.prototype.repeatWhen=a.repeatWhen},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(12),n=a(17),d=a(13);h=a(5);var b=a(6);f.repeatWhen=function(a){return this.lift(new c(a))};var c=function(){function a(a){this.notifier=a}a.prototype.call=function(a,b){return b.subscribe(new e(a,this.notifier,
-b))};return a}(),e=function(a){function c(b,c,d){a.call(this,b);this.notifier=c;this.source=d;this.sourceIsBeingSubscribedTo=!0}q(c,a);c.prototype.notifyNext=function(a,b,c,d,e){this.sourceIsBeingSubscribedTo=!0;this.source.subscribe(this)};c.prototype.notifyComplete=function(b){if(!1===this.sourceIsBeingSubscribedTo)return a.prototype.complete.call(this)};c.prototype.complete=function(){this.sourceIsBeingSubscribedTo=!1;if(!this.isStopped){if(!this.retries)this.subscribeToRetries();else if(this.retriesSubscription.closed)return a.prototype.complete.call(this);
-this._unsubscribeAndRecycle();this.notifications.next()}};c.prototype._unsubscribe=function(){var a=this.notifications,b=this.retriesSubscription;a&&(a.unsubscribe(),this.notifications=null);b&&(b.unsubscribe(),this.retriesSubscription=null);this.retries=null};c.prototype._unsubscribeAndRecycle=function(){var b=this.notifications,c=this.retries,d=this.retriesSubscription;this.retriesSubscription=this.retries=this.notifications=null;a.prototype._unsubscribeAndRecycle.call(this);this.notifications=
-b;this.retries=c;this.retriesSubscription=d;return this};c.prototype.subscribeToRetries=function(){this.notifications=new p.Subject;var c=n.tryCatch(this.notifier)(this.notifications);if(c===d.errorObject)return a.prototype.complete.call(this);this.retries=c;this.retriesSubscription=b.subscribeToResult(this,c)};return c}(h.OuterSubscriber)},function(h,f,a){h=a(0);a=a(563);h.Observable.prototype.retry=a.retry},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=
-a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);f.retry=function(a){void 0===a&&(a=-1);return this.lift(new p(a,this))};var p=function(){function a(a,c){this.count=a;this.source=c}a.prototype.call=function(a,c){return c.subscribe(new n(a,this.count,this.source))};return a}(),n=function(a){function b(b,d,f){a.call(this,b);this.count=d;this.source=f}q(b,a);b.prototype.error=function(b){if(!this.isStopped){var c=this.source,
-d=this.count;if(0===d)return a.prototype.error.call(this,b);-1<d&&(this.count=d-1);c.subscribe(this._unsubscribeAndRecycle())}};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(565);h.Observable.prototype.retryWhen=a.retryWhen},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(12),n=a(17),d=a(13);h=a(5);var b=a(6);f.retryWhen=function(a){return this.lift(new c(a,
-this))};var c=function(){function a(a,b){this.notifier=a;this.source=b}a.prototype.call=function(a,b){return b.subscribe(new e(a,this.notifier,this.source))};return a}(),e=function(a){function c(b,c,d){a.call(this,b);this.notifier=c;this.source=d}q(c,a);c.prototype.error=function(c){if(!this.isStopped){var e=this.errors,f=this.retries,g=this.retriesSubscription;if(f)this.retriesSubscription=this.errors=null;else{e=new p.Subject;f=n.tryCatch(this.notifier)(e);if(f===d.errorObject)return a.prototype.error.call(this,
-d.errorObject.e);g=b.subscribeToResult(this,f)}this._unsubscribeAndRecycle();this.errors=e;this.retries=f;this.retriesSubscription=g;e.next(c)}};c.prototype._unsubscribe=function(){var a=this.errors,b=this.retriesSubscription;a&&(a.unsubscribe(),this.errors=null);b&&(b.unsubscribe(),this.retriesSubscription=null);this.retries=null};c.prototype.notifyNext=function(a,b,c,d,e){a=this.errors;b=this.retries;c=this.retriesSubscription;this.retriesSubscription=this.retries=this.errors=null;this._unsubscribeAndRecycle();
-this.errors=a;this.retries=b;this.retriesSubscription=c;this.source.subscribe(this)};return c}(h.OuterSubscriber)},function(h,f,a){h=a(0);a=a(567);h.Observable.prototype.sample=a.sample},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(5);var p=a(6);f.sample=function(a){return this.lift(new n(a))};var n=function(){function a(a){this.notifier=
-a}a.prototype.call=function(a,b){a=new d(a);b=b.subscribe(a);b.add(p.subscribeToResult(a,this.notifier));return b};return a}(),d=function(a){function b(){a.apply(this,arguments);this.hasValue=!1}q(b,a);b.prototype._next=function(a){this.value=a;this.hasValue=!0};b.prototype.notifyNext=function(a,b,c,d,f){this.emitValue()};b.prototype.notifyComplete=function(){this.emitValue()};b.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))};return b}(h.OuterSubscriber)},
-function(h,f,a){h=a(0);a=a(569);h.Observable.prototype.sampleTime=a.sampleTime},function(h,f,a){function q(a){var b=a.period;a.subscriber.notifyNext();this.schedule(a,b)}var p=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);var n=a(19);f.sampleTime=function(a,b){void 0===b&&(b=n.async);return this.lift(new d(a,b))};var d=function(){function a(a,b){this.period=
-a;this.scheduler=b}a.prototype.call=function(a,c){return c.subscribe(new b(a,this.period,this.scheduler))};return a}(),b=function(a){function b(b,c,d){a.call(this,b);this.period=c;this.scheduler=d;this.hasValue=!1;this.add(d.schedule(q,c,{subscriber:this,period:c}))}p(b,a);b.prototype._next=function(a){this.lastValue=a;this.hasValue=!0};b.prototype.notifyNext=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.lastValue))};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(571);
-h.Observable.prototype.scan=a.scan},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);f.scan=function(a,b){var c=!1;2<=arguments.length&&(c=!0);return this.lift(new p(a,b,c))};var p=function(){function a(a,c,d){void 0===d&&(d=!1);this.accumulator=a;this.seed=c;this.hasSeed=d}a.prototype.call=function(a,c){return c.subscribe(new n(a,this.accumulator,
-this.seed,this.hasSeed))};return a}(),n=function(a){function b(b,d,f,h){a.call(this,b);this.accumulator=d;this._seed=f;this.hasSeed=h;this.index=0}q(b,a);Object.defineProperty(b.prototype,"seed",{get:function(){return this._seed},set:function(a){this.hasSeed=!0;this._seed=a},enumerable:!0,configurable:!0});b.prototype._next=function(a){if(this.hasSeed)return this._tryNext(a);this.seed=a;this.destination.next(a)};b.prototype._tryNext=function(a){var b=this.index++;try{var c=this.accumulator(this.seed,
-a,b)}catch(l){this.destination.error(l)}this.seed=c;this.destination.next(c)};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(573);h.Observable.prototype.sequenceEqual=a.sequenceEqual},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);var p=a(17),n=a(13);f.sequenceEqual=function(a,b){return this.lift(new d(a,b))};var d=function(){function a(a,
-b){this.compareTo=a;this.comparor=b}a.prototype.call=function(a,c){return c.subscribe(new b(a,this.compareTo,this.comparor))};return a}();f.SequenceEqualOperator=d;var b=function(a){function b(b,d,e){a.call(this,b);this.compareTo=d;this.comparor=e;this._a=[];this._b=[];this._oneComplete=!1;this.add(d.subscribe(new c(b,this)))}q(b,a);b.prototype._next=function(a){this._oneComplete&&0===this._b.length?this.emit(!1):(this._a.push(a),this.checkValues())};b.prototype._complete=function(){this._oneComplete?
-this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0};b.prototype.checkValues=function(){for(var a=this._a,b=this._b,c=this.comparor;0<a.length&&0<b.length;){var d=a.shift(),e=b.shift();c?(d=p.tryCatch(c)(d,e),d===n.errorObject&&this.destination.error(n.errorObject.e)):d=d===e;d||this.emit(!1)}};b.prototype.emit=function(a){var b=this.destination;b.next(a);b.complete()};b.prototype.nextB=function(a){this._oneComplete&&0===this._a.length?this.emit(!1):(this._b.push(a),this.checkValues())};
-return b}(h.Subscriber);f.SequenceEqualSubscriber=b;var c=function(a){function b(b,c){a.call(this,b);this.parent=c}q(b,a);b.prototype._next=function(a){this.parent.nextB(a)};b.prototype._error=function(a){this.parent.error(a)};b.prototype._complete=function(){this.parent._complete()};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(575);h.Observable.prototype.share=a.share},function(h,f,a){function q(){return new n.Subject}var p=a(49),n=a(12);f.share=function(){return p.multicast.call(this,q).refCount()}},
-function(h,f,a){h=a(0);a=a(577);h.Observable.prototype.shareReplay=a.shareReplay},function(h,f,a){var q=a(49),p=a(93);f.shareReplay=function(a,d,b){var c;return q.multicast.call(this,function(){return this._isComplete?c:c=new p.ReplaySubject(a,d,b)}).refCount()}},function(h,f,a){h=a(0);a=a(579);h.Observable.prototype.single=a.single},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):
-(b.prototype=c.prototype,new b)};h=a(3);var p=a(94);f.single=function(a){return this.lift(new n(a,this))};var n=function(){function a(a,b){this.predicate=a;this.source=b}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.predicate,this.source))};return a}(),d=function(a){function b(b,c,d){a.call(this,b);this.predicate=c;this.source=d;this.seenValue=!1;this.index=0}q(b,a);b.prototype.applySingleValue=function(a){this.seenValue?this.destination.error("Sequence contains more than one element"):
-(this.seenValue=!0,this.singleValue=a)};b.prototype._next=function(a){var b=this.index++;this.predicate?this.tryNext(a,b):this.applySingleValue(a)};b.prototype.tryNext=function(a,b){try{this.predicate(a,b,this.source)&&this.applySingleValue(a)}catch(l){this.destination.error(l)}};b.prototype._complete=function(){var a=this.destination;0<this.index?(a.next(this.seenValue?this.singleValue:void 0),a.complete()):a.error(new p.EmptyError)};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(581);h.Observable.prototype.skip=
-a.skip},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);f.skip=function(a){return this.lift(new p(a))};var p=function(){function a(a){this.total=a}a.prototype.call=function(a,c){return c.subscribe(new n(a,this.total))};return a}(),n=function(a){function b(b,d){a.call(this,b);this.total=d;this.count=0}q(b,a);b.prototype._next=function(a){++this.count>
-this.total&&this.destination.next(a)};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(583);h.Observable.prototype.skipLast=a.skipLast},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(3),n=a(72);f.skipLast=function(a){return this.lift(new d(a))};var d=function(){function a(a){this._skipCount=a;if(0>this._skipCount)throw new n.ArgumentOutOfRangeError;
-}a.prototype.call=function(a,c){return 0===this._skipCount?c.subscribe(new p.Subscriber(a)):c.subscribe(new b(a,this._skipCount))};return a}(),b=function(a){function b(b,c){a.call(this,b);this._skipCount=c;this._count=0;this._ring=Array(c)}q(b,a);b.prototype._next=function(a){var b=this._skipCount,c=this._count++;if(c<b)this._ring[c]=a;else{b=c%b;c=this._ring;var d=c[b];c[b]=a;this.destination.next(d)}};return b}(p.Subscriber)},function(h,f,a){h=a(0);a=a(585);h.Observable.prototype.skipUntil=a.skipUntil},
-function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(5);var p=a(6);f.skipUntil=function(a){return this.lift(new n(a))};var n=function(){function a(a){this.notifier=a}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.notifier))};return a}(),d=function(a){function b(b,c){a.call(this,b);this.isInnerStopped=this.hasValue=!1;this.add(p.subscribeToResult(this,
-c))}q(b,a);b.prototype._next=function(b){this.hasValue&&a.prototype._next.call(this,b)};b.prototype._complete=function(){this.isInnerStopped?a.prototype._complete.call(this):this.unsubscribe()};b.prototype.notifyNext=function(a,b,c,d,f){this.hasValue=!0};b.prototype.notifyComplete=function(){this.isInnerStopped=!0;this.isStopped&&a.prototype._complete.call(this)};return b}(h.OuterSubscriber)},function(h,f,a){h=a(0);a=a(587);h.Observable.prototype.skipWhile=a.skipWhile},function(h,f,a){var q=this&&
-this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);f.skipWhile=function(a){return this.lift(new p(a))};var p=function(){function a(a){this.predicate=a}a.prototype.call=function(a,c){return c.subscribe(new n(a,this.predicate))};return a}(),n=function(a){function b(b,d){a.call(this,b);this.predicate=d;this.skipping=!0;this.index=0}q(b,a);b.prototype._next=function(a){var b=
-this.destination;this.skipping&&this.tryCallPredicate(a);this.skipping||b.next(a)};b.prototype.tryCallPredicate=function(a){try{this.skipping=!!this.predicate(a,this.index++)}catch(e){this.destination.error(e)}};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(589);h.Observable.prototype.startWith=a.startWith},function(h,f,a){var q=a(38),p=a(124),n=a(42),d=a(126),b=a(37);f.startWith=function(){for(var a=[],e=0;e<arguments.length;e++)a[e-0]=arguments[e];e=a[a.length-1];b.isScheduler(e)?a.pop():
-e=null;var f=a.length;return 1===f?d.concatStatic(new p.ScalarObservable(a[0],e),this):1<f?d.concatStatic(new q.ArrayObservable(a,e),this):d.concatStatic(new n.EmptyObservable(e),this)}},function(h,f,a){h=a(0);a=a(591);h.Observable.prototype.subscribeOn=a.subscribeOn},function(h,f,a){var q=a(592);f.subscribeOn=function(a,d){void 0===d&&(d=0);return this.lift(new p(a,d))};var p=function(){function a(a,b){this.scheduler=a;this.delay=b}a.prototype.call=function(a,b){return(new q.SubscribeOnObservable(b,
-this.delay,this.scheduler)).subscribe(a)};return a}()},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(0);var p=a(216),n=a(91);a=function(a){function b(b,d,f){void 0===d&&(d=0);void 0===f&&(f=p.asap);a.call(this);this.source=b;this.delayTime=d;this.scheduler=f;if(!n.isNumeric(d)||0>d)this.delayTime=0;f&&"function"===typeof f.schedule||
-(this.scheduler=p.asap)}q(b,a);b.create=function(a,d,f){void 0===d&&(d=0);void 0===f&&(f=p.asap);return new b(a,d,f)};b.dispatch=function(a){return this.add(a.source.subscribe(a.subscriber))};b.prototype._subscribe=function(a){return this.scheduler.schedule(b.dispatch,this.delayTime,{source:this.source,subscriber:a})};return b}(h.Observable);f.SubscribeOnObservable=a},function(h,f,a){var q=this&&this.__extends||function(a,d){function b(){this.constructor=a}for(var c in d)d.hasOwnProperty(c)&&(a[c]=
-d[c]);a.prototype=null===d?Object.create(d):(b.prototype=d.prototype,new b)},p=a(594);h=function(a){function d(b,c){a.call(this,b,c);this.scheduler=b;this.work=c}q(d,a);d.prototype.requestAsyncId=function(b,c,d){void 0===d&&(d=0);if(null!==d&&0<d)return a.prototype.requestAsyncId.call(this,b,c,d);b.actions.push(this);return b.scheduled||(b.scheduled=p.Immediate.setImmediate(b.flush.bind(b,null)))};d.prototype.recycleAsyncId=function(b,c,d){void 0===d&&(d=0);if(null!==d&&0<d||null===d&&0<this.delay)return a.prototype.recycleAsyncId.call(this,
-b,c,d);0===b.actions.length&&(p.Immediate.clearImmediate(c),b.scheduled=void 0)};return d}(a(70).AsyncAction);f.AsapAction=h},function(h,f,a){(function(h,p){h=a(16);p=function(){function a(a){this.root=a;a.setImmediate&&"function"===typeof a.setImmediate?(this.setImmediate=a.setImmediate.bind(a),this.clearImmediate=a.clearImmediate.bind(a)):(this.nextHandle=1,this.tasksByHandle={},this.currentlyRunningATask=!1,this.canUseProcessNextTick()?this.setImmediate=this.createProcessNextTickSetImmediate():
-this.canUsePostMessage()?this.setImmediate=this.createPostMessageSetImmediate():this.canUseMessageChannel()?this.setImmediate=this.createMessageChannelSetImmediate():this.canUseReadyStateChange()?this.setImmediate=this.createReadyStateChangeSetImmediate():this.setImmediate=this.createSetTimeoutSetImmediate(),a=function c(a){delete c.instance.tasksByHandle[a]},a.instance=this,this.clearImmediate=a)}a.prototype.identify=function(a){return this.root.Object.prototype.toString.call(a)};a.prototype.canUseProcessNextTick=
-function(){return"[object process]"===this.identify(this.root.process)};a.prototype.canUseMessageChannel=function(){return!!this.root.MessageChannel};a.prototype.canUseReadyStateChange=function(){var a=this.root.document;return!!(a&&"onreadystatechange"in a.createElement("script"))};a.prototype.canUsePostMessage=function(){var a=this.root;if(a.postMessage&&!a.importScripts){var b=!0,c=a.onmessage;a.onmessage=function(){b=!1};a.postMessage("","*");a.onmessage=c;return b}return!1};a.prototype.partiallyApplied=
-function(a){for(var b=[],c=1;c<arguments.length;c++)b[c-1]=arguments[c];c=function g(){var a=g.handler,b=g.args;"function"===typeof a?a.apply(void 0,b):(new Function(""+a))()};c.handler=a;c.args=b;return c};a.prototype.addFromSetImmediateArguments=function(a){this.tasksByHandle[this.nextHandle]=this.partiallyApplied.apply(void 0,a);return this.nextHandle++};a.prototype.createProcessNextTickSetImmediate=function(){var a=function c(){var a=c.instance,d=a.addFromSetImmediateArguments(arguments);a.root.process.nextTick(a.partiallyApplied(a.runIfPresent,
-d));return d};a.instance=this;return a};a.prototype.createPostMessageSetImmediate=function(){var a=this.root,b="setImmediate$"+a.Math.random()+"$",c=function g(c){var d=g.instance;c.source===a&&"string"===typeof c.data&&0===c.data.indexOf(b)&&d.runIfPresent(+c.data.slice(b.length))};c.instance=this;a.addEventListener("message",c,!1);c=function l(){var a=l,b=a.messagePrefix;a=a.instance;var c=a.addFromSetImmediateArguments(arguments);a.root.postMessage(b+c,"*");return c};c.instance=this;c.messagePrefix=
-b;return c};a.prototype.runIfPresent=function(a){if(this.currentlyRunningATask)this.root.setTimeout(this.partiallyApplied(this.runIfPresent,a),0);else{var b=this.tasksByHandle[a];if(b){this.currentlyRunningATask=!0;try{b()}finally{this.clearImmediate(a),this.currentlyRunningATask=!1}}}};a.prototype.createMessageChannelSetImmediate=function(){var a=this,b=new this.root.MessageChannel;b.port1.onmessage=function(b){a.runIfPresent(b.data)};var c=function g(){var a=g,b=a.channel;a=a.instance.addFromSetImmediateArguments(arguments);
-b.port2.postMessage(a);return a};c.channel=b;c.instance=this;return c};a.prototype.createReadyStateChangeSetImmediate=function(){var a=function c(){var a=c.instance,d=a.root.document,f=d.documentElement,h=a.addFromSetImmediateArguments(arguments),n=d.createElement("script");n.onreadystatechange=function(){a.runIfPresent(h);n.onreadystatechange=null;f.removeChild(n);n=null};f.appendChild(n);return h};a.instance=this;return a};a.prototype.createSetTimeoutSetImmediate=function(){var a=function c(){var a=
-c.instance,d=a.addFromSetImmediateArguments(arguments);a.root.setTimeout(a.partiallyApplied(a.runIfPresent,d),0);return d};a.instance=this;return a};return a}();f.ImmediateDefinition=p;f.Immediate=new p(h.root)}).call(f,a(217).clearImmediate,a(217).setImmediate)},function(h,f,a){(function(a,f){(function(a,d){function b(a){delete p[a]}function c(a){if(v)setTimeout(c,0,a);else{var e=p[a];if(e){v=!0;try{var f=e.callback,g=e.args;switch(g.length){case 0:f();break;case 1:f(g[0]);break;case 2:f(g[0],g[1]);
-break;case 3:f(g[0],g[1],g[2]);break;default:f.apply(d,g)}}finally{b(a),v=!1}}}}function e(){y=function(a){f.nextTick(function(){c(a)})}}function g(){if(a.postMessage&&!a.importScripts){var b=!0,c=a.onmessage;a.onmessage=function(){b=!1};a.postMessage("","*");a.onmessage=c;return b}}function h(){var b="setImmediate$"+Math.random()+"$",d=function(d){d.source===a&&"string"===typeof d.data&&0===d.data.indexOf(b)&&c(+d.data.slice(b.length))};a.addEventListener?a.addEventListener("message",d,!1):a.attachEvent("onmessage",
-d);y=function(c){a.postMessage(b+c,"*")}}function k(){var a=new MessageChannel;a.port1.onmessage=function(a){c(a.data)};y=function(b){a.port2.postMessage(b)}}function n(){var a=w.documentElement;y=function(b){var d=w.createElement("script");d.onreadystatechange=function(){c(b);d.onreadystatechange=null;a.removeChild(d);d=null};a.appendChild(d)}}function m(){y=function(a){setTimeout(c,0,a)}}if(!a.setImmediate){var q=1,p={},v=!1,w=a.document,y,x=Object.getPrototypeOf&&Object.getPrototypeOf(a);x=x&&
-x.setTimeout?x:a;"[object process]"==={}.toString.call(a.process)?e():g()?h():a.MessageChannel?k():w&&"onreadystatechange"in w.createElement("script")?n():m();x.setImmediate=function(a){"function"!==typeof a&&(a=new Function(""+a));for(var b=Array(arguments.length-1),c=0;c<b.length;c++)b[c]=arguments[c+1];p[q]={callback:a,args:b};y(q);return q++};x.clearImmediate=b}})("undefined"===typeof self?"undefined"===typeof a?this:a:self)}).call(f,a(74),a(596))},function(h,f){function a(){throw Error("setTimeout has not been defined");
-}function q(){throw Error("clearTimeout has not been defined");}function p(b){if(g===setTimeout)return setTimeout(b,0);if((g===a||!g)&&setTimeout)return g=setTimeout,setTimeout(b,0);try{return g(b,0)}catch(v){try{return g.call(null,b,0)}catch(w){return g.call(this,b,0)}}}function n(a){if(l===clearTimeout)return clearTimeout(a);if((l===q||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(a);try{return l(a)}catch(v){try{return l.call(null,a)}catch(w){return l.call(this,a)}}}function d(){t&&m&&(t=
-!1,m.length?k=m.concat(k):r=-1,k.length&&b())}function b(){if(!t){var a=p(d);t=!0;for(var b=k.length;b;){m=k;for(k=[];++r<b;)m&&m[r].run();r=-1;b=k.length}m=null;t=!1;n(a)}}function c(a,b){this.fun=a;this.array=b}function e(){}h=h.exports={};try{var g="function"===typeof setTimeout?setTimeout:a}catch(u){g=a}try{var l="function"===typeof clearTimeout?clearTimeout:q}catch(u){l=q}var k=[],t=!1,m,r=-1;h.nextTick=function(a){var d=Array(arguments.length-1);if(1<arguments.length)for(var e=1;e<arguments.length;e++)d[e-
-1]=arguments[e];k.push(new c(a,d));1!==k.length||t||p(b)};c.prototype.run=function(){this.fun.apply(null,this.array)};h.title="browser";h.browser=!0;h.env={};h.argv=[];h.version="";h.versions={};h.on=e;h.addListener=e;h.once=e;h.off=e;h.removeListener=e;h.removeAllListeners=e;h.emit=e;h.prependListener=e;h.prependOnceListener=e;h.listeners=function(a){return[]};h.binding=function(a){throw Error("process.binding is not supported");};h.cwd=function(){return"/"};h.chdir=function(a){throw Error("process.chdir is not supported");
-};h.umask=function(){return 0}},function(h,f,a){var q=this&&this.__extends||function(a,f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(){a.apply(this,arguments)}q(f,a);f.prototype.flush=function(a){this.active=!0;this.scheduled=void 0;var b=this.actions,c,d=-1,f=b.length;a=a||b.shift();do if(c=a.execute(a.state,a.delay))break;while(++d<f&&(a=b.shift()));this.active=!1;
-if(c){for(;++d<f&&(a=b.shift());)a.unsubscribe();throw c;}};return f}(a(71).AsyncScheduler);f.AsapScheduler=h},function(h,f,a){h=a(0);a=a(599);h.Observable.prototype.switch=a._switch;h.Observable.prototype._switch=a._switch},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(5);var p=a(6);f._switch=function(){return this.lift(new n)};var n=
-function(){function a(){}a.prototype.call=function(a,b){return b.subscribe(new d(a))};return a}(),d=function(a){function b(b){a.call(this,b);this.active=0;this.hasCompleted=!1}q(b,a);b.prototype._next=function(a){this.unsubscribeInner();this.active++;this.add(this.innerSubscription=p.subscribeToResult(this,a))};b.prototype._complete=function(){this.hasCompleted=!0;0===this.active&&this.destination.complete()};b.prototype.unsubscribeInner=function(){this.active=0<this.active?this.active-1:0;var a=
-this.innerSubscription;a&&(a.unsubscribe(),this.remove(a))};b.prototype.notifyNext=function(a,b,c,d,f){this.destination.next(b)};b.prototype.notifyError=function(a){this.destination.error(a)};b.prototype.notifyComplete=function(){this.unsubscribeInner();this.hasCompleted&&0===this.active&&this.destination.complete()};return b}(h.OuterSubscriber)},function(h,f,a){h=a(0);a=a(601);h.Observable.prototype.switchMap=a.switchMap},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=
-a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(5);var p=a(6);f.switchMap=function(a,c){return this.lift(new n(a,c))};var n=function(){function a(a,b){this.project=a;this.resultSelector=b}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.project,this.resultSelector))};return a}(),d=function(a){function b(b,c,d){a.call(this,b);this.project=c;this.resultSelector=d;this.index=0}q(b,a);b.prototype._next=function(a){var b=
-this.index++;try{var c=this.project(a,b)}catch(k){this.destination.error(k);return}this._innerSub(c,a,b)};b.prototype._innerSub=function(a,b,c){var d=this.innerSubscription;d&&d.unsubscribe();this.add(this.innerSubscription=p.subscribeToResult(this,a,b,c))};b.prototype._complete=function(){var b=this.innerSubscription;b&&!b.closed||a.prototype._complete.call(this)};b.prototype._unsubscribe=function(){this.innerSubscription=null};b.prototype.notifyComplete=function(b){this.remove(b);this.innerSubscription=
-null;this.isStopped&&a.prototype._complete.call(this)};b.prototype.notifyNext=function(a,b,c,d,f){this.resultSelector?this._tryNotifyNext(a,b,c,d):this.destination.next(b)};b.prototype._tryNotifyNext=function(a,b,c,d){try{var e=this.resultSelector(a,b,c,d)}catch(m){this.destination.error(m);return}this.destination.next(e)};return b}(h.OuterSubscriber)},function(h,f,a){h=a(0);a=a(603);h.Observable.prototype.switchMapTo=a.switchMapTo},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=
-a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(5);var p=a(6);f.switchMapTo=function(a,c){return this.lift(new n(a,c))};var n=function(){function a(a,b){this.observable=a;this.resultSelector=b}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.observable,this.resultSelector))};return a}(),d=function(a){function b(b,c,d){a.call(this,b);this.inner=c;this.resultSelector=d;this.index=0}q(b,a);b.prototype._next=function(a){var b=
-this.innerSubscription;b&&b.unsubscribe();this.add(this.innerSubscription=p.subscribeToResult(this,this.inner,a,this.index++))};b.prototype._complete=function(){var b=this.innerSubscription;b&&!b.closed||a.prototype._complete.call(this)};b.prototype._unsubscribe=function(){this.innerSubscription=null};b.prototype.notifyComplete=function(b){this.remove(b);this.innerSubscription=null;this.isStopped&&a.prototype._complete.call(this)};b.prototype.notifyNext=function(a,b,c,d,f){f=this.destination;this.resultSelector?
-this.tryResultSelector(a,b,c,d):f.next(b)};b.prototype.tryResultSelector=function(a,b,c,d){var e=this.resultSelector,f=this.destination;try{var g=e(a,b,c,d)}catch(u){f.error(u);return}f.next(g)};return b}(h.OuterSubscriber)},function(h,f,a){h=a(0);a=a(605);h.Observable.prototype.take=a.take},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};
-h=a(3);var p=a(72),n=a(42);f.take=function(a){return 0===a?new n.EmptyObservable:this.lift(new d(a))};var d=function(){function a(a){this.total=a;if(0>this.total)throw new p.ArgumentOutOfRangeError;}a.prototype.call=function(a,c){return c.subscribe(new b(a,this.total))};return a}(),b=function(a){function b(b,c){a.call(this,b);this.total=c;this.count=0}q(b,a);b.prototype._next=function(a){var b=this.total,c=++this.count;c<=b&&(this.destination.next(a),c===b&&(this.destination.complete(),this.unsubscribe()))};
-return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(607);h.Observable.prototype.takeLast=a.takeLast},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);var p=a(72),n=a(42);f.takeLast=function(a){return 0===a?new n.EmptyObservable:this.lift(new d(a))};var d=function(){function a(a){this.total=a;if(0>this.total)throw new p.ArgumentOutOfRangeError;
-}a.prototype.call=function(a,c){return c.subscribe(new b(a,this.total))};return a}(),b=function(a){function b(b,c){a.call(this,b);this.total=c;this.ring=[];this.count=0}q(b,a);b.prototype._next=function(a){var b=this.ring,c=this.total,d=this.count++;b.length<c?b.push(a):b[d%c]=a};b.prototype._complete=function(){var a=this.destination,b=this.count;if(0<b)for(var c=this.count>=this.total?this.total:this.count,d=this.ring,e=0;e<c;e++){var f=b++%c;a.next(d[f])}a.complete()};return b}(h.Subscriber)},
-function(h,f,a){h=a(0);a=a(609);h.Observable.prototype.takeUntil=a.takeUntil},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(5);var p=a(6);f.takeUntil=function(a){return this.lift(new n(a))};var n=function(){function a(a){this.notifier=a}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.notifier))};return a}(),d=function(a){function b(b,
-c){a.call(this,b);this.notifier=c;this.add(p.subscribeToResult(this,c))}q(b,a);b.prototype.notifyNext=function(a,b,c,d,f){this.complete()};b.prototype.notifyComplete=function(){};return b}(h.OuterSubscriber)},function(h,f,a){h=a(0);a=a(611);h.Observable.prototype.takeWhile=a.takeWhile},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);
-f.takeWhile=function(a){return this.lift(new p(a))};var p=function(){function a(a){this.predicate=a}a.prototype.call=function(a,c){return c.subscribe(new n(a,this.predicate))};return a}(),n=function(a){function b(b,d){a.call(this,b);this.predicate=d;this.index=0}q(b,a);b.prototype._next=function(a){var b=this.destination;try{var c=this.predicate(a,this.index++)}catch(l){b.error(l);return}this.nextOrComplete(a,c)};b.prototype.nextOrComplete=function(a,b){var c=this.destination;b?c.next(a):c.complete()};
-return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(218);h.Observable.prototype.throttle=a.throttle},function(h,f,a){h=a(0);a=a(614);h.Observable.prototype.throttleTime=a.throttleTime},function(h,f,a){function q(a){a.subscriber.clearThrottle()}var p=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);var n=a(19),d=a(218);f.throttleTime=function(a,c,f){void 0===
-c&&(c=n.async);void 0===f&&(f=d.defaultThrottleConfig);return this.lift(new b(a,c,f.leading,f.trailing))};var b=function(){function a(a,b,c,d){this.duration=a;this.scheduler=b;this.leading=c;this.trailing=d}a.prototype.call=function(a,b){return b.subscribe(new c(a,this.duration,this.scheduler,this.leading,this.trailing))};return a}(),c=function(a){function b(b,c,d,e,f){a.call(this,b);this.duration=c;this.scheduler=d;this.leading=e;this.trailing=f;this._hasTrailingValue=!1;this._trailingValue=null}
-p(b,a);b.prototype._next=function(a){this.throttled?this.trailing&&(this._trailingValue=a,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(q,this.duration,{subscriber:this})),this.leading&&this.destination.next(a))};b.prototype.clearThrottle=function(){var a=this.throttled;a&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),a.unsubscribe(),this.remove(a),this.throttled=null)};return b}(h.Subscriber)},
-function(h,f,a){h=a(0);a=a(219);h.Observable.prototype.timeInterval=a.timeInterval},function(h,f,a){h=a(0);a=a(617);h.Observable.prototype.timeout=a.timeout},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(19),n=a(92);h=a(3);var d=a(220);f.timeout=function(a,c){void 0===c&&(c=p.async);var e=n.isDate(a);a=e?+a-c.now():Math.abs(a);return this.lift(new b(a,
-e,c,new d.TimeoutError))};var b=function(){function a(a,b,c,d){this.waitFor=a;this.absoluteTimeout=b;this.scheduler=c;this.errorInstance=d}a.prototype.call=function(a,b){return b.subscribe(new c(a,this.absoluteTimeout,this.waitFor,this.scheduler,this.errorInstance))};return a}(),c=function(a){function b(b,c,d,e,f){a.call(this,b);this.absoluteTimeout=c;this.waitFor=d;this.scheduler=e;this.errorInstance=f;this.action=null;this.scheduleTimeout()}q(b,a);b.dispatchTimeout=function(a){a.error(a.errorInstance)};
-b.prototype.scheduleTimeout=function(){var a=this.action;a?this.action=a.schedule(this,this.waitFor):this.add(this.action=this.scheduler.schedule(b.dispatchTimeout,this.waitFor,this))};b.prototype._next=function(b){this.absoluteTimeout||this.scheduleTimeout();a.prototype._next.call(this,b)};b.prototype._unsubscribe=function(){this.errorInstance=this.scheduler=this.action=null};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(619);h.Observable.prototype.timeoutWith=a.timeoutWith},function(h,f,a){var q=
-this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(19),n=a(92);h=a(5);var d=a(6);f.timeoutWith=function(a,c,d){void 0===d&&(d=p.async);var e=n.isDate(a);a=e?+a-d.now():Math.abs(a);return this.lift(new b(a,e,c,d))};var b=function(){function a(a,b,c,d){this.waitFor=a;this.absoluteTimeout=b;this.withObservable=c;this.scheduler=d}a.prototype.call=function(a,b){return b.subscribe(new c(a,
-this.absoluteTimeout,this.waitFor,this.withObservable,this.scheduler))};return a}(),c=function(a){function b(b,c,d,e,f){a.call(this,b);this.absoluteTimeout=c;this.waitFor=d;this.withObservable=e;this.scheduler=f;this.action=null;this.scheduleTimeout()}q(b,a);b.dispatchTimeout=function(a){var b=a.withObservable;a._unsubscribeAndRecycle();a.add(d.subscribeToResult(a,b))};b.prototype.scheduleTimeout=function(){var a=this.action;a?this.action=a.schedule(this,this.waitFor):this.add(this.action=this.scheduler.schedule(b.dispatchTimeout,
-this.waitFor,this))};b.prototype._next=function(b){this.absoluteTimeout||this.scheduleTimeout();a.prototype._next.call(this,b)};b.prototype._unsubscribe=function(){this.withObservable=this.scheduler=this.action=null};return b}(h.OuterSubscriber)},function(h,f,a){h=a(0);a=a(221);h.Observable.prototype.timestamp=a.timestamp},function(h,f,a){h=a(0);a=a(622);h.Observable.prototype.toArray=a.toArray},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&
-(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(3);f.toArray=function(){return this.lift(new p)};var p=function(){function a(){}a.prototype.call=function(a,c){return c.subscribe(new n(a))};return a}(),n=function(a){function b(b){a.call(this,b);this.array=[]}q(b,a);b.prototype._next=function(a){this.array.push(a)};b.prototype._complete=function(){this.destination.next(this.array);this.destination.complete()};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(624);
-h.Observable.prototype.toPromise=a.toPromise},function(h,f,a){var q=a(16);f.toPromise=function(a){var f=this;a||(q.root.Rx&&q.root.Rx.config&&q.root.Rx.config.Promise?a=q.root.Rx.config.Promise:q.root.Promise&&(a=q.root.Promise));if(!a)throw Error("no Promise impl found");return new a(function(a,b){var c;f.subscribe(function(a){return c=a},function(a){return b(a)},function(){return a(c)})})}},function(h,f,a){h=a(0);a=a(626);h.Observable.prototype.window=a.window},function(h,f,a){var q=this&&this.__extends||
-function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(12);h=a(5);var n=a(6);f.window=function(a){return this.lift(new d(a))};var d=function(){function a(a){this.windowBoundaries=a}a.prototype.call=function(a,c){a=new b(a);c=c.subscribe(a);c.closed||a.add(n.subscribeToResult(a,this.windowBoundaries));return c};return a}(),b=function(a){function b(b){a.call(this,b);this.window=new p.Subject;
-b.next(this.window)}q(b,a);b.prototype.notifyNext=function(a,b,c,d,e){this.openWindow()};b.prototype.notifyError=function(a,b){this._error(a)};b.prototype.notifyComplete=function(a){this._complete()};b.prototype._next=function(a){this.window.next(a)};b.prototype._error=function(a){this.window.error(a);this.destination.error(a)};b.prototype._complete=function(){this.window.complete();this.destination.complete()};b.prototype._unsubscribe=function(){this.window=null};b.prototype.openWindow=function(){var a=
-this.window;a&&a.complete();a=this.destination;var b=this.window=new p.Subject;a.next(b)};return b}(h.OuterSubscriber)},function(h,f,a){h=a(0);a=a(628);h.Observable.prototype.windowCount=a.windowCount},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(3);var p=a(12);f.windowCount=function(a,c){void 0===c&&(c=0);return this.lift(new n(a,
-c))};var n=function(){function a(a,b){this.windowSize=a;this.startWindowEvery=b}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.windowSize,this.startWindowEvery))};return a}(),d=function(a){function b(b,c,d){a.call(this,b);this.destination=b;this.windowSize=c;this.startWindowEvery=d;this.windows=[new p.Subject];this.count=0;b.next(this.windows[0])}q(b,a);b.prototype._next=function(a){for(var b=0<this.startWindowEvery?this.startWindowEvery:this.windowSize,c=this.destination,d=this.windowSize,
-e=this.windows,f=e.length,h=0;h<f&&!this.closed;h++)e[h].next(a);a=this.count-d+1;0<=a&&0===a%b&&!this.closed&&e.shift().complete();0!==++this.count%b||this.closed||(b=new p.Subject,e.push(b),c.next(b))};b.prototype._error=function(a){var b=this.windows;if(b)for(;0<b.length&&!this.closed;)b.shift().error(a);this.destination.error(a)};b.prototype._complete=function(){var a=this.windows;if(a)for(;0<a.length&&!this.closed;)a.shift().complete();this.destination.complete()};b.prototype._unsubscribe=function(){this.count=
-0;this.windows=null};return b}(h.Subscriber)},function(h,f,a){h=a(0);a=a(630);h.Observable.prototype.windowTime=a.windowTime},function(h,f,a){function q(a){var b=a.subscriber,c=a.windowTimeSpan,d=a.window;d&&b.closeWindow(d);a.window=b.openWindow();this.schedule(a,c)}function p(a){var b=a.windowTimeSpan,c=a.subscriber,d=a.scheduler,e=a.windowCreationInterval,f=c.openWindow(),g={action:this,subscription:null};g.subscription=d.schedule(n,b,{subscriber:c,window:f,context:g});this.add(g.subscription);
-this.schedule(a,e)}function n(a){var b=a.subscriber,c=a.window;(a=a.context)&&a.action&&a.subscription&&a.action.remove(a.subscription);b.closeWindow(c)}var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};h=a(12);var b=a(19),c=a(3),e=a(91),g=a(37);f.windowTime=function(a,c,d,f){var h=b.async,k=null,m=Number.POSITIVE_INFINITY;g.isScheduler(f)&&(h=f);g.isScheduler(d)?
-h=d:e.isNumeric(d)&&(m=d);g.isScheduler(c)?h=c:e.isNumeric(c)&&(k=c);return this.lift(new l(a,k,m,h))};var l=function(){function a(a,b,c,d){this.windowTimeSpan=a;this.windowCreationInterval=b;this.maxWindowSize=c;this.scheduler=d}a.prototype.call=function(a,b){return b.subscribe(new t(a,this.windowTimeSpan,this.windowCreationInterval,this.maxWindowSize,this.scheduler))};return a}(),k=function(a){function b(){a.apply(this,arguments);this._numberOfNextedValues=0}d(b,a);b.prototype.next=function(b){this._numberOfNextedValues++;
-a.prototype.next.call(this,b)};Object.defineProperty(b.prototype,"numberOfNextedValues",{get:function(){return this._numberOfNextedValues},enumerable:!0,configurable:!0});return b}(h.Subject),t=function(a){function b(b,c,d,e,f){a.call(this,b);this.destination=b;this.windowTimeSpan=c;this.windowCreationInterval=d;this.maxWindowSize=e;this.scheduler=f;this.windows=[];b=this.openWindow();null!==d&&0<=d?(e={windowTimeSpan:c,windowCreationInterval:d,subscriber:this,scheduler:f},this.add(f.schedule(n,c,
-{subscriber:this,window:b,context:null})),this.add(f.schedule(p,d,e))):this.add(f.schedule(q,c,{subscriber:this,window:b,windowTimeSpan:c}))}d(b,a);b.prototype._next=function(a){for(var b=this.windows,c=b.length,d=0;d<c;d++){var e=b[d];e.closed||(e.next(a),e.numberOfNextedValues>=this.maxWindowSize&&this.closeWindow(e))}};b.prototype._error=function(a){for(var b=this.windows;0<b.length;)b.shift().error(a);this.destination.error(a)};b.prototype._complete=function(){for(var a=this.windows;0<a.length;){var b=
-a.shift();b.closed||b.complete()}this.destination.complete()};b.prototype.openWindow=function(){var a=new k;this.windows.push(a);this.destination.next(a);return a};b.prototype.closeWindow=function(a){a.complete();var b=this.windows;b.splice(b.indexOf(a),1)};return b}(c.Subscriber)},function(h,f,a){h=a(0);a=a(632);h.Observable.prototype.windowToggle=a.windowToggle},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);
-a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(12),n=a(11),d=a(17),b=a(13);h=a(5);var c=a(6);f.windowToggle=function(a,b){return this.lift(new e(a,b))};var e=function(){function a(a,b){this.openings=a;this.closingSelector=b}a.prototype.call=function(a,b){return b.subscribe(new g(a,this.openings,this.closingSelector))};return a}(),g=function(a){function e(b,d,e){a.call(this,b);this.openings=d;this.closingSelector=e;this.contexts=[];this.add(this.openSubscription=c.subscribeToResult(this,
-d,d))}q(e,a);e.prototype._next=function(a){var b=this.contexts;if(b)for(var c=b.length,d=0;d<c;d++)b[d].window.next(a)};e.prototype._error=function(b){var c=this.contexts;this.contexts=null;if(c)for(var d=c.length,e=-1;++e<d;){var f=c[e];f.window.error(b);f.subscription.unsubscribe()}a.prototype._error.call(this,b)};e.prototype._complete=function(){var b=this.contexts;this.contexts=null;if(b)for(var c=b.length,d=-1;++d<c;){var e=b[d];e.window.complete();e.subscription.unsubscribe()}a.prototype._complete.call(this)};
-e.prototype._unsubscribe=function(){var a=this.contexts;this.contexts=null;if(a)for(var b=a.length,c=-1;++c<b;){var d=a[c];d.window.unsubscribe();d.subscription.unsubscribe()}};e.prototype.notifyNext=function(a,e,f,g,h){if(a===this.openings){g=d.tryCatch(this.closingSelector)(e);if(g===b.errorObject)return this.error(b.errorObject.e);a=new p.Subject;e=new n.Subscription;f={window:a,subscription:e};this.contexts.push(f);g=c.subscribeToResult(this,g,f);g.closed?this.closeWindow(this.contexts.length-
-1):(g.context=f,e.add(g));this.destination.next(a)}else this.closeWindow(this.contexts.indexOf(a))};e.prototype.notifyError=function(a){this.error(a)};e.prototype.notifyComplete=function(a){a!==this.openSubscription&&this.closeWindow(this.contexts.indexOf(a.context))};e.prototype.closeWindow=function(a){if(-1!==a){var b=this.contexts,c=b[a],d=c.window;c=c.subscription;b.splice(a,1);d.complete();c.unsubscribe()}};return e}(h.OuterSubscriber)},function(h,f,a){h=a(0);a=a(634);h.Observable.prototype.windowWhen=
-a.windowWhen},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(12),n=a(17),d=a(13);h=a(5);var b=a(6);f.windowWhen=function(a){return this.lift(new c(a))};var c=function(){function a(a){this.closingSelector=a}a.prototype.call=function(a,b){return b.subscribe(new e(a,this.closingSelector))};return a}(),e=function(a){function c(b,c){a.call(this,
-b);this.destination=b;this.closingSelector=c;this.openWindow()}q(c,a);c.prototype.notifyNext=function(a,b,c,d,e){this.openWindow(e)};c.prototype.notifyError=function(a,b){this._error(a)};c.prototype.notifyComplete=function(a){this.openWindow(a)};c.prototype._next=function(a){this.window.next(a)};c.prototype._error=function(a){this.window.error(a);this.destination.error(a);this.unsubscribeClosingNotification()};c.prototype._complete=function(){this.window.complete();this.destination.complete();this.unsubscribeClosingNotification()};
-c.prototype.unsubscribeClosingNotification=function(){this.closingNotification&&this.closingNotification.unsubscribe()};c.prototype.openWindow=function(a){void 0===a&&(a=null);a&&(this.remove(a),a.unsubscribe());(a=this.window)&&a.complete();a=this.window=new p.Subject;this.destination.next(a);a=n.tryCatch(this.closingSelector)();a===d.errorObject?(a=d.errorObject.e,this.destination.error(a),this.window.error(a)):this.add(this.closingNotification=b.subscribeToResult(this,a))};return c}(h.OuterSubscriber)},
-function(h,f,a){h=a(0);a=a(636);h.Observable.prototype.withLatestFrom=a.withLatestFrom},function(h,f,a){var q=this&&this.__extends||function(a,c){function b(){this.constructor=a}for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);a.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)};h=a(5);var p=a(6);f.withLatestFrom=function(){for(var a=[],c=0;c<arguments.length;c++)a[c-0]=arguments[c];var d;"function"===typeof a[a.length-1]&&(d=a.pop());return this.lift(new n(a,d))};var n=function(){function a(a,
-b){this.observables=a;this.project=b}a.prototype.call=function(a,b){return b.subscribe(new d(a,this.observables,this.project))};return a}(),d=function(a){function b(b,c,d){a.call(this,b);this.observables=c;this.project=d;this.toRespond=[];b=c.length;this.values=Array(b);for(d=0;d<b;d++)this.toRespond.push(d);for(d=0;d<b;d++){var e=c[d];this.add(p.subscribeToResult(this,e,e,d))}}q(b,a);b.prototype.notifyNext=function(a,b,c,d,f){this.values[c]=b;a=this.toRespond;0<a.length&&(c=a.indexOf(c),-1!==c&&
-a.splice(c,1))};b.prototype.notifyComplete=function(){};b.prototype._next=function(a){0===this.toRespond.length&&(a=[a].concat(this.values),this.project?this._tryProject(a):this.destination.next(a))};b.prototype._tryProject=function(a){try{var b=this.project.apply(this,a)}catch(l){this.destination.error(l);return}this.destination.next(b)};return b}(h.OuterSubscriber)},function(h,f,a){h=a(0);a=a(128);h.Observable.prototype.zip=a.zipProto},function(h,f,a){h=a(0);a=a(639);h.Observable.prototype.zipAll=
-a.zipAll},function(h,f,a){var q=a(128);f.zipAll=function(a){return this.lift(new q.ZipOperator(a))}},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(0),n=a(69),d=a(641),b=a(642),c=a(223),e=a(225);h=function(a){function f(b){a.call(this,e.VirtualAction,750);this.assertDeepEqual=b;this.hotObservables=[];this.coldObservables=[];this.flushTests=
-[]}q(f,a);f.prototype.createTime=function(a){a=a.indexOf("|");if(-1===a)throw Error('marble diagram for time should have a completion marker "|"');return a*f.frameTimeFactor};f.prototype.createColdObservable=function(a,b,c){if(-1!==a.indexOf("^"))throw Error('cold observable cannot have subscription offset "^"');if(-1!==a.indexOf("!"))throw Error('cold observable cannot have unsubscription marker "!"');a=f.parseMarbles(a,b,c);a=new d.ColdObservable(a,this);this.coldObservables.push(a);return a};f.prototype.createHotObservable=
-function(a,c,d){if(-1!==a.indexOf("!"))throw Error('hot observable cannot have unsubscription marker "!"');a=f.parseMarbles(a,c,d);a=new b.HotObservable(a,this);this.hotObservables.push(a);return a};f.prototype.materializeInnerObservable=function(a,b){var c=this,d=[];a.subscribe(function(a){d.push({frame:c.frame-b,notification:n.Notification.createNext(a)})},function(a){d.push({frame:c.frame-b,notification:n.Notification.createError(a)})},function(){d.push({frame:c.frame-b,notification:n.Notification.createComplete()})});
-return d};f.prototype.expectObservable=function(a,b){var c=this;void 0===b&&(b=null);var d=[],e={actual:d,ready:!1};b=f.parseMarblesAsSubscriptions(b).unsubscribedFrame;var g;this.schedule(function(){g=a.subscribe(function(a){var b=a;a instanceof p.Observable&&(b=c.materializeInnerObservable(b,c.frame));d.push({frame:c.frame,notification:n.Notification.createNext(b)})},function(a){d.push({frame:c.frame,notification:n.Notification.createError(a)})},function(){d.push({frame:c.frame,notification:n.Notification.createComplete()})})},
-0);b!==Number.POSITIVE_INFINITY&&this.schedule(function(){return g.unsubscribe()},b);this.flushTests.push(e);return{toBe:function(a,b,c){e.ready=!0;e.expected=f.parseMarbles(a,b,c,!0)}}};f.prototype.expectSubscriptions=function(a){var b={actual:a,ready:!1};this.flushTests.push(b);return{toBe:function(a){a="string"===typeof a?[a]:a;b.ready=!0;b.expected=a.map(function(a){return f.parseMarblesAsSubscriptions(a)})}}};f.prototype.flush=function(){for(var b=this.hotObservables;0<b.length;)b.shift().setup();
-a.prototype.flush.call(this);for(b=this.flushTests.filter(function(a){return a.ready});0<b.length;){var c=b.shift();this.assertDeepEqual(c.actual,c.expected)}};f.parseMarblesAsSubscriptions=function(a){if("string"!==typeof a)return new c.SubscriptionLog(Number.POSITIVE_INFINITY);for(var b=a.length,d=-1,e=Number.POSITIVE_INFINITY,f=Number.POSITIVE_INFINITY,g=0;g<b;g++){var h=g*this.frameTimeFactor,k=a[g];switch(k){case "-":case " ":break;case "(":d=h;break;case ")":d=-1;break;case "^":if(e!==Number.POSITIVE_INFINITY)throw Error("found a second subscription point '^' in a subscription marble diagram. There can only be one.");
-e=-1<d?d:h;break;case "!":if(f!==Number.POSITIVE_INFINITY)throw Error("found a second subscription point '^' in a subscription marble diagram. There can only be one.");f=-1<d?d:h;break;default:throw Error("there can only be '^' and '!' markers in a subscription marble diagram. Found instead '"+k+"'.");}}return 0>f?new c.SubscriptionLog(e):new c.SubscriptionLog(e,f)};f.parseMarbles=function(a,b,c,e){void 0===e&&(e=!1);if(-1!==a.indexOf("!"))throw Error('conventional marble diagrams cannot have the unsubscription marker "!"');
-var f=a.length,g=[],h=a.indexOf("^");h=-1===h?0:h*-this.frameTimeFactor;for(var k="object"!==typeof b?function(a){return a}:function(a){return e&&b[a]instanceof d.ColdObservable?b[a].messages:b[a]},l=-1,m=0;m<f;m++){var q=m*this.frameTimeFactor+h,p=void 0,r=a[m];switch(r){case "-":case " ":break;case "(":l=q;break;case ")":l=-1;break;case "|":p=n.Notification.createComplete();break;case "^":break;case "#":p=n.Notification.createError(c||"error");break;default:p=n.Notification.createNext(k(r))}p&&
-g.push({frame:-1<l?l:q,notification:p})}return g};return f}(e.VirtualTimeScheduler);f.TestScheduler=h},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(0),n=a(11);h=a(222);a=a(224);p=function(a){function b(b,d){a.call(this,function(a){var b=this,c=b.logSubscribedFrame();a.add(new n.Subscription(function(){b.logUnsubscribedFrame(c)}));b.scheduleMessages(a);
-return a});this.messages=b;this.subscriptions=[];this.scheduler=d}q(b,a);b.prototype.scheduleMessages=function(a){for(var b=this.messages.length,c=0;c<b;c++){var d=this.messages[c];a.add(this.scheduler.schedule(function(a){a.message.notification.observe(a.subscriber)},d.frame,{message:d,subscriber:a}))}};return b}(p.Observable);f.ColdObservable=p;a.applyMixins(p,[h.SubscriptionLoggable])},function(h,f,a){var q=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&
-(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},p=a(12),n=a(11);h=a(222);a=a(224);p=function(a){function b(b,d){a.call(this);this.messages=b;this.subscriptions=[];this.scheduler=d}q(b,a);b.prototype._subscribe=function(b){var c=this,d=c.logSubscribedFrame();b.add(new n.Subscription(function(){c.logUnsubscribedFrame(d)}));return a.prototype._subscribe.call(this,b)};b.prototype.setup=function(){for(var a=this,b=a.messages.length,d=0;d<b;d++)(function(){var b=a.messages[d];
-a.scheduler.schedule(function(){b.notification.observe(a)},b.frame)})()};return b}(p.Subject);f.HotObservable=p;a.applyMixins(p,[h.SubscriptionLoggable])},function(h,f,a){h=a(644);a=a(646);f.animationFrame=new a.AnimationFrameScheduler(h.AnimationFrameAction)},function(h,f,a){var q=this&&this.__extends||function(a,d){function b(){this.constructor=a}for(var c in d)d.hasOwnProperty(c)&&(a[c]=d[c]);a.prototype=null===d?Object.create(d):(b.prototype=d.prototype,new b)};h=a(70);var p=a(645);a=function(a){function d(b,
-c){a.call(this,b,c);this.scheduler=b;this.work=c}q(d,a);d.prototype.requestAsyncId=function(b,c,d){void 0===d&&(d=0);if(null!==d&&0<d)return a.prototype.requestAsyncId.call(this,b,c,d);b.actions.push(this);return b.scheduled||(b.scheduled=p.AnimationFrame.requestAnimationFrame(b.flush.bind(b,null)))};d.prototype.recycleAsyncId=function(b,c,d){void 0===d&&(d=0);if(null!==d&&0<d||null===d&&0<this.delay)return a.prototype.recycleAsyncId.call(this,b,c,d);0===b.actions.length&&(p.AnimationFrame.cancelAnimationFrame(c),
-b.scheduled=void 0)};return d}(h.AsyncAction);f.AnimationFrameAction=a},function(h,f,a){h=a(16);a=function(){return function(a){a.requestAnimationFrame?(this.cancelAnimationFrame=a.cancelAnimationFrame.bind(a),this.requestAnimationFrame=a.requestAnimationFrame.bind(a)):a.mozRequestAnimationFrame?(this.cancelAnimationFrame=a.mozCancelAnimationFrame.bind(a),this.requestAnimationFrame=a.mozRequestAnimationFrame.bind(a)):a.webkitRequestAnimationFrame?(this.cancelAnimationFrame=a.webkitCancelAnimationFrame.bind(a),
-this.requestAnimationFrame=a.webkitRequestAnimationFrame.bind(a)):a.msRequestAnimationFrame?(this.cancelAnimationFrame=a.msCancelAnimationFrame.bind(a),this.requestAnimationFrame=a.msRequestAnimationFrame.bind(a)):a.oRequestAnimationFrame?(this.cancelAnimationFrame=a.oCancelAnimationFrame.bind(a),this.requestAnimationFrame=a.oRequestAnimationFrame.bind(a)):(this.cancelAnimationFrame=a.clearTimeout.bind(a),this.requestAnimationFrame=function(f){return a.setTimeout(f,1E3/60)})}}();f.RequestAnimationFrameDefinition=
-a;f.AnimationFrame=new a(h.root)},function(h,f,a){var q=this&&this.__extends||function(a,f){function d(){this.constructor=a}for(var b in f)f.hasOwnProperty(b)&&(a[b]=f[b]);a.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)};h=function(a){function f(){a.apply(this,arguments)}q(f,a);f.prototype.flush=function(a){this.active=!0;this.scheduled=void 0;var b=this.actions,c,d=-1,f=b.length;a=a||b.shift();do if(c=a.execute(a.state,a.delay))break;while(++d<f&&(a=b.shift()));this.active=
-!1;if(c){for(;++d<f&&(a=b.shift());)a.unsubscribe();throw c;}};return f}(a(71).AsyncScheduler);f.AnimationFrameScheduler=h},function(h,f,a){h=a(0);a.n(h);h.Observable.prototype.notNull=function(){return this.filter(function(a){return!!a}).map(function(a){return a})};h.Observable.prototype.unseen=function(a){$jscomp.initSymbol();var f=Symbol("marker");return this.filter(function(h){return!(a?a(h):h)[f]}).map(function(h){(a?a(h):h)[f]=!0;return h})};h.Observable.prototype.ofType=function(a){return this.filter(function(f){return f instanceof
-a}).map(function(a){return a})}}]);
diff --git a/third_party/syntaxError.js b/third_party/syntaxError.js
new file mode 100644
index 0000000000000000000000000000000000000000..c81600dd1319ca37e922de9735f901087d517056
--- /dev/null
+++ b/third_party/syntaxError.js
@@ -0,0 +1,8 @@
+(()=>{
+  let e = e => {
+    console.log(e);
+    for(let e of [1,2,3]){
+      console.log(e);
+    }
+  }
+})()
\ No newline at end of file
diff --git a/tsconfig-aot.json b/tsconfig-aot.json
index 7e541551de2f10d6e188764fe44de55db26581f5..15a0003e484369a70d602ca95fa1c95174849205 100644
--- a/tsconfig-aot.json
+++ b/tsconfig-aot.json
@@ -3,6 +3,7 @@
     "experimentalDecorators": true,
     "emitDecoratorMetadata": true,
     "moduleResolution": "node",
+    "module": "esnext",
     "target": "es2015",
     "sourceMap": false,
     "baseUrl": ".",
@@ -13,6 +14,8 @@
     }
   },
   "angularCompilerOptions":{
+    "fullTemplateTypeCheck": true,
+    "strictInjectionParameters": true,
     "annotateForClosureCompiler" : true
   }
 }
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index 59ee73b188970995b9fc4b12331823aa5ffef17c..1833901f2db9f5097d430a3b428314d13b8cb904 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -3,6 +3,7 @@
     "experimentalDecorators": true,
     "emitDecoratorMetadata": true,
     "moduleResolution": "node",
+    "module": "esnext",
     "target": "es2015",
     "sourceMap": true,
     "baseUrl": ".",
diff --git a/typings/index.d.ts b/typings/index.d.ts
index 79046f1dbc0d2d6651aba86c4d0fe1987cddbc40..2fb1dc3a178d16dd8fdabb97eac85d03b031c875 100644
--- a/typings/index.d.ts
+++ b/typings/index.d.ts
@@ -19,3 +19,5 @@ declare var USE_LOGO: string
 declare var DATASET_PREVIEW_URL: string
 declare var MATOMO_URL: string
 declare var MATOMO_ID: string
+declare var STRICT_LOCAL: boolean
+declare var KIOSK_MODE: boolean
diff --git a/webpack.aot.js b/webpack.aot.js
index 8c815798d118033bf6a7662bbf4e32980cbd74d1..02573be1a0cc31ed917f89c9896b5954e1a1fe30 100644
--- a/webpack.aot.js
+++ b/webpack.aot.js
@@ -6,9 +6,11 @@ const AngularCompilerPlugin = ngtools.AngularCompilerPlugin
 const ClosureCompilerPlugin = require('webpack-closure-compiler')
 const merge = require('webpack-merge')
 const staticAssets = require('./webpack.staticassets')
+const TerserPlugin = require('terser-webpack-plugin')
+const webpack = require('webpack')
 
 module.exports = merge(staticAssets, {
-
+  mode: 'production',
   entry : {
     main : './src/main-aot.ts'
   },
@@ -56,9 +58,24 @@ module.exports = merge(staticAssets, {
     }),
     new AngularCompilerPlugin({
       tsConfigPath: 'tsconfig-aot.json',
-      entryModule: 'src/main.module#MainModule'
+      entryModule: 'src/main.module#MainModule',
+      directTemplateLoading: true
+    }),
+    new webpack.DefinePlugin({
+      // TODO have to figure out how to set this properly
+      // needed to avoid inline eval
+      // shouldn't mode: 'production' do that already?
+      ngDevMode: false,
+      ngJitMode: false
     })
   ],
+  optimization: {
+    minimizer: [
+      new TerserPlugin({
+        extractComments: false
+      })
+    ]
+  },
   resolve : {
     extensions : [
       '.ts',
diff --git a/webpack.staticassets.js b/webpack.staticassets.js
index 94c5fd037e2c97f82a9ec87a8e099a2696186065..b5801554328eeb705ff5d5e92a2c644c5afd7a04 100644
--- a/webpack.staticassets.js
+++ b/webpack.staticassets.js
@@ -55,9 +55,12 @@ module.exports = {
       filename: 'theme.css'
     }),
     new webpack.DefinePlugin({
+      // TODO deprecate
       PLUGINDEV : process.env.PLUGINDEV
         ? JSON.stringify(process.env.PLUGINDEV)
         : false,
+
+      // TODO deprecate
       BUNDLEDPLUGINS : process.env.BUNDLEDPLUGINS
         ? JSON.stringify(process.env.BUNDLEDPLUGINS.split(','))
         : JSON.stringify([]),
@@ -66,14 +69,18 @@ module.exports = {
         : process.env.GIT_HASH
           ? JSON.stringify(process.env.GIT_HASH)
           : JSON.stringify('unspecificied hash'),
-      PRODUCTION: process.env.PRODUCTION
-        ? true
-        : false,
+      PRODUCTION: !!process.env.PRODUCTION,
       BACKEND_URL: (process.env.BACKEND_URL && JSON.stringify(process.env.BACKEND_URL)) || 'null',
-      USE_LOGO: JSON.stringify(process.env.USE_LOGO || 'hbp' || 'ebrains' ),
       DATASET_PREVIEW_URL: JSON.stringify(process.env.DATASET_PREVIEW_URL || 'https://hbp-kg-dataset-previewer.apps.hbp.eu/datasetPreview'),
       MATOMO_URL: JSON.stringify(process.env.MATOMO_URL || null),
-      MATOMO_ID: JSON.stringify(process.env.MATOMO_ID || null)
+      MATOMO_ID: JSON.stringify(process.env.MATOMO_ID || null),
+      USE_LOGO: JSON.stringify(process.env.USE_LOGO || 'hbp' || 'ebrains' || 'fzj'),
+
+      // strick local hides "explore" and "download" btns, which requires internet
+      STRICT_LOCAL: process.env.STRICT_LOCAL === 'true' ? 'true' : 'false',
+
+      // invite user to touch/interact after 5 min of inactivity
+      KIOSK_MODE: process.env.KIOSK_MODE === 'true' ? 'true' : 'false',
     })
   ],
   resolve: {