From edb3e60334edbf80472517d5e2d2a2785eb491da Mon Sep 17 00:00:00 2001 From: Thai Pangsakulyanont Date: Fri, 3 Apr 2020 22:27:23 +0700 Subject: [PATCH] Huge update! --- .github/main.workflow | 9 - .gitignore | 3 +- background.html | 3 + background.js | 46 - content-script.js | 30 + manifest.json | 10 +- options.html | 2 +- package.json | 5 + popup.html | 77 +- popup.js | 169 +- settings.js | 4 - src/VXBackgroundPage.js | 36 + src/VXController.js | 201 + src/VXDefaultSettings.js | 8 + src/VXOutputModules.js | 130 + src/types.ts | 8 + vendor/lodash-4.17.15-core.js | 3854 ++++++++++ vendor/mobx-5.13.0.umd.js | 4499 ++++++++++++ vendor/vue-2.6.11.js | 11965 ++++++++++++++++++++++++++++++++ yarn.lock | 28 + 20 files changed, 20850 insertions(+), 237 deletions(-) delete mode 100644 .github/main.workflow create mode 100644 background.html delete mode 100644 background.js create mode 100644 content-script.js create mode 100644 package.json delete mode 100644 settings.js create mode 100644 src/VXBackgroundPage.js create mode 100644 src/VXController.js create mode 100644 src/VXDefaultSettings.js create mode 100644 src/VXOutputModules.js create mode 100644 src/types.ts create mode 100644 vendor/lodash-4.17.15-core.js create mode 100644 vendor/mobx-5.13.0.umd.js create mode 100644 vendor/vue-2.6.11.js create mode 100644 yarn.lock diff --git a/.github/main.workflow b/.github/main.workflow deleted file mode 100644 index f841a93..0000000 --- a/.github/main.workflow +++ /dev/null @@ -1,9 +0,0 @@ -workflow "TODO" { - resolves = ["todo-actions"] - on = "push" -} - -action "todo-actions" { - uses = "dtinth/todo-actions@v0.2.0" - secrets = ["GITHUB_TOKEN", "TODO_ACTIONS_MONGO_URL"] -} diff --git a/.gitignore b/.gitignore index 0fea55b..594da78 100644 --- a/.gitignore +++ b/.gitignore @@ -43,4 +43,5 @@ Icon .Spotlight-V100 .Trashes -.idea \ No newline at end of file +.idea +tmp \ No newline at end of file diff --git a/background.html b/background.html new file mode 100644 index 0000000..1434129 --- /dev/null +++ b/background.html @@ -0,0 +1,3 @@ + + + diff --git a/background.js b/background.js deleted file mode 100644 index 11d3384..0000000 --- a/background.js +++ /dev/null @@ -1,46 +0,0 @@ -let currentWindow - -function listen(lang) { - if (currentWindow) { - chrome.runtime.sendMessage({ type: 'toggle', lang: lang }, () => {}) - return - } - chrome.windows.create( - { - url: 'popup.html#lang=' + lang, - type: 'popup', - top: screen.availHeight - 200, - left: 0, - width: screen.availWidth, - height: 180, - focused: false, - }, - window => { - currentWindow = window.id - }, - ) -} - -chrome.commands.onCommand.addListener(function(command) { - chrome.storage.sync.get(defaultSettings, function(settings) { - if (command === 'listen1') { - listen(settings.language1) - } - if (command === 'listen2') { - listen(settings.language2) - } - }) -}) - -chrome.windows.onRemoved.addListener(function(windowId) { - console.log('Window closed', windowId, currentWindow) - if (windowId === currentWindow) { - currentWindow = null - } -}) - -chrome.browserAction.onClicked.addListener(function() { - chrome.storage.sync.get(defaultSettings, function(settings) { - listen(settings.language1) - }) -}) diff --git a/content-script.js b/content-script.js new file mode 100644 index 0000000..4be5926 --- /dev/null +++ b/content-script.js @@ -0,0 +1,30 @@ +if (!window.vxframe) { + const css = String.raw + const frame = document.createElement('iframe') + frame.setAttribute( + 'style', + css` + position: fixed; + top: 0px; + left: 0px; + width: calc(100vw); + height: 200px; + margin: 0; + padding: 0; + border: 0; + background: transcript; + z-index: 999999999; + pointer-events: none; + `, + ) + frame.src = chrome.runtime.getURL('popup.html') + document.body.appendChild(frame) + window.vxframe = frame + chrome.runtime.onMessage.addListener(message => { + if (message.disposeOverlay) { + window.vxframe = null + frame.remove() + } + }) + chrome.runtime.sendMessage({ overlayInjected: true }) +} diff --git a/manifest.json b/manifest.json index f3128d2..c4782fc 100644 --- a/manifest.json +++ b/manifest.json @@ -2,6 +2,7 @@ "manifest_version": 2, "name": "vxchrome", "version": "0.1", + "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", "commands": { "listen1": { "description": "Listen [first language]", @@ -17,9 +18,9 @@ } }, "background": { - "scripts": ["settings.js", "background.js"] + "page": "background.html" }, - "permissions": ["clipboardWrite", "notifications", "storage"], + "permissions": ["clipboardWrite", "notifications", "storage", "activeTab"], "browser_action": { "default_icon": "icon.png" @@ -27,6 +28,7 @@ "options_ui": { "page": "options.html", - "open_in_tab": false - } + "open_in_tab": true + }, + "web_accessible_resources": ["popup.html"] } diff --git a/options.html b/options.html index 6467592..e6f3905 100644 --- a/options.html +++ b/options.html @@ -45,7 +45,7 @@
- + diff --git a/package.json b/package.json new file mode 100644 index 0000000..2e42cb9 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "devDependencies": { + "@types/chrome": "^0.0.103" + } +} diff --git a/popup.html b/popup.html index 239eae1..1420b88 100644 --- a/popup.html +++ b/popup.html @@ -7,33 +7,58 @@ vxchrome -

- - -   -

+
+
+ +
+

- -

-    
-    
+    
     
   
 
diff --git a/popup.js b/popup.js
index 91830e7..6263feb 100644
--- a/popup.js
+++ b/popup.js
@@ -1,143 +1,24 @@
-var logContainer = document.querySelector('#log')
-var interimText = document.querySelector('#interim')
-var finalText = document.querySelector('#final')
-var listeningText = document.querySelector('#listening')
-var ac = new AudioContext()
+Vue.config.productionTip = false
+Vue.config.devtools = false
 
-let nextToneTime = 0
-
-function tone(f, s) {
-  const d = s * 0.05
-  const t = Math.max(ac.currentTime + d, nextToneTime)
-  nextToneTime = t + 0.05
-
-  const osc = ac.createOscillator()
-  const gain = ac.createGain()
-
-  osc.frequency.value = 220 * Math.pow(2, f / 12)
-  osc.connect(gain)
-
-  gain.gain.setValueAtTime(0.5, t)
-  gain.gain.linearRampToValueAtTime(0.0, t + 0.07)
-  gain.connect(ac.destination)
-
-  osc.start(t)
-  osc.stop(t + 0.1)
-}
-
-function log(text) {
-  const item = document.createElement('div')
-  item.textContent = '[' + new Date().toJSON() + '] ' + text
-  logContainer.appendChild(item)
-  if (logContainer.childNodes.length > 10) {
-    logContainer.removeChild(logContainer.firstChild)
-  }
-}
+document
+  .querySelector('#open-options-button')
+  .addEventListener('click', openOptions)
 
-var recognition = new webkitSpeechRecognition() // azureSpeechRecognition() //
-var listening = false
-var endSounded = false
-var closeTimeout = null
-recognition.continuous = true
-recognition.interimResults = true
-recognition.onstart = function() {
-  log('Ready to listen')
-  tone(5, 0)
-  tone(10, 1)
-}
-recognition.onerror = function(event) {
-  if (event.error === 'no-speech') {
-    listeningText.hidden = !(listening = false)
-    log('Closed: No speech')
-  }
-  const sendError = message => {
-    log('Error: ' + message)
-  }
-  if (event.error === 'audio-capture') {
-    sendError('No microphone was found.')
-  }
-  if (event.error === 'not-allowed') {
-    sendError('Permission to use microphone is blocked.')
-  }
-  if (!endSounded) {
-    tone(15, 0)
-    tone(12, 1)
-    tone(9, 2)
-    endSounded = true
-  }
-  clearTimeout(closeTimeout)
-  closeTimeout = setTimeout(() => {
-    chrome.notifications.clear('vx')
-    window.close()
-  }, 1000)
-}
-recognition.onend = function() {
-  log('Ended')
-  listeningText.hidden = !(listening = false)
-  if (!endSounded) {
-    tone(15, 0)
-    tone(8, 1)
-    tone(1, 2)
-    endSounded = true
-  }
+const vm = new Vue({
+  el: '#app',
+  data: {
+    data: null,
+  },
+})
 
-  clearTimeout(closeTimeout)
-  closeTimeout = setTimeout(() => {
-    chrome.notifications.clear('vx')
-    window.close()
-  }, 1000)
-}
-recognition.onresult = function(event) {
-  var finalTranscript = ''
-  var interimTranscript = ''
-  for (var i = event.resultIndex; i < event.results.length; ++i) {
-    if (event.results[i].isFinal) {
-      finalTranscript += event.results[i][0].transcript
-    } else {
-      interimTranscript += event.results[i][0].transcript
-    }
+chrome.runtime.onMessage.addListener(message => {
+  if (message.state) {
+    vm.data = message.state
   }
-  interimText.textContent = interimTranscript
-  finalText.textContent = finalTranscript
-  chrome.notifications.update('vx', {
-    message: `${finalTranscript}${interimTranscript}`,
-    progress: finalTranscript ? 100 : 0,
-  })
-  if (finalTranscript) {
-    copyTextToClipboard(finalTranscript.trim())
-    tone(5, 0)
-    tone(10, 1)
-    tone(15, 2)
-  }
-}
-function start(lang) {
-  clearTimeout(closeTimeout)
-  tone(0, 0)
-  log('Start listening for ' + lang)
-  recognition.lang = lang
-  recognition.start()
-  listeningText.hidden = !(listening = true)
-  listeningText.textContent = `(listening, ${lang})`
-  chrome.notifications.create('vx', {
-    type: 'progress',
-    title: 'Listening…',
-    message: '',
-    silent: true,
-    progress: 0,
-    iconUrl: 'icon.png',
-  })
-  endSounded = false
-}
+})
 
-function copyTextToClipboard(text) {
-  var copyFrom = document.createElement('textarea')
-  copyFrom.textContent = text
-  document.body.appendChild(copyFrom)
-  copyFrom.select()
-  document.execCommand('copy')
-  copyFrom.blur()
-  document.body.removeChild(copyFrom)
-}
+chrome.runtime.sendMessage({ popupOpened: true })
 
 function openOptions() {
   if (chrome.runtime.openOptionsPage) {
@@ -147,18 +28,6 @@ function openOptions() {
   }
 }
 
-start(location.hash.match(/lang=([^&]+)/)[1])
-document
-  .querySelector('#open-options-button')
-  .addEventListener('click', openOptions)
-
-chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
-  if (request.type === 'toggle') {
-    if (listening) {
-      recognition.stop()
-    } else {
-      start(request.lang)
-    }
-    sendResponse({ ok: true })
-  }
-})
+if (location.search === '?full') {
+  document.documentElement.classList.add('full')
+}
diff --git a/settings.js b/settings.js
deleted file mode 100644
index c4d732b..0000000
--- a/settings.js
+++ /dev/null
@@ -1,4 +0,0 @@
-const defaultSettings = {
-  language1: 'en',
-  language2: 'th',
-}
diff --git a/src/VXBackgroundPage.js b/src/VXBackgroundPage.js
new file mode 100644
index 0000000..63c95d0
--- /dev/null
+++ b/src/VXBackgroundPage.js
@@ -0,0 +1,36 @@
+// @ts-check
+/// 
+
+import { defaultSettings } from './VXDefaultSettings.js'
+import * as vx from './VXController.js'
+
+function listen(lang) {
+  vx.toggle({ lang })
+}
+
+function injectContentScript() {
+  chrome.tabs.executeScript({ code: 'void 0' }, () => {
+    if (chrome.runtime.lastError) {
+      // console.log('T_T', chrome.runtime.lastError.message)
+    }
+  })
+}
+
+chrome.commands.onCommand.addListener(function(command) {
+  // injectContentScript()
+  chrome.storage.sync.get(defaultSettings, function(settings) {
+    if (command === 'listen1') {
+      listen(settings.language1)
+    }
+    if (command === 'listen2') {
+      listen(settings.language2)
+    }
+  })
+})
+
+chrome.browserAction.onClicked.addListener(function() {
+  // injectContentScript()
+  chrome.storage.sync.get(defaultSettings, function(settings) {
+    listen(settings.language1)
+  })
+})
diff --git a/src/VXController.js b/src/VXController.js
new file mode 100644
index 0000000..9740bbc
--- /dev/null
+++ b/src/VXController.js
@@ -0,0 +1,201 @@
+import * as VXViews from './VXOutputModules.js'
+
+var ac = new AudioContext()
+let nextToneTime = 0
+
+let views = [VXViews.PopupOutputModule]
+let resultHandler = defaultResultHandler
+
+function tone(f, s) {
+  const d = s * 0.05
+  const t = Math.max(ac.currentTime + d, nextToneTime)
+  nextToneTime = t + 0.05
+
+  const osc = ac.createOscillator()
+  const gain = ac.createGain()
+
+  osc.frequency.value = 220 * Math.pow(2, f / 12)
+  osc.connect(gain)
+
+  gain.gain.setValueAtTime(0.5, t)
+  gain.gain.linearRampToValueAtTime(0.0, t + 0.07)
+  gain.connect(ac.destination)
+
+  osc.start(t)
+  osc.stop(t + 0.1)
+}
+
+const state = mobx.observable({
+  status: 'idle',
+  interimTranscript: '',
+  finalTranscript: '',
+})
+
+// Sound
+mobx.autorun(() => {
+  const { status } = state
+  if (status === 'starting') {
+    tone(0, 0)
+  }
+  if (status === 'listening') {
+    tone(5, 0)
+    tone(10, 1)
+  }
+  if (status === 'error') {
+    tone(15, 0)
+    tone(12, 1)
+    tone(9, 2)
+  }
+  if (status === 'ended') {
+    tone(15, 0)
+    tone(8, 1)
+    tone(1, 2)
+  }
+})
+
+// View
+{
+  const view = payload => {
+    console.log('View:', payload)
+    views.forEach(v => {
+      try {
+        v(payload)
+      } catch (e) {
+        console.error(`Output module "${v.name}" failed`, e)
+      }
+    })
+  }
+
+  const viewState = mobx.observable({
+    showing: false,
+    get shouldShow() {
+      const { status } = state
+      return status === 'listening' || status === 'starting'
+    },
+  })
+
+  let hideTimer
+  mobx.reaction(
+    () => viewState.shouldShow,
+    shouldShow => {
+      clearTimeout(hideTimer)
+      if (shouldShow) {
+        viewState.showing = true
+      } else {
+        hideTimer = setTimeout(() => {
+          viewState.showing = false
+        }, 1500)
+      }
+    },
+  )
+
+  mobx.autorun(() => {
+    const { status, interimTranscript, finalTranscript } = state
+    const { showing } = viewState
+    view({ status, finalTranscript, interimTranscript, showing })
+  })
+}
+
+function log(text) {
+  console.log('[' + new Date().toJSON() + '] ' + text)
+}
+
+var recognition = new webkitSpeechRecognition() // azureSpeechRecognition() //
+
+recognition.continuous = true
+recognition.interimResults = true
+
+recognition.onstart = function() {
+  mobx.runInAction('onstart', () => {
+    state.status = 'listening'
+  })
+  log('Ready to listen')
+}
+
+recognition.onerror = function(event) {
+  mobx.runInAction('onerror', () => {
+    state.status = 'error'
+  })
+  if (event.error === 'no-speech') {
+    log('Closed: No speech')
+    return
+  }
+  const logError = message => {
+    log('Error: ' + message)
+  }
+  if (event.error === 'audio-capture') {
+    logError('No microphone was found.')
+  }
+  if (event.error === 'not-allowed') {
+    logError('Permission to use microphone is blocked.')
+  }
+}
+
+recognition.onend = function() {
+  mobx.runInAction('onend', () => {
+    state.status = 'ended'
+  })
+  log('Ended')
+}
+
+recognition.onresult = function(event) {
+  var finalTranscript = ''
+  var interimTranscript = ''
+  for (var i = event.resultIndex; i < event.results.length; ++i) {
+    if (event.results[i].isFinal) {
+      finalTranscript += event.results[i][0].transcript
+    } else {
+      interimTranscript += event.results[i][0].transcript
+    }
+  }
+  mobx.runInAction('onresult', () => {
+    state.finalTranscript = finalTranscript
+    state.interimTranscript = interimTranscript
+  })
+  resultHandler(interimTranscript, finalTranscript)
+  if (finalTranscript) {
+    tone(5, 0)
+    tone(10, 1)
+    tone(15, 2)
+  }
+}
+
+function defaultResultHandler(interimTranscript, finalTranscript) {
+  if (finalTranscript) {
+    copyTextToClipboard(finalTranscript.trim())
+  }
+}
+
+function start(lang) {
+  mobx.runInAction('start', () => {
+    state.status = 'starting'
+    state.interimTranscript = ''
+    state.finalTranscript = ''
+  })
+  log('Start listening for ' + lang)
+  recognition.lang = lang
+  recognition.start()
+}
+
+function copyTextToClipboard(text) {
+  var copyFrom = document.createElement('textarea')
+  copyFrom.textContent = text
+  document.body.appendChild(copyFrom)
+  copyFrom.select()
+  document.execCommand('copy')
+  copyFrom.blur()
+  document.body.removeChild(copyFrom)
+}
+
+export function isActive() {
+  return state.status === 'listening' || state.status === 'starting'
+}
+
+export function toggle(request) {
+  if (isActive()) {
+    recognition.stop()
+  } else {
+    resultHandler = request.resultHandler || defaultResultHandler
+    start(request.lang)
+  }
+}
diff --git a/src/VXDefaultSettings.js b/src/VXDefaultSettings.js
new file mode 100644
index 0000000..b02b038
--- /dev/null
+++ b/src/VXDefaultSettings.js
@@ -0,0 +1,8 @@
+export const defaultSettings = {
+  language1: 'en',
+  language2: 'th',
+
+  // outputNotification: 'off',
+  // outputOverlayer: 'off',
+  // outputPopup: 'off',
+}
diff --git a/src/VXOutputModules.js b/src/VXOutputModules.js
new file mode 100644
index 0000000..e5d4954
--- /dev/null
+++ b/src/VXOutputModules.js
@@ -0,0 +1,130 @@
+// @ts-check
+/// 
+
+export const PopupOutputModule = (() => {
+  let activePopup
+  let state
+  function broadcastState() {
+    if (state) {
+      chrome.runtime.sendMessage({ state }, () => {
+        if (chrome.runtime.lastError) {
+          const silencedMessages = [
+            'The message port closed before a response was received.',
+            'Could not establish connection. Receiving end does not exist.',
+          ]
+          const message = chrome.runtime.lastError.message
+          if (!silencedMessages.includes(message)) {
+            console.error(
+              '[broadcastState] failed:',
+              chrome.runtime.lastError.message,
+            )
+          }
+        }
+      })
+    }
+  }
+  chrome.runtime.onMessage.addListener(message => {
+    if (message.popupOpened) {
+      broadcastState()
+    }
+  })
+  function createPopup() {
+    let windowId, tabId
+    const messageListener = (message, sender) => {
+      if (message.overlayInjected && sender.tab) {
+        tabId = sender.tab.id
+      }
+    }
+    chrome.runtime.onMessage.addListener(messageListener)
+    const windowRemovedListener = function(removedWindowId) {
+      if (removedWindowId === windowId) {
+        chrome.windows.onRemoved.removeListener(windowRemovedListener)
+        activePopup = null
+      }
+    }
+    chrome.windows.onRemoved.addListener(windowRemovedListener)
+    chrome.tabs.executeScript({ file: 'content-script.js' }, () => {
+      if (chrome.runtime.lastError) {
+        chrome.windows.create(
+          {
+            url: 'popup.html?full',
+            type: 'popup',
+            top: screen.availHeight - 200,
+            left: 0,
+            width: screen.availWidth,
+            height: 180,
+            focused: true,
+          },
+          window => {
+            windowId = window.id
+          },
+        )
+        return
+      }
+    })
+    return {
+      dispose() {
+        chrome.windows.onRemoved.removeListener(windowRemovedListener)
+        if (windowId) {
+          chrome.windows.remove(windowId)
+          activePopup = null
+        }
+        if (tabId) {
+          chrome.tabs.sendMessage(tabId, { disposeOverlay: true })
+        }
+      },
+    }
+  }
+  return /** @type {VXOutput} */ (function PopupOutputModule(nextState) {
+    state = nextState
+    if (nextState.showing && !activePopup) {
+      activePopup = createPopup()
+    } else if (!nextState.showing && activePopup) {
+      activePopup.dispose()
+      activePopup = null
+    }
+    broadcastState()
+  })
+})()
+
+export const NotificationOutputModule = (() => {
+  let active = false
+  return /** @type {VXOutput} */ (function NotificationOutputModule({
+    status,
+    finalTranscript,
+    interimTranscript,
+    showing,
+  }) {
+    const message = `${finalTranscript}${interimTranscript}`
+    const title = `${status}`
+    const progress = finalTranscript ? 100 : 0
+    if (showing) {
+      if (active) {
+        console.log('Updating!')
+        chrome.notifications.update('vx', {
+          title,
+          message,
+          progress,
+        })
+      } else {
+        console.log('Creating!')
+        active = true
+        chrome.notifications.create('vx', {
+          type: 'progress',
+          title,
+          message,
+          silent: true,
+          progress,
+          iconUrl: 'icon.png',
+          requireInteraction: true,
+        })
+      }
+    } else {
+      if (active) {
+        console.log('Clearing!')
+        active = false
+        chrome.notifications.clear('vx')
+      }
+    }
+  })
+})()
diff --git a/src/types.ts b/src/types.ts
new file mode 100644
index 0000000..0751b6d
--- /dev/null
+++ b/src/types.ts
@@ -0,0 +1,8 @@
+interface VXOutput {
+  (state: {
+    status: string
+    finalTranscript: string
+    interimTranscript: string
+    showing: string
+  }): void
+}
diff --git a/vendor/lodash-4.17.15-core.js b/vendor/lodash-4.17.15-core.js
new file mode 100644
index 0000000..89c77de
--- /dev/null
+++ b/vendor/lodash-4.17.15-core.js
@@ -0,0 +1,3854 @@
+/**
+ * @license
+ * Lodash (Custom Build) 
+ * Build: `lodash core -o ./dist/lodash.core.js`
+ * Copyright OpenJS Foundation and other contributors 
+ * Released under MIT license 
+ * Based on Underscore.js 1.8.3 
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ */
+;(function() {
+
+  /** Used as a safe reference for `undefined` in pre-ES5 environments. */
+  var undefined;
+
+  /** Used as the semantic version number. */
+  var VERSION = '4.17.15';
+
+  /** Error message constants. */
+  var FUNC_ERROR_TEXT = 'Expected a function';
+
+  /** Used to compose bitmasks for value comparisons. */
+  var COMPARE_PARTIAL_FLAG = 1,
+      COMPARE_UNORDERED_FLAG = 2;
+
+  /** Used to compose bitmasks for function metadata. */
+  var WRAP_BIND_FLAG = 1,
+      WRAP_PARTIAL_FLAG = 32;
+
+  /** Used as references for various `Number` constants. */
+  var INFINITY = 1 / 0,
+      MAX_SAFE_INTEGER = 9007199254740991;
+
+  /** `Object#toString` result references. */
+  var argsTag = '[object Arguments]',
+      arrayTag = '[object Array]',
+      asyncTag = '[object AsyncFunction]',
+      boolTag = '[object Boolean]',
+      dateTag = '[object Date]',
+      errorTag = '[object Error]',
+      funcTag = '[object Function]',
+      genTag = '[object GeneratorFunction]',
+      numberTag = '[object Number]',
+      objectTag = '[object Object]',
+      proxyTag = '[object Proxy]',
+      regexpTag = '[object RegExp]',
+      stringTag = '[object String]';
+
+  /** Used to match HTML entities and HTML characters. */
+  var reUnescapedHtml = /[&<>"']/g,
+      reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
+
+  /** Used to detect unsigned integer values. */
+  var reIsUint = /^(?:0|[1-9]\d*)$/;
+
+  /** Used to map characters to HTML entities. */
+  var htmlEscapes = {
+    '&': '&',
+    '<': '<',
+    '>': '>',
+    '"': '"',
+    "'": '''
+  };
+
+  /** Detect free variable `global` from Node.js. */
+  var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
+
+  /** Detect free variable `self`. */
+  var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
+
+  /** Used as a reference to the global object. */
+  var root = freeGlobal || freeSelf || Function('return this')();
+
+  /** Detect free variable `exports`. */
+  var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
+
+  /** Detect free variable `module`. */
+  var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * Appends the elements of `values` to `array`.
+   *
+   * @private
+   * @param {Array} array The array to modify.
+   * @param {Array} values The values to append.
+   * @returns {Array} Returns `array`.
+   */
+  function arrayPush(array, values) {
+    array.push.apply(array, values);
+    return array;
+  }
+
+  /**
+   * The base implementation of `_.findIndex` and `_.findLastIndex` without
+   * support for iteratee shorthands.
+   *
+   * @private
+   * @param {Array} array The array to inspect.
+   * @param {Function} predicate The function invoked per iteration.
+   * @param {number} fromIndex The index to search from.
+   * @param {boolean} [fromRight] Specify iterating from right to left.
+   * @returns {number} Returns the index of the matched value, else `-1`.
+   */
+  function baseFindIndex(array, predicate, fromIndex, fromRight) {
+    var length = array.length,
+        index = fromIndex + (fromRight ? 1 : -1);
+
+    while ((fromRight ? index-- : ++index < length)) {
+      if (predicate(array[index], index, array)) {
+        return index;
+      }
+    }
+    return -1;
+  }
+
+  /**
+   * The base implementation of `_.property` without support for deep paths.
+   *
+   * @private
+   * @param {string} key The key of the property to get.
+   * @returns {Function} Returns the new accessor function.
+   */
+  function baseProperty(key) {
+    return function(object) {
+      return object == null ? undefined : object[key];
+    };
+  }
+
+  /**
+   * The base implementation of `_.propertyOf` without support for deep paths.
+   *
+   * @private
+   * @param {Object} object The object to query.
+   * @returns {Function} Returns the new accessor function.
+   */
+  function basePropertyOf(object) {
+    return function(key) {
+      return object == null ? undefined : object[key];
+    };
+  }
+
+  /**
+   * The base implementation of `_.reduce` and `_.reduceRight`, without support
+   * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
+   *
+   * @private
+   * @param {Array|Object} collection The collection to iterate over.
+   * @param {Function} iteratee The function invoked per iteration.
+   * @param {*} accumulator The initial value.
+   * @param {boolean} initAccum Specify using the first or last element of
+   *  `collection` as the initial value.
+   * @param {Function} eachFunc The function to iterate over `collection`.
+   * @returns {*} Returns the accumulated value.
+   */
+  function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
+    eachFunc(collection, function(value, index, collection) {
+      accumulator = initAccum
+        ? (initAccum = false, value)
+        : iteratee(accumulator, value, index, collection);
+    });
+    return accumulator;
+  }
+
+  /**
+   * The base implementation of `_.values` and `_.valuesIn` which creates an
+   * array of `object` property values corresponding to the property names
+   * of `props`.
+   *
+   * @private
+   * @param {Object} object The object to query.
+   * @param {Array} props The property names to get values for.
+   * @returns {Object} Returns the array of property values.
+   */
+  function baseValues(object, props) {
+    return baseMap(props, function(key) {
+      return object[key];
+    });
+  }
+
+  /**
+   * Used by `_.escape` to convert characters to HTML entities.
+   *
+   * @private
+   * @param {string} chr The matched character to escape.
+   * @returns {string} Returns the escaped character.
+   */
+  var escapeHtmlChar = basePropertyOf(htmlEscapes);
+
+  /**
+   * Creates a unary function that invokes `func` with its argument transformed.
+   *
+   * @private
+   * @param {Function} func The function to wrap.
+   * @param {Function} transform The argument transform.
+   * @returns {Function} Returns the new function.
+   */
+  function overArg(func, transform) {
+    return function(arg) {
+      return func(transform(arg));
+    };
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /** Used for built-in method references. */
+  var arrayProto = Array.prototype,
+      objectProto = Object.prototype;
+
+  /** Used to check objects for own properties. */
+  var hasOwnProperty = objectProto.hasOwnProperty;
+
+  /** Used to generate unique IDs. */
+  var idCounter = 0;
+
+  /**
+   * Used to resolve the
+   * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
+   * of values.
+   */
+  var nativeObjectToString = objectProto.toString;
+
+  /** Used to restore the original `_` reference in `_.noConflict`. */
+  var oldDash = root._;
+
+  /** Built-in value references. */
+  var objectCreate = Object.create,
+      propertyIsEnumerable = objectProto.propertyIsEnumerable;
+
+  /* Built-in method references for those with the same name as other `lodash` methods. */
+  var nativeIsFinite = root.isFinite,
+      nativeKeys = overArg(Object.keys, Object),
+      nativeMax = Math.max;
+
+  /*------------------------------------------------------------------------*/
+
+  /**
+   * Creates a `lodash` object which wraps `value` to enable implicit method
+   * chain sequences. Methods that operate on and return arrays, collections,
+   * and functions can be chained together. Methods that retrieve a single value
+   * or may return a primitive value will automatically end the chain sequence
+   * and return the unwrapped value. Otherwise, the value must be unwrapped
+   * with `_#value`.
+   *
+   * Explicit chain sequences, which must be unwrapped with `_#value`, may be
+   * enabled using `_.chain`.
+   *
+   * The execution of chained methods is lazy, that is, it's deferred until
+   * `_#value` is implicitly or explicitly called.
+   *
+   * Lazy evaluation allows several methods to support shortcut fusion.
+   * Shortcut fusion is an optimization to merge iteratee calls; this avoids
+   * the creation of intermediate arrays and can greatly reduce the number of
+   * iteratee executions. Sections of a chain sequence qualify for shortcut
+   * fusion if the section is applied to an array and iteratees accept only
+   * one argument. The heuristic for whether a section qualifies for shortcut
+   * fusion is subject to change.
+   *
+   * Chaining is supported in custom builds as long as the `_#value` method is
+   * directly or indirectly included in the build.
+   *
+   * In addition to lodash methods, wrappers have `Array` and `String` methods.
+   *
+   * The wrapper `Array` methods are:
+   * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
+   *
+   * The wrapper `String` methods are:
+   * `replace` and `split`
+   *
+   * The wrapper methods that support shortcut fusion are:
+   * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
+   * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
+   * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
+   *
+   * The chainable wrapper methods are:
+   * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
+   * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
+   * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
+   * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
+   * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
+   * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
+   * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
+   * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
+   * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
+   * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
+   * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
+   * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
+   * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
+   * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
+   * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
+   * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
+   * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
+   * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
+   * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
+   * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
+   * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
+   * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
+   * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
+   * `zipObject`, `zipObjectDeep`, and `zipWith`
+   *
+   * The wrapper methods that are **not** chainable by default are:
+   * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
+   * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
+   * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
+   * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
+   * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
+   * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
+   * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
+   * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
+   * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
+   * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
+   * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
+   * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
+   * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
+   * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
+   * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
+   * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
+   * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
+   * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
+   * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
+   * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
+   * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
+   * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
+   * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
+   * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
+   * `upperFirst`, `value`, and `words`
+   *
+   * @name _
+   * @constructor
+   * @category Seq
+   * @param {*} value The value to wrap in a `lodash` instance.
+   * @returns {Object} Returns the new `lodash` wrapper instance.
+   * @example
+   *
+   * function square(n) {
+   *   return n * n;
+   * }
+   *
+   * var wrapped = _([1, 2, 3]);
+   *
+   * // Returns an unwrapped value.
+   * wrapped.reduce(_.add);
+   * // => 6
+   *
+   * // Returns a wrapped value.
+   * var squares = wrapped.map(square);
+   *
+   * _.isArray(squares);
+   * // => false
+   *
+   * _.isArray(squares.value());
+   * // => true
+   */
+  function lodash(value) {
+    return value instanceof LodashWrapper
+      ? value
+      : new LodashWrapper(value);
+  }
+
+  /**
+   * The base implementation of `_.create` without support for assigning
+   * properties to the created object.
+   *
+   * @private
+   * @param {Object} proto The object to inherit from.
+   * @returns {Object} Returns the new object.
+   */
+  var baseCreate = (function() {
+    function object() {}
+    return function(proto) {
+      if (!isObject(proto)) {
+        return {};
+      }
+      if (objectCreate) {
+        return objectCreate(proto);
+      }
+      object.prototype = proto;
+      var result = new object;
+      object.prototype = undefined;
+      return result;
+    };
+  }());
+
+  /**
+   * The base constructor for creating `lodash` wrapper objects.
+   *
+   * @private
+   * @param {*} value The value to wrap.
+   * @param {boolean} [chainAll] Enable explicit method chain sequences.
+   */
+  function LodashWrapper(value, chainAll) {
+    this.__wrapped__ = value;
+    this.__actions__ = [];
+    this.__chain__ = !!chainAll;
+  }
+
+  LodashWrapper.prototype = baseCreate(lodash.prototype);
+  LodashWrapper.prototype.constructor = LodashWrapper;
+
+  /*------------------------------------------------------------------------*/
+
+  /**
+   * Assigns `value` to `key` of `object` if the existing value is not equivalent
+   * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+   * for equality comparisons.
+   *
+   * @private
+   * @param {Object} object The object to modify.
+   * @param {string} key The key of the property to assign.
+   * @param {*} value The value to assign.
+   */
+  function assignValue(object, key, value) {
+    var objValue = object[key];
+    if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
+        (value === undefined && !(key in object))) {
+      baseAssignValue(object, key, value);
+    }
+  }
+
+  /**
+   * The base implementation of `assignValue` and `assignMergeValue` without
+   * value checks.
+   *
+   * @private
+   * @param {Object} object The object to modify.
+   * @param {string} key The key of the property to assign.
+   * @param {*} value The value to assign.
+   */
+  function baseAssignValue(object, key, value) {
+    object[key] = value;
+  }
+
+  /**
+   * The base implementation of `_.delay` and `_.defer` which accepts `args`
+   * to provide to `func`.
+   *
+   * @private
+   * @param {Function} func The function to delay.
+   * @param {number} wait The number of milliseconds to delay invocation.
+   * @param {Array} args The arguments to provide to `func`.
+   * @returns {number|Object} Returns the timer id or timeout object.
+   */
+  function baseDelay(func, wait, args) {
+    if (typeof func != 'function') {
+      throw new TypeError(FUNC_ERROR_TEXT);
+    }
+    return setTimeout(function() { func.apply(undefined, args); }, wait);
+  }
+
+  /**
+   * The base implementation of `_.forEach` without support for iteratee shorthands.
+   *
+   * @private
+   * @param {Array|Object} collection The collection to iterate over.
+   * @param {Function} iteratee The function invoked per iteration.
+   * @returns {Array|Object} Returns `collection`.
+   */
+  var baseEach = createBaseEach(baseForOwn);
+
+  /**
+   * The base implementation of `_.every` without support for iteratee shorthands.
+   *
+   * @private
+   * @param {Array|Object} collection The collection to iterate over.
+   * @param {Function} predicate The function invoked per iteration.
+   * @returns {boolean} Returns `true` if all elements pass the predicate check,
+   *  else `false`
+   */
+  function baseEvery(collection, predicate) {
+    var result = true;
+    baseEach(collection, function(value, index, collection) {
+      result = !!predicate(value, index, collection);
+      return result;
+    });
+    return result;
+  }
+
+  /**
+   * The base implementation of methods like `_.max` and `_.min` which accepts a
+   * `comparator` to determine the extremum value.
+   *
+   * @private
+   * @param {Array} array The array to iterate over.
+   * @param {Function} iteratee The iteratee invoked per iteration.
+   * @param {Function} comparator The comparator used to compare values.
+   * @returns {*} Returns the extremum value.
+   */
+  function baseExtremum(array, iteratee, comparator) {
+    var index = -1,
+        length = array.length;
+
+    while (++index < length) {
+      var value = array[index],
+          current = iteratee(value);
+
+      if (current != null && (computed === undefined
+            ? (current === current && !false)
+            : comparator(current, computed)
+          )) {
+        var computed = current,
+            result = value;
+      }
+    }
+    return result;
+  }
+
+  /**
+   * The base implementation of `_.filter` without support for iteratee shorthands.
+   *
+   * @private
+   * @param {Array|Object} collection The collection to iterate over.
+   * @param {Function} predicate The function invoked per iteration.
+   * @returns {Array} Returns the new filtered array.
+   */
+  function baseFilter(collection, predicate) {
+    var result = [];
+    baseEach(collection, function(value, index, collection) {
+      if (predicate(value, index, collection)) {
+        result.push(value);
+      }
+    });
+    return result;
+  }
+
+  /**
+   * The base implementation of `_.flatten` with support for restricting flattening.
+   *
+   * @private
+   * @param {Array} array The array to flatten.
+   * @param {number} depth The maximum recursion depth.
+   * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
+   * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
+   * @param {Array} [result=[]] The initial result value.
+   * @returns {Array} Returns the new flattened array.
+   */
+  function baseFlatten(array, depth, predicate, isStrict, result) {
+    var index = -1,
+        length = array.length;
+
+    predicate || (predicate = isFlattenable);
+    result || (result = []);
+
+    while (++index < length) {
+      var value = array[index];
+      if (depth > 0 && predicate(value)) {
+        if (depth > 1) {
+          // Recursively flatten arrays (susceptible to call stack limits).
+          baseFlatten(value, depth - 1, predicate, isStrict, result);
+        } else {
+          arrayPush(result, value);
+        }
+      } else if (!isStrict) {
+        result[result.length] = value;
+      }
+    }
+    return result;
+  }
+
+  /**
+   * The base implementation of `baseForOwn` which iterates over `object`
+   * properties returned by `keysFunc` and invokes `iteratee` for each property.
+   * Iteratee functions may exit iteration early by explicitly returning `false`.
+   *
+   * @private
+   * @param {Object} object The object to iterate over.
+   * @param {Function} iteratee The function invoked per iteration.
+   * @param {Function} keysFunc The function to get the keys of `object`.
+   * @returns {Object} Returns `object`.
+   */
+  var baseFor = createBaseFor();
+
+  /**
+   * The base implementation of `_.forOwn` without support for iteratee shorthands.
+   *
+   * @private
+   * @param {Object} object The object to iterate over.
+   * @param {Function} iteratee The function invoked per iteration.
+   * @returns {Object} Returns `object`.
+   */
+  function baseForOwn(object, iteratee) {
+    return object && baseFor(object, iteratee, keys);
+  }
+
+  /**
+   * The base implementation of `_.functions` which creates an array of
+   * `object` function property names filtered from `props`.
+   *
+   * @private
+   * @param {Object} object The object to inspect.
+   * @param {Array} props The property names to filter.
+   * @returns {Array} Returns the function names.
+   */
+  function baseFunctions(object, props) {
+    return baseFilter(props, function(key) {
+      return isFunction(object[key]);
+    });
+  }
+
+  /**
+   * The base implementation of `getTag` without fallbacks for buggy environments.
+   *
+   * @private
+   * @param {*} value The value to query.
+   * @returns {string} Returns the `toStringTag`.
+   */
+  function baseGetTag(value) {
+    return objectToString(value);
+  }
+
+  /**
+   * The base implementation of `_.gt` which doesn't coerce arguments.
+   *
+   * @private
+   * @param {*} value The value to compare.
+   * @param {*} other The other value to compare.
+   * @returns {boolean} Returns `true` if `value` is greater than `other`,
+   *  else `false`.
+   */
+  function baseGt(value, other) {
+    return value > other;
+  }
+
+  /**
+   * The base implementation of `_.isArguments`.
+   *
+   * @private
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is an `arguments` object,
+   */
+  var baseIsArguments = noop;
+
+  /**
+   * The base implementation of `_.isDate` without Node.js optimizations.
+   *
+   * @private
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
+   */
+  function baseIsDate(value) {
+    return isObjectLike(value) && baseGetTag(value) == dateTag;
+  }
+
+  /**
+   * The base implementation of `_.isEqual` which supports partial comparisons
+   * and tracks traversed objects.
+   *
+   * @private
+   * @param {*} value The value to compare.
+   * @param {*} other The other value to compare.
+   * @param {boolean} bitmask The bitmask flags.
+   *  1 - Unordered comparison
+   *  2 - Partial comparison
+   * @param {Function} [customizer] The function to customize comparisons.
+   * @param {Object} [stack] Tracks traversed `value` and `other` objects.
+   * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+   */
+  function baseIsEqual(value, other, bitmask, customizer, stack) {
+    if (value === other) {
+      return true;
+    }
+    if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
+      return value !== value && other !== other;
+    }
+    return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
+  }
+
+  /**
+   * A specialized version of `baseIsEqual` for arrays and objects which performs
+   * deep comparisons and tracks traversed objects enabling objects with circular
+   * references to be compared.
+   *
+   * @private
+   * @param {Object} object The object to compare.
+   * @param {Object} other The other object to compare.
+   * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
+   * @param {Function} customizer The function to customize comparisons.
+   * @param {Function} equalFunc The function to determine equivalents of values.
+   * @param {Object} [stack] Tracks traversed `object` and `other` objects.
+   * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+   */
+  function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
+    var objIsArr = isArray(object),
+        othIsArr = isArray(other),
+        objTag = objIsArr ? arrayTag : baseGetTag(object),
+        othTag = othIsArr ? arrayTag : baseGetTag(other);
+
+    objTag = objTag == argsTag ? objectTag : objTag;
+    othTag = othTag == argsTag ? objectTag : othTag;
+
+    var objIsObj = objTag == objectTag,
+        othIsObj = othTag == objectTag,
+        isSameTag = objTag == othTag;
+
+    stack || (stack = []);
+    var objStack = find(stack, function(entry) {
+      return entry[0] == object;
+    });
+    var othStack = find(stack, function(entry) {
+      return entry[0] == other;
+    });
+    if (objStack && othStack) {
+      return objStack[1] == other;
+    }
+    stack.push([object, other]);
+    stack.push([other, object]);
+    if (isSameTag && !objIsObj) {
+      var result = (objIsArr)
+        ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
+        : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
+      stack.pop();
+      return result;
+    }
+    if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
+      var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
+          othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
+
+      if (objIsWrapped || othIsWrapped) {
+        var objUnwrapped = objIsWrapped ? object.value() : object,
+            othUnwrapped = othIsWrapped ? other.value() : other;
+
+        var result = equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
+        stack.pop();
+        return result;
+      }
+    }
+    if (!isSameTag) {
+      return false;
+    }
+    var result = equalObjects(object, other, bitmask, customizer, equalFunc, stack);
+    stack.pop();
+    return result;
+  }
+
+  /**
+   * The base implementation of `_.isRegExp` without Node.js optimizations.
+   *
+   * @private
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
+   */
+  function baseIsRegExp(value) {
+    return isObjectLike(value) && baseGetTag(value) == regexpTag;
+  }
+
+  /**
+   * The base implementation of `_.iteratee`.
+   *
+   * @private
+   * @param {*} [value=_.identity] The value to convert to an iteratee.
+   * @returns {Function} Returns the iteratee.
+   */
+  function baseIteratee(func) {
+    if (typeof func == 'function') {
+      return func;
+    }
+    if (func == null) {
+      return identity;
+    }
+    return (typeof func == 'object' ? baseMatches : baseProperty)(func);
+  }
+
+  /**
+   * The base implementation of `_.lt` which doesn't coerce arguments.
+   *
+   * @private
+   * @param {*} value The value to compare.
+   * @param {*} other The other value to compare.
+   * @returns {boolean} Returns `true` if `value` is less than `other`,
+   *  else `false`.
+   */
+  function baseLt(value, other) {
+    return value < other;
+  }
+
+  /**
+   * The base implementation of `_.map` without support for iteratee shorthands.
+   *
+   * @private
+   * @param {Array|Object} collection The collection to iterate over.
+   * @param {Function} iteratee The function invoked per iteration.
+   * @returns {Array} Returns the new mapped array.
+   */
+  function baseMap(collection, iteratee) {
+    var index = -1,
+        result = isArrayLike(collection) ? Array(collection.length) : [];
+
+    baseEach(collection, function(value, key, collection) {
+      result[++index] = iteratee(value, key, collection);
+    });
+    return result;
+  }
+
+  /**
+   * The base implementation of `_.matches` which doesn't clone `source`.
+   *
+   * @private
+   * @param {Object} source The object of property values to match.
+   * @returns {Function} Returns the new spec function.
+   */
+  function baseMatches(source) {
+    var props = nativeKeys(source);
+    return function(object) {
+      var length = props.length;
+      if (object == null) {
+        return !length;
+      }
+      object = Object(object);
+      while (length--) {
+        var key = props[length];
+        if (!(key in object &&
+              baseIsEqual(source[key], object[key], COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG)
+            )) {
+          return false;
+        }
+      }
+      return true;
+    };
+  }
+
+  /**
+   * The base implementation of `_.pick` without support for individual
+   * property identifiers.
+   *
+   * @private
+   * @param {Object} object The source object.
+   * @param {string[]} paths The property paths to pick.
+   * @returns {Object} Returns the new object.
+   */
+  function basePick(object, props) {
+    object = Object(object);
+    return reduce(props, function(result, key) {
+      if (key in object) {
+        result[key] = object[key];
+      }
+      return result;
+    }, {});
+  }
+
+  /**
+   * The base implementation of `_.rest` which doesn't validate or coerce arguments.
+   *
+   * @private
+   * @param {Function} func The function to apply a rest parameter to.
+   * @param {number} [start=func.length-1] The start position of the rest parameter.
+   * @returns {Function} Returns the new function.
+   */
+  function baseRest(func, start) {
+    return setToString(overRest(func, start, identity), func + '');
+  }
+
+  /**
+   * The base implementation of `_.slice` without an iteratee call guard.
+   *
+   * @private
+   * @param {Array} array The array to slice.
+   * @param {number} [start=0] The start position.
+   * @param {number} [end=array.length] The end position.
+   * @returns {Array} Returns the slice of `array`.
+   */
+  function baseSlice(array, start, end) {
+    var index = -1,
+        length = array.length;
+
+    if (start < 0) {
+      start = -start > length ? 0 : (length + start);
+    }
+    end = end > length ? length : end;
+    if (end < 0) {
+      end += length;
+    }
+    length = start > end ? 0 : ((end - start) >>> 0);
+    start >>>= 0;
+
+    var result = Array(length);
+    while (++index < length) {
+      result[index] = array[index + start];
+    }
+    return result;
+  }
+
+  /**
+   * Copies the values of `source` to `array`.
+   *
+   * @private
+   * @param {Array} source The array to copy values from.
+   * @param {Array} [array=[]] The array to copy values to.
+   * @returns {Array} Returns `array`.
+   */
+  function copyArray(source) {
+    return baseSlice(source, 0, source.length);
+  }
+
+  /**
+   * The base implementation of `_.some` without support for iteratee shorthands.
+   *
+   * @private
+   * @param {Array|Object} collection The collection to iterate over.
+   * @param {Function} predicate The function invoked per iteration.
+   * @returns {boolean} Returns `true` if any element passes the predicate check,
+   *  else `false`.
+   */
+  function baseSome(collection, predicate) {
+    var result;
+
+    baseEach(collection, function(value, index, collection) {
+      result = predicate(value, index, collection);
+      return !result;
+    });
+    return !!result;
+  }
+
+  /**
+   * The base implementation of `wrapperValue` which returns the result of
+   * performing a sequence of actions on the unwrapped `value`, where each
+   * successive action is supplied the return value of the previous.
+   *
+   * @private
+   * @param {*} value The unwrapped value.
+   * @param {Array} actions Actions to perform to resolve the unwrapped value.
+   * @returns {*} Returns the resolved value.
+   */
+  function baseWrapperValue(value, actions) {
+    var result = value;
+    return reduce(actions, function(result, action) {
+      return action.func.apply(action.thisArg, arrayPush([result], action.args));
+    }, result);
+  }
+
+  /**
+   * Compares values to sort them in ascending order.
+   *
+   * @private
+   * @param {*} value The value to compare.
+   * @param {*} other The other value to compare.
+   * @returns {number} Returns the sort order indicator for `value`.
+   */
+  function compareAscending(value, other) {
+    if (value !== other) {
+      var valIsDefined = value !== undefined,
+          valIsNull = value === null,
+          valIsReflexive = value === value,
+          valIsSymbol = false;
+
+      var othIsDefined = other !== undefined,
+          othIsNull = other === null,
+          othIsReflexive = other === other,
+          othIsSymbol = false;
+
+      if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
+          (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
+          (valIsNull && othIsDefined && othIsReflexive) ||
+          (!valIsDefined && othIsReflexive) ||
+          !valIsReflexive) {
+        return 1;
+      }
+      if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
+          (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
+          (othIsNull && valIsDefined && valIsReflexive) ||
+          (!othIsDefined && valIsReflexive) ||
+          !othIsReflexive) {
+        return -1;
+      }
+    }
+    return 0;
+  }
+
+  /**
+   * Copies properties of `source` to `object`.
+   *
+   * @private
+   * @param {Object} source The object to copy properties from.
+   * @param {Array} props The property identifiers to copy.
+   * @param {Object} [object={}] The object to copy properties to.
+   * @param {Function} [customizer] The function to customize copied values.
+   * @returns {Object} Returns `object`.
+   */
+  function copyObject(source, props, object, customizer) {
+    var isNew = !object;
+    object || (object = {});
+
+    var index = -1,
+        length = props.length;
+
+    while (++index < length) {
+      var key = props[index];
+
+      var newValue = customizer
+        ? customizer(object[key], source[key], key, object, source)
+        : undefined;
+
+      if (newValue === undefined) {
+        newValue = source[key];
+      }
+      if (isNew) {
+        baseAssignValue(object, key, newValue);
+      } else {
+        assignValue(object, key, newValue);
+      }
+    }
+    return object;
+  }
+
+  /**
+   * Creates a function like `_.assign`.
+   *
+   * @private
+   * @param {Function} assigner The function to assign values.
+   * @returns {Function} Returns the new assigner function.
+   */
+  function createAssigner(assigner) {
+    return baseRest(function(object, sources) {
+      var index = -1,
+          length = sources.length,
+          customizer = length > 1 ? sources[length - 1] : undefined;
+
+      customizer = (assigner.length > 3 && typeof customizer == 'function')
+        ? (length--, customizer)
+        : undefined;
+
+      object = Object(object);
+      while (++index < length) {
+        var source = sources[index];
+        if (source) {
+          assigner(object, source, index, customizer);
+        }
+      }
+      return object;
+    });
+  }
+
+  /**
+   * Creates a `baseEach` or `baseEachRight` function.
+   *
+   * @private
+   * @param {Function} eachFunc The function to iterate over a collection.
+   * @param {boolean} [fromRight] Specify iterating from right to left.
+   * @returns {Function} Returns the new base function.
+   */
+  function createBaseEach(eachFunc, fromRight) {
+    return function(collection, iteratee) {
+      if (collection == null) {
+        return collection;
+      }
+      if (!isArrayLike(collection)) {
+        return eachFunc(collection, iteratee);
+      }
+      var length = collection.length,
+          index = fromRight ? length : -1,
+          iterable = Object(collection);
+
+      while ((fromRight ? index-- : ++index < length)) {
+        if (iteratee(iterable[index], index, iterable) === false) {
+          break;
+        }
+      }
+      return collection;
+    };
+  }
+
+  /**
+   * Creates a base function for methods like `_.forIn` and `_.forOwn`.
+   *
+   * @private
+   * @param {boolean} [fromRight] Specify iterating from right to left.
+   * @returns {Function} Returns the new base function.
+   */
+  function createBaseFor(fromRight) {
+    return function(object, iteratee, keysFunc) {
+      var index = -1,
+          iterable = Object(object),
+          props = keysFunc(object),
+          length = props.length;
+
+      while (length--) {
+        var key = props[fromRight ? length : ++index];
+        if (iteratee(iterable[key], key, iterable) === false) {
+          break;
+        }
+      }
+      return object;
+    };
+  }
+
+  /**
+   * Creates a function that produces an instance of `Ctor` regardless of
+   * whether it was invoked as part of a `new` expression or by `call` or `apply`.
+   *
+   * @private
+   * @param {Function} Ctor The constructor to wrap.
+   * @returns {Function} Returns the new wrapped function.
+   */
+  function createCtor(Ctor) {
+    return function() {
+      // Use a `switch` statement to work with class constructors. See
+      // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
+      // for more details.
+      var args = arguments;
+      var thisBinding = baseCreate(Ctor.prototype),
+          result = Ctor.apply(thisBinding, args);
+
+      // Mimic the constructor's `return` behavior.
+      // See https://es5.github.io/#x13.2.2 for more details.
+      return isObject(result) ? result : thisBinding;
+    };
+  }
+
+  /**
+   * Creates a `_.find` or `_.findLast` function.
+   *
+   * @private
+   * @param {Function} findIndexFunc The function to find the collection index.
+   * @returns {Function} Returns the new find function.
+   */
+  function createFind(findIndexFunc) {
+    return function(collection, predicate, fromIndex) {
+      var iterable = Object(collection);
+      if (!isArrayLike(collection)) {
+        var iteratee = baseIteratee(predicate, 3);
+        collection = keys(collection);
+        predicate = function(key) { return iteratee(iterable[key], key, iterable); };
+      }
+      var index = findIndexFunc(collection, predicate, fromIndex);
+      return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
+    };
+  }
+
+  /**
+   * Creates a function that wraps `func` to invoke it with the `this` binding
+   * of `thisArg` and `partials` prepended to the arguments it receives.
+   *
+   * @private
+   * @param {Function} func The function to wrap.
+   * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+   * @param {*} thisArg The `this` binding of `func`.
+   * @param {Array} partials The arguments to prepend to those provided to
+   *  the new function.
+   * @returns {Function} Returns the new wrapped function.
+   */
+  function createPartial(func, bitmask, thisArg, partials) {
+    if (typeof func != 'function') {
+      throw new TypeError(FUNC_ERROR_TEXT);
+    }
+    var isBind = bitmask & WRAP_BIND_FLAG,
+        Ctor = createCtor(func);
+
+    function wrapper() {
+      var argsIndex = -1,
+          argsLength = arguments.length,
+          leftIndex = -1,
+          leftLength = partials.length,
+          args = Array(leftLength + argsLength),
+          fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
+
+      while (++leftIndex < leftLength) {
+        args[leftIndex] = partials[leftIndex];
+      }
+      while (argsLength--) {
+        args[leftIndex++] = arguments[++argsIndex];
+      }
+      return fn.apply(isBind ? thisArg : this, args);
+    }
+    return wrapper;
+  }
+
+  /**
+   * A specialized version of `baseIsEqualDeep` for arrays with support for
+   * partial deep comparisons.
+   *
+   * @private
+   * @param {Array} array The array to compare.
+   * @param {Array} other The other array to compare.
+   * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
+   * @param {Function} customizer The function to customize comparisons.
+   * @param {Function} equalFunc The function to determine equivalents of values.
+   * @param {Object} stack Tracks traversed `array` and `other` objects.
+   * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
+   */
+  function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
+    var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
+        arrLength = array.length,
+        othLength = other.length;
+
+    if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
+      return false;
+    }
+    var index = -1,
+        result = true,
+        seen = (bitmask & COMPARE_UNORDERED_FLAG) ? [] : undefined;
+
+    // Ignore non-index properties.
+    while (++index < arrLength) {
+      var arrValue = array[index],
+          othValue = other[index];
+
+      var compared;
+      if (compared !== undefined) {
+        if (compared) {
+          continue;
+        }
+        result = false;
+        break;
+      }
+      // Recursively compare arrays (susceptible to call stack limits).
+      if (seen) {
+        if (!baseSome(other, function(othValue, othIndex) {
+              if (!indexOf(seen, othIndex) &&
+                  (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
+                return seen.push(othIndex);
+              }
+            })) {
+          result = false;
+          break;
+        }
+      } else if (!(
+            arrValue === othValue ||
+              equalFunc(arrValue, othValue, bitmask, customizer, stack)
+          )) {
+        result = false;
+        break;
+      }
+    }
+    return result;
+  }
+
+  /**
+   * A specialized version of `baseIsEqualDeep` for comparing objects of
+   * the same `toStringTag`.
+   *
+   * **Note:** This function only supports comparing values with tags of
+   * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
+   *
+   * @private
+   * @param {Object} object The object to compare.
+   * @param {Object} other The other object to compare.
+   * @param {string} tag The `toStringTag` of the objects to compare.
+   * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
+   * @param {Function} customizer The function to customize comparisons.
+   * @param {Function} equalFunc The function to determine equivalents of values.
+   * @param {Object} stack Tracks traversed `object` and `other` objects.
+   * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+   */
+  function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
+    switch (tag) {
+
+      case boolTag:
+      case dateTag:
+      case numberTag:
+        // Coerce booleans to `1` or `0` and dates to milliseconds.
+        // Invalid dates are coerced to `NaN`.
+        return eq(+object, +other);
+
+      case errorTag:
+        return object.name == other.name && object.message == other.message;
+
+      case regexpTag:
+      case stringTag:
+        // Coerce regexes to strings and treat strings, primitives and objects,
+        // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
+        // for more details.
+        return object == (other + '');
+
+    }
+    return false;
+  }
+
+  /**
+   * A specialized version of `baseIsEqualDeep` for objects with support for
+   * partial deep comparisons.
+   *
+   * @private
+   * @param {Object} object The object to compare.
+   * @param {Object} other The other object to compare.
+   * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
+   * @param {Function} customizer The function to customize comparisons.
+   * @param {Function} equalFunc The function to determine equivalents of values.
+   * @param {Object} stack Tracks traversed `object` and `other` objects.
+   * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+   */
+  function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
+    var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
+        objProps = keys(object),
+        objLength = objProps.length,
+        othProps = keys(other),
+        othLength = othProps.length;
+
+    if (objLength != othLength && !isPartial) {
+      return false;
+    }
+    var index = objLength;
+    while (index--) {
+      var key = objProps[index];
+      if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
+        return false;
+      }
+    }
+    var result = true;
+
+    var skipCtor = isPartial;
+    while (++index < objLength) {
+      key = objProps[index];
+      var objValue = object[key],
+          othValue = other[key];
+
+      var compared;
+      // Recursively compare objects (susceptible to call stack limits).
+      if (!(compared === undefined
+            ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
+            : compared
+          )) {
+        result = false;
+        break;
+      }
+      skipCtor || (skipCtor = key == 'constructor');
+    }
+    if (result && !skipCtor) {
+      var objCtor = object.constructor,
+          othCtor = other.constructor;
+
+      // Non `Object` object instances with different constructors are not equal.
+      if (objCtor != othCtor &&
+          ('constructor' in object && 'constructor' in other) &&
+          !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
+            typeof othCtor == 'function' && othCtor instanceof othCtor)) {
+        result = false;
+      }
+    }
+    return result;
+  }
+
+  /**
+   * A specialized version of `baseRest` which flattens the rest array.
+   *
+   * @private
+   * @param {Function} func The function to apply a rest parameter to.
+   * @returns {Function} Returns the new function.
+   */
+  function flatRest(func) {
+    return setToString(overRest(func, undefined, flatten), func + '');
+  }
+
+  /**
+   * Checks if `value` is a flattenable `arguments` object or array.
+   *
+   * @private
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
+   */
+  function isFlattenable(value) {
+    return isArray(value) || isArguments(value);
+  }
+
+  /**
+   * Checks if `value` is a valid array-like index.
+   *
+   * @private
+   * @param {*} value The value to check.
+   * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
+   * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
+   */
+  function isIndex(value, length) {
+    var type = typeof value;
+    length = length == null ? MAX_SAFE_INTEGER : length;
+
+    return !!length &&
+      (type == 'number' ||
+        (type != 'symbol' && reIsUint.test(value))) &&
+          (value > -1 && value % 1 == 0 && value < length);
+  }
+
+  /**
+   * Checks if the given arguments are from an iteratee call.
+   *
+   * @private
+   * @param {*} value The potential iteratee value argument.
+   * @param {*} index The potential iteratee index or key argument.
+   * @param {*} object The potential iteratee object argument.
+   * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
+   *  else `false`.
+   */
+  function isIterateeCall(value, index, object) {
+    if (!isObject(object)) {
+      return false;
+    }
+    var type = typeof index;
+    if (type == 'number'
+          ? (isArrayLike(object) && isIndex(index, object.length))
+          : (type == 'string' && index in object)
+        ) {
+      return eq(object[index], value);
+    }
+    return false;
+  }
+
+  /**
+   * This function is like
+   * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
+   * except that it includes inherited enumerable properties.
+   *
+   * @private
+   * @param {Object} object The object to query.
+   * @returns {Array} Returns the array of property names.
+   */
+  function nativeKeysIn(object) {
+    var result = [];
+    if (object != null) {
+      for (var key in Object(object)) {
+        result.push(key);
+      }
+    }
+    return result;
+  }
+
+  /**
+   * Converts `value` to a string using `Object.prototype.toString`.
+   *
+   * @private
+   * @param {*} value The value to convert.
+   * @returns {string} Returns the converted string.
+   */
+  function objectToString(value) {
+    return nativeObjectToString.call(value);
+  }
+
+  /**
+   * A specialized version of `baseRest` which transforms the rest array.
+   *
+   * @private
+   * @param {Function} func The function to apply a rest parameter to.
+   * @param {number} [start=func.length-1] The start position of the rest parameter.
+   * @param {Function} transform The rest array transform.
+   * @returns {Function} Returns the new function.
+   */
+  function overRest(func, start, transform) {
+    start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
+    return function() {
+      var args = arguments,
+          index = -1,
+          length = nativeMax(args.length - start, 0),
+          array = Array(length);
+
+      while (++index < length) {
+        array[index] = args[start + index];
+      }
+      index = -1;
+      var otherArgs = Array(start + 1);
+      while (++index < start) {
+        otherArgs[index] = args[index];
+      }
+      otherArgs[start] = transform(array);
+      return func.apply(this, otherArgs);
+    };
+  }
+
+  /**
+   * Sets the `toString` method of `func` to return `string`.
+   *
+   * @private
+   * @param {Function} func The function to modify.
+   * @param {Function} string The `toString` result.
+   * @returns {Function} Returns `func`.
+   */
+  var setToString = identity;
+
+  /*------------------------------------------------------------------------*/
+
+  /**
+   * Creates an array with all falsey values removed. The values `false`, `null`,
+   * `0`, `""`, `undefined`, and `NaN` are falsey.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Array
+   * @param {Array} array The array to compact.
+   * @returns {Array} Returns the new array of filtered values.
+   * @example
+   *
+   * _.compact([0, 1, false, 2, '', 3]);
+   * // => [1, 2, 3]
+   */
+  function compact(array) {
+    return baseFilter(array, Boolean);
+  }
+
+  /**
+   * Creates a new array concatenating `array` with any additional arrays
+   * and/or values.
+   *
+   * @static
+   * @memberOf _
+   * @since 4.0.0
+   * @category Array
+   * @param {Array} array The array to concatenate.
+   * @param {...*} [values] The values to concatenate.
+   * @returns {Array} Returns the new concatenated array.
+   * @example
+   *
+   * var array = [1];
+   * var other = _.concat(array, 2, [3], [[4]]);
+   *
+   * console.log(other);
+   * // => [1, 2, 3, [4]]
+   *
+   * console.log(array);
+   * // => [1]
+   */
+  function concat() {
+    var length = arguments.length;
+    if (!length) {
+      return [];
+    }
+    var args = Array(length - 1),
+        array = arguments[0],
+        index = length;
+
+    while (index--) {
+      args[index - 1] = arguments[index];
+    }
+    return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
+  }
+
+  /**
+   * This method is like `_.find` except that it returns the index of the first
+   * element `predicate` returns truthy for instead of the element itself.
+   *
+   * @static
+   * @memberOf _
+   * @since 1.1.0
+   * @category Array
+   * @param {Array} array The array to inspect.
+   * @param {Function} [predicate=_.identity] The function invoked per iteration.
+   * @param {number} [fromIndex=0] The index to search from.
+   * @returns {number} Returns the index of the found element, else `-1`.
+   * @example
+   *
+   * var users = [
+   *   { 'user': 'barney',  'active': false },
+   *   { 'user': 'fred',    'active': false },
+   *   { 'user': 'pebbles', 'active': true }
+   * ];
+   *
+   * _.findIndex(users, function(o) { return o.user == 'barney'; });
+   * // => 0
+   *
+   * // The `_.matches` iteratee shorthand.
+   * _.findIndex(users, { 'user': 'fred', 'active': false });
+   * // => 1
+   *
+   * // The `_.matchesProperty` iteratee shorthand.
+   * _.findIndex(users, ['active', false]);
+   * // => 0
+   *
+   * // The `_.property` iteratee shorthand.
+   * _.findIndex(users, 'active');
+   * // => 2
+   */
+  function findIndex(array, predicate, fromIndex) {
+    var length = array == null ? 0 : array.length;
+    if (!length) {
+      return -1;
+    }
+    var index = fromIndex == null ? 0 : toInteger(fromIndex);
+    if (index < 0) {
+      index = nativeMax(length + index, 0);
+    }
+    return baseFindIndex(array, baseIteratee(predicate, 3), index);
+  }
+
+  /**
+   * Flattens `array` a single level deep.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Array
+   * @param {Array} array The array to flatten.
+   * @returns {Array} Returns the new flattened array.
+   * @example
+   *
+   * _.flatten([1, [2, [3, [4]], 5]]);
+   * // => [1, 2, [3, [4]], 5]
+   */
+  function flatten(array) {
+    var length = array == null ? 0 : array.length;
+    return length ? baseFlatten(array, 1) : [];
+  }
+
+  /**
+   * Recursively flattens `array`.
+   *
+   * @static
+   * @memberOf _
+   * @since 3.0.0
+   * @category Array
+   * @param {Array} array The array to flatten.
+   * @returns {Array} Returns the new flattened array.
+   * @example
+   *
+   * _.flattenDeep([1, [2, [3, [4]], 5]]);
+   * // => [1, 2, 3, 4, 5]
+   */
+  function flattenDeep(array) {
+    var length = array == null ? 0 : array.length;
+    return length ? baseFlatten(array, INFINITY) : [];
+  }
+
+  /**
+   * Gets the first element of `array`.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @alias first
+   * @category Array
+   * @param {Array} array The array to query.
+   * @returns {*} Returns the first element of `array`.
+   * @example
+   *
+   * _.head([1, 2, 3]);
+   * // => 1
+   *
+   * _.head([]);
+   * // => undefined
+   */
+  function head(array) {
+    return (array && array.length) ? array[0] : undefined;
+  }
+
+  /**
+   * Gets the index at which the first occurrence of `value` is found in `array`
+   * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+   * for equality comparisons. If `fromIndex` is negative, it's used as the
+   * offset from the end of `array`.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Array
+   * @param {Array} array The array to inspect.
+   * @param {*} value The value to search for.
+   * @param {number} [fromIndex=0] The index to search from.
+   * @returns {number} Returns the index of the matched value, else `-1`.
+   * @example
+   *
+   * _.indexOf([1, 2, 1, 2], 2);
+   * // => 1
+   *
+   * // Search from the `fromIndex`.
+   * _.indexOf([1, 2, 1, 2], 2, 2);
+   * // => 3
+   */
+  function indexOf(array, value, fromIndex) {
+    var length = array == null ? 0 : array.length;
+    if (typeof fromIndex == 'number') {
+      fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;
+    } else {
+      fromIndex = 0;
+    }
+    var index = (fromIndex || 0) - 1,
+        isReflexive = value === value;
+
+    while (++index < length) {
+      var other = array[index];
+      if ((isReflexive ? other === value : other !== other)) {
+        return index;
+      }
+    }
+    return -1;
+  }
+
+  /**
+   * Gets the last element of `array`.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Array
+   * @param {Array} array The array to query.
+   * @returns {*} Returns the last element of `array`.
+   * @example
+   *
+   * _.last([1, 2, 3]);
+   * // => 3
+   */
+  function last(array) {
+    var length = array == null ? 0 : array.length;
+    return length ? array[length - 1] : undefined;
+  }
+
+  /**
+   * Creates a slice of `array` from `start` up to, but not including, `end`.
+   *
+   * **Note:** This method is used instead of
+   * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
+   * returned.
+   *
+   * @static
+   * @memberOf _
+   * @since 3.0.0
+   * @category Array
+   * @param {Array} array The array to slice.
+   * @param {number} [start=0] The start position.
+   * @param {number} [end=array.length] The end position.
+   * @returns {Array} Returns the slice of `array`.
+   */
+  function slice(array, start, end) {
+    var length = array == null ? 0 : array.length;
+    start = start == null ? 0 : +start;
+    end = end === undefined ? length : +end;
+    return length ? baseSlice(array, start, end) : [];
+  }
+
+  /*------------------------------------------------------------------------*/
+
+  /**
+   * Creates a `lodash` wrapper instance that wraps `value` with explicit method
+   * chain sequences enabled. The result of such sequences must be unwrapped
+   * with `_#value`.
+   *
+   * @static
+   * @memberOf _
+   * @since 1.3.0
+   * @category Seq
+   * @param {*} value The value to wrap.
+   * @returns {Object} Returns the new `lodash` wrapper instance.
+   * @example
+   *
+   * var users = [
+   *   { 'user': 'barney',  'age': 36 },
+   *   { 'user': 'fred',    'age': 40 },
+   *   { 'user': 'pebbles', 'age': 1 }
+   * ];
+   *
+   * var youngest = _
+   *   .chain(users)
+   *   .sortBy('age')
+   *   .map(function(o) {
+   *     return o.user + ' is ' + o.age;
+   *   })
+   *   .head()
+   *   .value();
+   * // => 'pebbles is 1'
+   */
+  function chain(value) {
+    var result = lodash(value);
+    result.__chain__ = true;
+    return result;
+  }
+
+  /**
+   * This method invokes `interceptor` and returns `value`. The interceptor
+   * is invoked with one argument; (value). The purpose of this method is to
+   * "tap into" a method chain sequence in order to modify intermediate results.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Seq
+   * @param {*} value The value to provide to `interceptor`.
+   * @param {Function} interceptor The function to invoke.
+   * @returns {*} Returns `value`.
+   * @example
+   *
+   * _([1, 2, 3])
+   *  .tap(function(array) {
+   *    // Mutate input array.
+   *    array.pop();
+   *  })
+   *  .reverse()
+   *  .value();
+   * // => [2, 1]
+   */
+  function tap(value, interceptor) {
+    interceptor(value);
+    return value;
+  }
+
+  /**
+   * This method is like `_.tap` except that it returns the result of `interceptor`.
+   * The purpose of this method is to "pass thru" values replacing intermediate
+   * results in a method chain sequence.
+   *
+   * @static
+   * @memberOf _
+   * @since 3.0.0
+   * @category Seq
+   * @param {*} value The value to provide to `interceptor`.
+   * @param {Function} interceptor The function to invoke.
+   * @returns {*} Returns the result of `interceptor`.
+   * @example
+   *
+   * _('  abc  ')
+   *  .chain()
+   *  .trim()
+   *  .thru(function(value) {
+   *    return [value];
+   *  })
+   *  .value();
+   * // => ['abc']
+   */
+  function thru(value, interceptor) {
+    return interceptor(value);
+  }
+
+  /**
+   * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
+   *
+   * @name chain
+   * @memberOf _
+   * @since 0.1.0
+   * @category Seq
+   * @returns {Object} Returns the new `lodash` wrapper instance.
+   * @example
+   *
+   * var users = [
+   *   { 'user': 'barney', 'age': 36 },
+   *   { 'user': 'fred',   'age': 40 }
+   * ];
+   *
+   * // A sequence without explicit chaining.
+   * _(users).head();
+   * // => { 'user': 'barney', 'age': 36 }
+   *
+   * // A sequence with explicit chaining.
+   * _(users)
+   *   .chain()
+   *   .head()
+   *   .pick('user')
+   *   .value();
+   * // => { 'user': 'barney' }
+   */
+  function wrapperChain() {
+    return chain(this);
+  }
+
+  /**
+   * Executes the chain sequence to resolve the unwrapped value.
+   *
+   * @name value
+   * @memberOf _
+   * @since 0.1.0
+   * @alias toJSON, valueOf
+   * @category Seq
+   * @returns {*} Returns the resolved unwrapped value.
+   * @example
+   *
+   * _([1, 2, 3]).value();
+   * // => [1, 2, 3]
+   */
+  function wrapperValue() {
+    return baseWrapperValue(this.__wrapped__, this.__actions__);
+  }
+
+  /*------------------------------------------------------------------------*/
+
+  /**
+   * Checks if `predicate` returns truthy for **all** elements of `collection`.
+   * Iteration is stopped once `predicate` returns falsey. The predicate is
+   * invoked with three arguments: (value, index|key, collection).
+   *
+   * **Note:** This method returns `true` for
+   * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
+   * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
+   * elements of empty collections.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Collection
+   * @param {Array|Object} collection The collection to iterate over.
+   * @param {Function} [predicate=_.identity] The function invoked per iteration.
+   * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+   * @returns {boolean} Returns `true` if all elements pass the predicate check,
+   *  else `false`.
+   * @example
+   *
+   * _.every([true, 1, null, 'yes'], Boolean);
+   * // => false
+   *
+   * var users = [
+   *   { 'user': 'barney', 'age': 36, 'active': false },
+   *   { 'user': 'fred',   'age': 40, 'active': false }
+   * ];
+   *
+   * // The `_.matches` iteratee shorthand.
+   * _.every(users, { 'user': 'barney', 'active': false });
+   * // => false
+   *
+   * // The `_.matchesProperty` iteratee shorthand.
+   * _.every(users, ['active', false]);
+   * // => true
+   *
+   * // The `_.property` iteratee shorthand.
+   * _.every(users, 'active');
+   * // => false
+   */
+  function every(collection, predicate, guard) {
+    predicate = guard ? undefined : predicate;
+    return baseEvery(collection, baseIteratee(predicate));
+  }
+
+  /**
+   * Iterates over elements of `collection`, returning an array of all elements
+   * `predicate` returns truthy for. The predicate is invoked with three
+   * arguments: (value, index|key, collection).
+   *
+   * **Note:** Unlike `_.remove`, this method returns a new array.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Collection
+   * @param {Array|Object} collection The collection to iterate over.
+   * @param {Function} [predicate=_.identity] The function invoked per iteration.
+   * @returns {Array} Returns the new filtered array.
+   * @see _.reject
+   * @example
+   *
+   * var users = [
+   *   { 'user': 'barney', 'age': 36, 'active': true },
+   *   { 'user': 'fred',   'age': 40, 'active': false }
+   * ];
+   *
+   * _.filter(users, function(o) { return !o.active; });
+   * // => objects for ['fred']
+   *
+   * // The `_.matches` iteratee shorthand.
+   * _.filter(users, { 'age': 36, 'active': true });
+   * // => objects for ['barney']
+   *
+   * // The `_.matchesProperty` iteratee shorthand.
+   * _.filter(users, ['active', false]);
+   * // => objects for ['fred']
+   *
+   * // The `_.property` iteratee shorthand.
+   * _.filter(users, 'active');
+   * // => objects for ['barney']
+   */
+  function filter(collection, predicate) {
+    return baseFilter(collection, baseIteratee(predicate));
+  }
+
+  /**
+   * Iterates over elements of `collection`, returning the first element
+   * `predicate` returns truthy for. The predicate is invoked with three
+   * arguments: (value, index|key, collection).
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Collection
+   * @param {Array|Object} collection The collection to inspect.
+   * @param {Function} [predicate=_.identity] The function invoked per iteration.
+   * @param {number} [fromIndex=0] The index to search from.
+   * @returns {*} Returns the matched element, else `undefined`.
+   * @example
+   *
+   * var users = [
+   *   { 'user': 'barney',  'age': 36, 'active': true },
+   *   { 'user': 'fred',    'age': 40, 'active': false },
+   *   { 'user': 'pebbles', 'age': 1,  'active': true }
+   * ];
+   *
+   * _.find(users, function(o) { return o.age < 40; });
+   * // => object for 'barney'
+   *
+   * // The `_.matches` iteratee shorthand.
+   * _.find(users, { 'age': 1, 'active': true });
+   * // => object for 'pebbles'
+   *
+   * // The `_.matchesProperty` iteratee shorthand.
+   * _.find(users, ['active', false]);
+   * // => object for 'fred'
+   *
+   * // The `_.property` iteratee shorthand.
+   * _.find(users, 'active');
+   * // => object for 'barney'
+   */
+  var find = createFind(findIndex);
+
+  /**
+   * Iterates over elements of `collection` and invokes `iteratee` for each element.
+   * The iteratee is invoked with three arguments: (value, index|key, collection).
+   * Iteratee functions may exit iteration early by explicitly returning `false`.
+   *
+   * **Note:** As with other "Collections" methods, objects with a "length"
+   * property are iterated like arrays. To avoid this behavior use `_.forIn`
+   * or `_.forOwn` for object iteration.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @alias each
+   * @category Collection
+   * @param {Array|Object} collection The collection to iterate over.
+   * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+   * @returns {Array|Object} Returns `collection`.
+   * @see _.forEachRight
+   * @example
+   *
+   * _.forEach([1, 2], function(value) {
+   *   console.log(value);
+   * });
+   * // => Logs `1` then `2`.
+   *
+   * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
+   *   console.log(key);
+   * });
+   * // => Logs 'a' then 'b' (iteration order is not guaranteed).
+   */
+  function forEach(collection, iteratee) {
+    return baseEach(collection, baseIteratee(iteratee));
+  }
+
+  /**
+   * Creates an array of values by running each element in `collection` thru
+   * `iteratee`. The iteratee is invoked with three arguments:
+   * (value, index|key, collection).
+   *
+   * Many lodash methods are guarded to work as iteratees for methods like
+   * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
+   *
+   * The guarded methods are:
+   * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
+   * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
+   * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
+   * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Collection
+   * @param {Array|Object} collection The collection to iterate over.
+   * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+   * @returns {Array} Returns the new mapped array.
+   * @example
+   *
+   * function square(n) {
+   *   return n * n;
+   * }
+   *
+   * _.map([4, 8], square);
+   * // => [16, 64]
+   *
+   * _.map({ 'a': 4, 'b': 8 }, square);
+   * // => [16, 64] (iteration order is not guaranteed)
+   *
+   * var users = [
+   *   { 'user': 'barney' },
+   *   { 'user': 'fred' }
+   * ];
+   *
+   * // The `_.property` iteratee shorthand.
+   * _.map(users, 'user');
+   * // => ['barney', 'fred']
+   */
+  function map(collection, iteratee) {
+    return baseMap(collection, baseIteratee(iteratee));
+  }
+
+  /**
+   * Reduces `collection` to a value which is the accumulated result of running
+   * each element in `collection` thru `iteratee`, where each successive
+   * invocation is supplied the return value of the previous. If `accumulator`
+   * is not given, the first element of `collection` is used as the initial
+   * value. The iteratee is invoked with four arguments:
+   * (accumulator, value, index|key, collection).
+   *
+   * Many lodash methods are guarded to work as iteratees for methods like
+   * `_.reduce`, `_.reduceRight`, and `_.transform`.
+   *
+   * The guarded methods are:
+   * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
+   * and `sortBy`
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Collection
+   * @param {Array|Object} collection The collection to iterate over.
+   * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+   * @param {*} [accumulator] The initial value.
+   * @returns {*} Returns the accumulated value.
+   * @see _.reduceRight
+   * @example
+   *
+   * _.reduce([1, 2], function(sum, n) {
+   *   return sum + n;
+   * }, 0);
+   * // => 3
+   *
+   * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
+   *   (result[value] || (result[value] = [])).push(key);
+   *   return result;
+   * }, {});
+   * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
+   */
+  function reduce(collection, iteratee, accumulator) {
+    return baseReduce(collection, baseIteratee(iteratee), accumulator, arguments.length < 3, baseEach);
+  }
+
+  /**
+   * Gets the size of `collection` by returning its length for array-like
+   * values or the number of own enumerable string keyed properties for objects.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Collection
+   * @param {Array|Object|string} collection The collection to inspect.
+   * @returns {number} Returns the collection size.
+   * @example
+   *
+   * _.size([1, 2, 3]);
+   * // => 3
+   *
+   * _.size({ 'a': 1, 'b': 2 });
+   * // => 2
+   *
+   * _.size('pebbles');
+   * // => 7
+   */
+  function size(collection) {
+    if (collection == null) {
+      return 0;
+    }
+    collection = isArrayLike(collection) ? collection : nativeKeys(collection);
+    return collection.length;
+  }
+
+  /**
+   * Checks if `predicate` returns truthy for **any** element of `collection`.
+   * Iteration is stopped once `predicate` returns truthy. The predicate is
+   * invoked with three arguments: (value, index|key, collection).
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Collection
+   * @param {Array|Object} collection The collection to iterate over.
+   * @param {Function} [predicate=_.identity] The function invoked per iteration.
+   * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+   * @returns {boolean} Returns `true` if any element passes the predicate check,
+   *  else `false`.
+   * @example
+   *
+   * _.some([null, 0, 'yes', false], Boolean);
+   * // => true
+   *
+   * var users = [
+   *   { 'user': 'barney', 'active': true },
+   *   { 'user': 'fred',   'active': false }
+   * ];
+   *
+   * // The `_.matches` iteratee shorthand.
+   * _.some(users, { 'user': 'barney', 'active': false });
+   * // => false
+   *
+   * // The `_.matchesProperty` iteratee shorthand.
+   * _.some(users, ['active', false]);
+   * // => true
+   *
+   * // The `_.property` iteratee shorthand.
+   * _.some(users, 'active');
+   * // => true
+   */
+  function some(collection, predicate, guard) {
+    predicate = guard ? undefined : predicate;
+    return baseSome(collection, baseIteratee(predicate));
+  }
+
+  /**
+   * Creates an array of elements, sorted in ascending order by the results of
+   * running each element in a collection thru each iteratee. This method
+   * performs a stable sort, that is, it preserves the original sort order of
+   * equal elements. The iteratees are invoked with one argument: (value).
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Collection
+   * @param {Array|Object} collection The collection to iterate over.
+   * @param {...(Function|Function[])} [iteratees=[_.identity]]
+   *  The iteratees to sort by.
+   * @returns {Array} Returns the new sorted array.
+   * @example
+   *
+   * var users = [
+   *   { 'user': 'fred',   'age': 48 },
+   *   { 'user': 'barney', 'age': 36 },
+   *   { 'user': 'fred',   'age': 40 },
+   *   { 'user': 'barney', 'age': 34 }
+   * ];
+   *
+   * _.sortBy(users, [function(o) { return o.user; }]);
+   * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
+   *
+   * _.sortBy(users, ['user', 'age']);
+   * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
+   */
+  function sortBy(collection, iteratee) {
+    var index = 0;
+    iteratee = baseIteratee(iteratee);
+
+    return baseMap(baseMap(collection, function(value, key, collection) {
+      return { 'value': value, 'index': index++, 'criteria': iteratee(value, key, collection) };
+    }).sort(function(object, other) {
+      return compareAscending(object.criteria, other.criteria) || (object.index - other.index);
+    }), baseProperty('value'));
+  }
+
+  /*------------------------------------------------------------------------*/
+
+  /**
+   * Creates a function that invokes `func`, with the `this` binding and arguments
+   * of the created function, while it's called less than `n` times. Subsequent
+   * calls to the created function return the result of the last `func` invocation.
+   *
+   * @static
+   * @memberOf _
+   * @since 3.0.0
+   * @category Function
+   * @param {number} n The number of calls at which `func` is no longer invoked.
+   * @param {Function} func The function to restrict.
+   * @returns {Function} Returns the new restricted function.
+   * @example
+   *
+   * jQuery(element).on('click', _.before(5, addContactToList));
+   * // => Allows adding up to 4 contacts to the list.
+   */
+  function before(n, func) {
+    var result;
+    if (typeof func != 'function') {
+      throw new TypeError(FUNC_ERROR_TEXT);
+    }
+    n = toInteger(n);
+    return function() {
+      if (--n > 0) {
+        result = func.apply(this, arguments);
+      }
+      if (n <= 1) {
+        func = undefined;
+      }
+      return result;
+    };
+  }
+
+  /**
+   * Creates a function that invokes `func` with the `this` binding of `thisArg`
+   * and `partials` prepended to the arguments it receives.
+   *
+   * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
+   * may be used as a placeholder for partially applied arguments.
+   *
+   * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
+   * property of bound functions.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Function
+   * @param {Function} func The function to bind.
+   * @param {*} thisArg The `this` binding of `func`.
+   * @param {...*} [partials] The arguments to be partially applied.
+   * @returns {Function} Returns the new bound function.
+   * @example
+   *
+   * function greet(greeting, punctuation) {
+   *   return greeting + ' ' + this.user + punctuation;
+   * }
+   *
+   * var object = { 'user': 'fred' };
+   *
+   * var bound = _.bind(greet, object, 'hi');
+   * bound('!');
+   * // => 'hi fred!'
+   *
+   * // Bound with placeholders.
+   * var bound = _.bind(greet, object, _, '!');
+   * bound('hi');
+   * // => 'hi fred!'
+   */
+  var bind = baseRest(function(func, thisArg, partials) {
+    return createPartial(func, WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG, thisArg, partials);
+  });
+
+  /**
+   * Defers invoking the `func` until the current call stack has cleared. Any
+   * additional arguments are provided to `func` when it's invoked.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Function
+   * @param {Function} func The function to defer.
+   * @param {...*} [args] The arguments to invoke `func` with.
+   * @returns {number} Returns the timer id.
+   * @example
+   *
+   * _.defer(function(text) {
+   *   console.log(text);
+   * }, 'deferred');
+   * // => Logs 'deferred' after one millisecond.
+   */
+  var defer = baseRest(function(func, args) {
+    return baseDelay(func, 1, args);
+  });
+
+  /**
+   * Invokes `func` after `wait` milliseconds. Any additional arguments are
+   * provided to `func` when it's invoked.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Function
+   * @param {Function} func The function to delay.
+   * @param {number} wait The number of milliseconds to delay invocation.
+   * @param {...*} [args] The arguments to invoke `func` with.
+   * @returns {number} Returns the timer id.
+   * @example
+   *
+   * _.delay(function(text) {
+   *   console.log(text);
+   * }, 1000, 'later');
+   * // => Logs 'later' after one second.
+   */
+  var delay = baseRest(function(func, wait, args) {
+    return baseDelay(func, toNumber(wait) || 0, args);
+  });
+
+  /**
+   * Creates a function that negates the result of the predicate `func`. The
+   * `func` predicate is invoked with the `this` binding and arguments of the
+   * created function.
+   *
+   * @static
+   * @memberOf _
+   * @since 3.0.0
+   * @category Function
+   * @param {Function} predicate The predicate to negate.
+   * @returns {Function} Returns the new negated function.
+   * @example
+   *
+   * function isEven(n) {
+   *   return n % 2 == 0;
+   * }
+   *
+   * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
+   * // => [1, 3, 5]
+   */
+  function negate(predicate) {
+    if (typeof predicate != 'function') {
+      throw new TypeError(FUNC_ERROR_TEXT);
+    }
+    return function() {
+      var args = arguments;
+      return !predicate.apply(this, args);
+    };
+  }
+
+  /**
+   * Creates a function that is restricted to invoking `func` once. Repeat calls
+   * to the function return the value of the first invocation. The `func` is
+   * invoked with the `this` binding and arguments of the created function.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Function
+   * @param {Function} func The function to restrict.
+   * @returns {Function} Returns the new restricted function.
+   * @example
+   *
+   * var initialize = _.once(createApplication);
+   * initialize();
+   * initialize();
+   * // => `createApplication` is invoked once
+   */
+  function once(func) {
+    return before(2, func);
+  }
+
+  /*------------------------------------------------------------------------*/
+
+  /**
+   * Creates a shallow clone of `value`.
+   *
+   * **Note:** This method is loosely based on the
+   * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
+   * and supports cloning arrays, array buffers, booleans, date objects, maps,
+   * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
+   * arrays. The own enumerable properties of `arguments` objects are cloned
+   * as plain objects. An empty object is returned for uncloneable values such
+   * as error objects, functions, DOM nodes, and WeakMaps.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Lang
+   * @param {*} value The value to clone.
+   * @returns {*} Returns the cloned value.
+   * @see _.cloneDeep
+   * @example
+   *
+   * var objects = [{ 'a': 1 }, { 'b': 2 }];
+   *
+   * var shallow = _.clone(objects);
+   * console.log(shallow[0] === objects[0]);
+   * // => true
+   */
+  function clone(value) {
+    if (!isObject(value)) {
+      return value;
+    }
+    return isArray(value) ? copyArray(value) : copyObject(value, nativeKeys(value));
+  }
+
+  /**
+   * Performs a
+   * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+   * comparison between two values to determine if they are equivalent.
+   *
+   * @static
+   * @memberOf _
+   * @since 4.0.0
+   * @category Lang
+   * @param {*} value The value to compare.
+   * @param {*} other The other value to compare.
+   * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+   * @example
+   *
+   * var object = { 'a': 1 };
+   * var other = { 'a': 1 };
+   *
+   * _.eq(object, object);
+   * // => true
+   *
+   * _.eq(object, other);
+   * // => false
+   *
+   * _.eq('a', 'a');
+   * // => true
+   *
+   * _.eq('a', Object('a'));
+   * // => false
+   *
+   * _.eq(NaN, NaN);
+   * // => true
+   */
+  function eq(value, other) {
+    return value === other || (value !== value && other !== other);
+  }
+
+  /**
+   * Checks if `value` is likely an `arguments` object.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is an `arguments` object,
+   *  else `false`.
+   * @example
+   *
+   * _.isArguments(function() { return arguments; }());
+   * // => true
+   *
+   * _.isArguments([1, 2, 3]);
+   * // => false
+   */
+  var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
+    return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
+      !propertyIsEnumerable.call(value, 'callee');
+  };
+
+  /**
+   * Checks if `value` is classified as an `Array` object.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is an array, else `false`.
+   * @example
+   *
+   * _.isArray([1, 2, 3]);
+   * // => true
+   *
+   * _.isArray(document.body.children);
+   * // => false
+   *
+   * _.isArray('abc');
+   * // => false
+   *
+   * _.isArray(_.noop);
+   * // => false
+   */
+  var isArray = Array.isArray;
+
+  /**
+   * Checks if `value` is array-like. A value is considered array-like if it's
+   * not a function and has a `value.length` that's an integer greater than or
+   * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
+   *
+   * @static
+   * @memberOf _
+   * @since 4.0.0
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
+   * @example
+   *
+   * _.isArrayLike([1, 2, 3]);
+   * // => true
+   *
+   * _.isArrayLike(document.body.children);
+   * // => true
+   *
+   * _.isArrayLike('abc');
+   * // => true
+   *
+   * _.isArrayLike(_.noop);
+   * // => false
+   */
+  function isArrayLike(value) {
+    return value != null && isLength(value.length) && !isFunction(value);
+  }
+
+  /**
+   * Checks if `value` is classified as a boolean primitive or object.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
+   * @example
+   *
+   * _.isBoolean(false);
+   * // => true
+   *
+   * _.isBoolean(null);
+   * // => false
+   */
+  function isBoolean(value) {
+    return value === true || value === false ||
+      (isObjectLike(value) && baseGetTag(value) == boolTag);
+  }
+
+  /**
+   * Checks if `value` is classified as a `Date` object.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
+   * @example
+   *
+   * _.isDate(new Date);
+   * // => true
+   *
+   * _.isDate('Mon April 23 2012');
+   * // => false
+   */
+  var isDate = baseIsDate;
+
+  /**
+   * Checks if `value` is an empty object, collection, map, or set.
+   *
+   * Objects are considered empty if they have no own enumerable string keyed
+   * properties.
+   *
+   * Array-like values such as `arguments` objects, arrays, buffers, strings, or
+   * jQuery-like collections are considered empty if they have a `length` of `0`.
+   * Similarly, maps and sets are considered empty if they have a `size` of `0`.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is empty, else `false`.
+   * @example
+   *
+   * _.isEmpty(null);
+   * // => true
+   *
+   * _.isEmpty(true);
+   * // => true
+   *
+   * _.isEmpty(1);
+   * // => true
+   *
+   * _.isEmpty([1, 2, 3]);
+   * // => false
+   *
+   * _.isEmpty({ 'a': 1 });
+   * // => false
+   */
+  function isEmpty(value) {
+    if (isArrayLike(value) &&
+        (isArray(value) || isString(value) ||
+          isFunction(value.splice) || isArguments(value))) {
+      return !value.length;
+    }
+    return !nativeKeys(value).length;
+  }
+
+  /**
+   * Performs a deep comparison between two values to determine if they are
+   * equivalent.
+   *
+   * **Note:** This method supports comparing arrays, array buffers, booleans,
+   * date objects, error objects, maps, numbers, `Object` objects, regexes,
+   * sets, strings, symbols, and typed arrays. `Object` objects are compared
+   * by their own, not inherited, enumerable properties. Functions and DOM
+   * nodes are compared by strict equality, i.e. `===`.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Lang
+   * @param {*} value The value to compare.
+   * @param {*} other The other value to compare.
+   * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+   * @example
+   *
+   * var object = { 'a': 1 };
+   * var other = { 'a': 1 };
+   *
+   * _.isEqual(object, other);
+   * // => true
+   *
+   * object === other;
+   * // => false
+   */
+  function isEqual(value, other) {
+    return baseIsEqual(value, other);
+  }
+
+  /**
+   * Checks if `value` is a finite primitive number.
+   *
+   * **Note:** This method is based on
+   * [`Number.isFinite`](https://mdn.io/Number/isFinite).
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
+   * @example
+   *
+   * _.isFinite(3);
+   * // => true
+   *
+   * _.isFinite(Number.MIN_VALUE);
+   * // => true
+   *
+   * _.isFinite(Infinity);
+   * // => false
+   *
+   * _.isFinite('3');
+   * // => false
+   */
+  function isFinite(value) {
+    return typeof value == 'number' && nativeIsFinite(value);
+  }
+
+  /**
+   * Checks if `value` is classified as a `Function` object.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is a function, else `false`.
+   * @example
+   *
+   * _.isFunction(_);
+   * // => true
+   *
+   * _.isFunction(/abc/);
+   * // => false
+   */
+  function isFunction(value) {
+    if (!isObject(value)) {
+      return false;
+    }
+    // The use of `Object#toString` avoids issues with the `typeof` operator
+    // in Safari 9 which returns 'object' for typed arrays and other constructors.
+    var tag = baseGetTag(value);
+    return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
+  }
+
+  /**
+   * Checks if `value` is a valid array-like length.
+   *
+   * **Note:** This method is loosely based on
+   * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
+   *
+   * @static
+   * @memberOf _
+   * @since 4.0.0
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
+   * @example
+   *
+   * _.isLength(3);
+   * // => true
+   *
+   * _.isLength(Number.MIN_VALUE);
+   * // => false
+   *
+   * _.isLength(Infinity);
+   * // => false
+   *
+   * _.isLength('3');
+   * // => false
+   */
+  function isLength(value) {
+    return typeof value == 'number' &&
+      value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
+  }
+
+  /**
+   * Checks if `value` is the
+   * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
+   * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is an object, else `false`.
+   * @example
+   *
+   * _.isObject({});
+   * // => true
+   *
+   * _.isObject([1, 2, 3]);
+   * // => true
+   *
+   * _.isObject(_.noop);
+   * // => true
+   *
+   * _.isObject(null);
+   * // => false
+   */
+  function isObject(value) {
+    var type = typeof value;
+    return value != null && (type == 'object' || type == 'function');
+  }
+
+  /**
+   * Checks if `value` is object-like. A value is object-like if it's not `null`
+   * and has a `typeof` result of "object".
+   *
+   * @static
+   * @memberOf _
+   * @since 4.0.0
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+   * @example
+   *
+   * _.isObjectLike({});
+   * // => true
+   *
+   * _.isObjectLike([1, 2, 3]);
+   * // => true
+   *
+   * _.isObjectLike(_.noop);
+   * // => false
+   *
+   * _.isObjectLike(null);
+   * // => false
+   */
+  function isObjectLike(value) {
+    return value != null && typeof value == 'object';
+  }
+
+  /**
+   * Checks if `value` is `NaN`.
+   *
+   * **Note:** This method is based on
+   * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
+   * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
+   * `undefined` and other non-number values.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
+   * @example
+   *
+   * _.isNaN(NaN);
+   * // => true
+   *
+   * _.isNaN(new Number(NaN));
+   * // => true
+   *
+   * isNaN(undefined);
+   * // => true
+   *
+   * _.isNaN(undefined);
+   * // => false
+   */
+  function isNaN(value) {
+    // An `NaN` primitive is the only value that is not equal to itself.
+    // Perform the `toStringTag` check first to avoid errors with some
+    // ActiveX objects in IE.
+    return isNumber(value) && value != +value;
+  }
+
+  /**
+   * Checks if `value` is `null`.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
+   * @example
+   *
+   * _.isNull(null);
+   * // => true
+   *
+   * _.isNull(void 0);
+   * // => false
+   */
+  function isNull(value) {
+    return value === null;
+  }
+
+  /**
+   * Checks if `value` is classified as a `Number` primitive or object.
+   *
+   * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
+   * classified as numbers, use the `_.isFinite` method.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is a number, else `false`.
+   * @example
+   *
+   * _.isNumber(3);
+   * // => true
+   *
+   * _.isNumber(Number.MIN_VALUE);
+   * // => true
+   *
+   * _.isNumber(Infinity);
+   * // => true
+   *
+   * _.isNumber('3');
+   * // => false
+   */
+  function isNumber(value) {
+    return typeof value == 'number' ||
+      (isObjectLike(value) && baseGetTag(value) == numberTag);
+  }
+
+  /**
+   * Checks if `value` is classified as a `RegExp` object.
+   *
+   * @static
+   * @memberOf _
+   * @since 0.1.0
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
+   * @example
+   *
+   * _.isRegExp(/abc/);
+   * // => true
+   *
+   * _.isRegExp('/abc/');
+   * // => false
+   */
+  var isRegExp = baseIsRegExp;
+
+  /**
+   * Checks if `value` is classified as a `String` primitive or object.
+   *
+   * @static
+   * @since 0.1.0
+   * @memberOf _
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is a string, else `false`.
+   * @example
+   *
+   * _.isString('abc');
+   * // => true
+   *
+   * _.isString(1);
+   * // => false
+   */
+  function isString(value) {
+    return typeof value == 'string' ||
+      (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
+  }
+
+  /**
+   * Checks if `value` is `undefined`.
+   *
+   * @static
+   * @since 0.1.0
+   * @memberOf _
+   * @category Lang
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
+   * @example
+   *
+   * _.isUndefined(void 0);
+   * // => true
+   *
+   * _.isUndefined(null);
+   * // => false
+   */
+  function isUndefined(value) {
+    return value === undefined;
+  }
+
+  /**
+   * Converts `value` to an array.
+   *
+   * @static
+   * @since 0.1.0
+   * @memberOf _
+   * @category Lang
+   * @param {*} value The value to convert.
+   * @returns {Array} Returns the converted array.
+   * @example
+   *
+   * _.toArray({ 'a': 1, 'b': 2 });
+   * // => [1, 2]
+   *
+   * _.toArray('abc');
+   * // => ['a', 'b', 'c']
+   *
+   * _.toArray(1);
+   * // => []
+   *
+   * _.toArray(null);
+   * // => []
+   */
+  function toArray(value) {
+    if (!isArrayLike(value)) {
+      return values(value);
+    }
+    return value.length ? copyArray(value) : [];
+  }
+
+  /**
+   * Converts `value` to an integer.
+   *
+   * **Note:** This method is loosely based on
+   * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
+   *
+   * @static
+   * @memberOf _
+   * @since 4.0.0
+   * @category Lang
+   * @param {*} value The value to convert.
+   * @returns {number} Returns the converted integer.
+   * @example
+   *
+   * _.toInteger(3.2);
+   * // => 3
+   *
+   * _.toInteger(Number.MIN_VALUE);
+   * // => 0
+   *
+   * _.toInteger(Infinity);
+   * // => 1.7976931348623157e+308
+   *
+   * _.toInteger('3.2');
+   * // => 3
+   */
+  var toInteger = Number;
+
+  /**
+   * Converts `value` to a number.
+   *
+   * @static
+   * @memberOf _
+   * @since 4.0.0
+   * @category Lang
+   * @param {*} value The value to process.
+   * @returns {number} Returns the number.
+   * @example
+   *
+   * _.toNumber(3.2);
+   * // => 3.2
+   *
+   * _.toNumber(Number.MIN_VALUE);
+   * // => 5e-324
+   *
+   * _.toNumber(Infinity);
+   * // => Infinity
+   *
+   * _.toNumber('3.2');
+   * // => 3.2
+   */
+  var toNumber = Number;
+
+  /**
+   * Converts `value` to a string. An empty string is returned for `null`
+   * and `undefined` values. The sign of `-0` is preserved.
+   *
+   * @static
+   * @memberOf _
+   * @since 4.0.0
+   * @category Lang
+   * @param {*} value The value to convert.
+   * @returns {string} Returns the converted string.
+   * @example
+   *
+   * _.toString(null);
+   * // => ''
+   *
+   * _.toString(-0);
+   * // => '-0'
+   *
+   * _.toString([1, 2, 3]);
+   * // => '1,2,3'
+   */
+  function toString(value) {
+    if (typeof value == 'string') {
+      return value;
+    }
+    return value == null ? '' : (value + '');
+  }
+
+  /*------------------------------------------------------------------------*/
+
+  /**
+   * Assigns own enumerable string keyed properties of source objects to the
+   * destination object. Source objects are applied from left to right.
+   * Subsequent sources overwrite property assignments of previous sources.
+   *
+   * **Note:** This method mutates `object` and is loosely based on
+   * [`Object.assign`](https://mdn.io/Object/assign).
+   *
+   * @static
+   * @memberOf _
+   * @since 0.10.0
+   * @category Object
+   * @param {Object} object The destination object.
+   * @param {...Object} [sources] The source objects.
+   * @returns {Object} Returns `object`.
+   * @see _.assignIn
+   * @example
+   *
+   * function Foo() {
+   *   this.a = 1;
+   * }
+   *
+   * function Bar() {
+   *   this.c = 3;
+   * }
+   *
+   * Foo.prototype.b = 2;
+   * Bar.prototype.d = 4;
+   *
+   * _.assign({ 'a': 0 }, new Foo, new Bar);
+   * // => { 'a': 1, 'c': 3 }
+   */
+  var assign = createAssigner(function(object, source) {
+    copyObject(source, nativeKeys(source), object);
+  });
+
+  /**
+   * This method is like `_.assign` except that it iterates over own and
+   * inherited source properties.
+   *
+   * **Note:** This method mutates `object`.
+   *
+   * @static
+   * @memberOf _
+   * @since 4.0.0
+   * @alias extend
+   * @category Object
+   * @param {Object} object The destination object.
+   * @param {...Object} [sources] The source objects.
+   * @returns {Object} Returns `object`.
+   * @see _.assign
+   * @example
+   *
+   * function Foo() {
+   *   this.a = 1;
+   * }
+   *
+   * function Bar() {
+   *   this.c = 3;
+   * }
+   *
+   * Foo.prototype.b = 2;
+   * Bar.prototype.d = 4;
+   *
+   * _.assignIn({ 'a': 0 }, new Foo, new Bar);
+   * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
+   */
+  var assignIn = createAssigner(function(object, source) {
+    copyObject(source, nativeKeysIn(source), object);
+  });
+
+  /**
+   * Creates an object that inherits from the `prototype` object. If a
+   * `properties` object is given, its own enumerable string keyed properties
+   * are assigned to the created object.
+   *
+   * @static
+   * @memberOf _
+   * @since 2.3.0
+   * @category Object
+   * @param {Object} prototype The object to inherit from.
+   * @param {Object} [properties] The properties to assign to the object.
+   * @returns {Object} Returns the new object.
+   * @example
+   *
+   * function Shape() {
+   *   this.x = 0;
+   *   this.y = 0;
+   * }
+   *
+   * function Circle() {
+   *   Shape.call(this);
+   * }
+   *
+   * Circle.prototype = _.create(Shape.prototype, {
+   *   'constructor': Circle
+   * });
+   *
+   * var circle = new Circle;
+   * circle instanceof Circle;
+   * // => true
+   *
+   * circle instanceof Shape;
+   * // => true
+   */
+  function create(prototype, properties) {
+    var result = baseCreate(prototype);
+    return properties == null ? result : assign(result, properties);
+  }
+
+  /**
+   * Assigns own and inherited enumerable string keyed properties of source
+   * objects to the destination object for all destination properties that
+   * resolve to `undefined`. Source objects are applied from left to right.
+   * Once a property is set, additional values of the same property are ignored.
+   *
+   * **Note:** This method mutates `object`.
+   *
+   * @static
+   * @since 0.1.0
+   * @memberOf _
+   * @category Object
+   * @param {Object} object The destination object.
+   * @param {...Object} [sources] The source objects.
+   * @returns {Object} Returns `object`.
+   * @see _.defaultsDeep
+   * @example
+   *
+   * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
+   * // => { 'a': 1, 'b': 2 }
+   */
+  var defaults = baseRest(function(object, sources) {
+    object = Object(object);
+
+    var index = -1;
+    var length = sources.length;
+    var guard = length > 2 ? sources[2] : undefined;
+
+    if (guard && isIterateeCall(sources[0], sources[1], guard)) {
+      length = 1;
+    }
+
+    while (++index < length) {
+      var source = sources[index];
+      var props = keysIn(source);
+      var propsIndex = -1;
+      var propsLength = props.length;
+
+      while (++propsIndex < propsLength) {
+        var key = props[propsIndex];
+        var value = object[key];
+
+        if (value === undefined ||
+            (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
+          object[key] = source[key];
+        }
+      }
+    }
+
+    return object;
+  });
+
+  /**
+   * Checks if `path` is a direct property of `object`.
+   *
+   * @static
+   * @since 0.1.0
+   * @memberOf _
+   * @category Object
+   * @param {Object} object The object to query.
+   * @param {Array|string} path The path to check.
+   * @returns {boolean} Returns `true` if `path` exists, else `false`.
+   * @example
+   *
+   * var object = { 'a': { 'b': 2 } };
+   * var other = _.create({ 'a': _.create({ 'b': 2 }) });
+   *
+   * _.has(object, 'a');
+   * // => true
+   *
+   * _.has(object, 'a.b');
+   * // => true
+   *
+   * _.has(object, ['a', 'b']);
+   * // => true
+   *
+   * _.has(other, 'a');
+   * // => false
+   */
+  function has(object, path) {
+    return object != null && hasOwnProperty.call(object, path);
+  }
+
+  /**
+   * Creates an array of the own enumerable property names of `object`.
+   *
+   * **Note:** Non-object values are coerced to objects. See the
+   * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
+   * for more details.
+   *
+   * @static
+   * @since 0.1.0
+   * @memberOf _
+   * @category Object
+   * @param {Object} object The object to query.
+   * @returns {Array} Returns the array of property names.
+   * @example
+   *
+   * function Foo() {
+   *   this.a = 1;
+   *   this.b = 2;
+   * }
+   *
+   * Foo.prototype.c = 3;
+   *
+   * _.keys(new Foo);
+   * // => ['a', 'b'] (iteration order is not guaranteed)
+   *
+   * _.keys('hi');
+   * // => ['0', '1']
+   */
+  var keys = nativeKeys;
+
+  /**
+   * Creates an array of the own and inherited enumerable property names of `object`.
+   *
+   * **Note:** Non-object values are coerced to objects.
+   *
+   * @static
+   * @memberOf _
+   * @since 3.0.0
+   * @category Object
+   * @param {Object} object The object to query.
+   * @returns {Array} Returns the array of property names.
+   * @example
+   *
+   * function Foo() {
+   *   this.a = 1;
+   *   this.b = 2;
+   * }
+   *
+   * Foo.prototype.c = 3;
+   *
+   * _.keysIn(new Foo);
+   * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
+   */
+  var keysIn = nativeKeysIn;
+
+  /**
+   * Creates an object composed of the picked `object` properties.
+   *
+   * @static
+   * @since 0.1.0
+   * @memberOf _
+   * @category Object
+   * @param {Object} object The source object.
+   * @param {...(string|string[])} [paths] The property paths to pick.
+   * @returns {Object} Returns the new object.
+   * @example
+   *
+   * var object = { 'a': 1, 'b': '2', 'c': 3 };
+   *
+   * _.pick(object, ['a', 'c']);
+   * // => { 'a': 1, 'c': 3 }
+   */
+  var pick = flatRest(function(object, paths) {
+    return object == null ? {} : basePick(object, paths);
+  });
+
+  /**
+   * This method is like `_.get` except that if the resolved value is a
+   * function it's invoked with the `this` binding of its parent object and
+   * its result is returned.
+   *
+   * @static
+   * @since 0.1.0
+   * @memberOf _
+   * @category Object
+   * @param {Object} object The object to query.
+   * @param {Array|string} path The path of the property to resolve.
+   * @param {*} [defaultValue] The value returned for `undefined` resolved values.
+   * @returns {*} Returns the resolved value.
+   * @example
+   *
+   * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
+   *
+   * _.result(object, 'a[0].b.c1');
+   * // => 3
+   *
+   * _.result(object, 'a[0].b.c2');
+   * // => 4
+   *
+   * _.result(object, 'a[0].b.c3', 'default');
+   * // => 'default'
+   *
+   * _.result(object, 'a[0].b.c3', _.constant('default'));
+   * // => 'default'
+   */
+  function result(object, path, defaultValue) {
+    var value = object == null ? undefined : object[path];
+    if (value === undefined) {
+      value = defaultValue;
+    }
+    return isFunction(value) ? value.call(object) : value;
+  }
+
+  /**
+   * Creates an array of the own enumerable string keyed property values of `object`.
+   *
+   * **Note:** Non-object values are coerced to objects.
+   *
+   * @static
+   * @since 0.1.0
+   * @memberOf _
+   * @category Object
+   * @param {Object} object The object to query.
+   * @returns {Array} Returns the array of property values.
+   * @example
+   *
+   * function Foo() {
+   *   this.a = 1;
+   *   this.b = 2;
+   * }
+   *
+   * Foo.prototype.c = 3;
+   *
+   * _.values(new Foo);
+   * // => [1, 2] (iteration order is not guaranteed)
+   *
+   * _.values('hi');
+   * // => ['h', 'i']
+   */
+  function values(object) {
+    return object == null ? [] : baseValues(object, keys(object));
+  }
+
+  /*------------------------------------------------------------------------*/
+
+  /**
+   * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
+   * corresponding HTML entities.
+   *
+   * **Note:** No other characters are escaped. To escape additional
+   * characters use a third-party library like [_he_](https://mths.be/he).
+   *
+   * Though the ">" character is escaped for symmetry, characters like
+   * ">" and "/" don't need escaping in HTML and have no special meaning
+   * unless they're part of a tag or unquoted attribute value. See
+   * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
+   * (under "semi-related fun fact") for more details.
+   *
+   * When working with HTML you should always
+   * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
+   * XSS vectors.
+   *
+   * @static
+   * @since 0.1.0
+   * @memberOf _
+   * @category String
+   * @param {string} [string=''] The string to escape.
+   * @returns {string} Returns the escaped string.
+   * @example
+   *
+   * _.escape('fred, barney, & pebbles');
+   * // => 'fred, barney, & pebbles'
+   */
+  function escape(string) {
+    string = toString(string);
+    return (string && reHasUnescapedHtml.test(string))
+      ? string.replace(reUnescapedHtml, escapeHtmlChar)
+      : string;
+  }
+
+  /*------------------------------------------------------------------------*/
+
+  /**
+   * This method returns the first argument it receives.
+   *
+   * @static
+   * @since 0.1.0
+   * @memberOf _
+   * @category Util
+   * @param {*} value Any value.
+   * @returns {*} Returns `value`.
+   * @example
+   *
+   * var object = { 'a': 1 };
+   *
+   * console.log(_.identity(object) === object);
+   * // => true
+   */
+  function identity(value) {
+    return value;
+  }
+
+  /**
+   * Creates a function that invokes `func` with the arguments of the created
+   * function. If `func` is a property name, the created function returns the
+   * property value for a given element. If `func` is an array or object, the
+   * created function returns `true` for elements that contain the equivalent
+   * source properties, otherwise it returns `false`.
+   *
+   * @static
+   * @since 4.0.0
+   * @memberOf _
+   * @category Util
+   * @param {*} [func=_.identity] The value to convert to a callback.
+   * @returns {Function} Returns the callback.
+   * @example
+   *
+   * var users = [
+   *   { 'user': 'barney', 'age': 36, 'active': true },
+   *   { 'user': 'fred',   'age': 40, 'active': false }
+   * ];
+   *
+   * // The `_.matches` iteratee shorthand.
+   * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
+   * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
+   *
+   * // The `_.matchesProperty` iteratee shorthand.
+   * _.filter(users, _.iteratee(['user', 'fred']));
+   * // => [{ 'user': 'fred', 'age': 40 }]
+   *
+   * // The `_.property` iteratee shorthand.
+   * _.map(users, _.iteratee('user'));
+   * // => ['barney', 'fred']
+   *
+   * // Create custom iteratee shorthands.
+   * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
+   *   return !_.isRegExp(func) ? iteratee(func) : function(string) {
+   *     return func.test(string);
+   *   };
+   * });
+   *
+   * _.filter(['abc', 'def'], /ef/);
+   * // => ['def']
+   */
+  var iteratee = baseIteratee;
+
+  /**
+   * Creates a function that performs a partial deep comparison between a given
+   * object and `source`, returning `true` if the given object has equivalent
+   * property values, else `false`.
+   *
+   * **Note:** The created function is equivalent to `_.isMatch` with `source`
+   * partially applied.
+   *
+   * Partial comparisons will match empty array and empty object `source`
+   * values against any array or object value, respectively. See `_.isEqual`
+   * for a list of supported value comparisons.
+   *
+   * @static
+   * @memberOf _
+   * @since 3.0.0
+   * @category Util
+   * @param {Object} source The object of property values to match.
+   * @returns {Function} Returns the new spec function.
+   * @example
+   *
+   * var objects = [
+   *   { 'a': 1, 'b': 2, 'c': 3 },
+   *   { 'a': 4, 'b': 5, 'c': 6 }
+   * ];
+   *
+   * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
+   * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
+   */
+  function matches(source) {
+    return baseMatches(assign({}, source));
+  }
+
+  /**
+   * Adds all own enumerable string keyed function properties of a source
+   * object to the destination object. If `object` is a function, then methods
+   * are added to its prototype as well.
+   *
+   * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
+   * avoid conflicts caused by modifying the original.
+   *
+   * @static
+   * @since 0.1.0
+   * @memberOf _
+   * @category Util
+   * @param {Function|Object} [object=lodash] The destination object.
+   * @param {Object} source The object of functions to add.
+   * @param {Object} [options={}] The options object.
+   * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
+   * @returns {Function|Object} Returns `object`.
+   * @example
+   *
+   * function vowels(string) {
+   *   return _.filter(string, function(v) {
+   *     return /[aeiou]/i.test(v);
+   *   });
+   * }
+   *
+   * _.mixin({ 'vowels': vowels });
+   * _.vowels('fred');
+   * // => ['e']
+   *
+   * _('fred').vowels().value();
+   * // => ['e']
+   *
+   * _.mixin({ 'vowels': vowels }, { 'chain': false });
+   * _('fred').vowels();
+   * // => ['e']
+   */
+  function mixin(object, source, options) {
+    var props = keys(source),
+        methodNames = baseFunctions(source, props);
+
+    if (options == null &&
+        !(isObject(source) && (methodNames.length || !props.length))) {
+      options = source;
+      source = object;
+      object = this;
+      methodNames = baseFunctions(source, keys(source));
+    }
+    var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
+        isFunc = isFunction(object);
+
+    baseEach(methodNames, function(methodName) {
+      var func = source[methodName];
+      object[methodName] = func;
+      if (isFunc) {
+        object.prototype[methodName] = function() {
+          var chainAll = this.__chain__;
+          if (chain || chainAll) {
+            var result = object(this.__wrapped__),
+                actions = result.__actions__ = copyArray(this.__actions__);
+
+            actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
+            result.__chain__ = chainAll;
+            return result;
+          }
+          return func.apply(object, arrayPush([this.value()], arguments));
+        };
+      }
+    });
+
+    return object;
+  }
+
+  /**
+   * Reverts the `_` variable to its previous value and returns a reference to
+   * the `lodash` function.
+   *
+   * @static
+   * @since 0.1.0
+   * @memberOf _
+   * @category Util
+   * @returns {Function} Returns the `lodash` function.
+   * @example
+   *
+   * var lodash = _.noConflict();
+   */
+  function noConflict() {
+    if (root._ === this) {
+      root._ = oldDash;
+    }
+    return this;
+  }
+
+  /**
+   * This method returns `undefined`.
+   *
+   * @static
+   * @memberOf _
+   * @since 2.3.0
+   * @category Util
+   * @example
+   *
+   * _.times(2, _.noop);
+   * // => [undefined, undefined]
+   */
+  function noop() {
+    // No operation performed.
+  }
+
+  /**
+   * Generates a unique ID. If `prefix` is given, the ID is appended to it.
+   *
+   * @static
+   * @since 0.1.0
+   * @memberOf _
+   * @category Util
+   * @param {string} [prefix=''] The value to prefix the ID with.
+   * @returns {string} Returns the unique ID.
+   * @example
+   *
+   * _.uniqueId('contact_');
+   * // => 'contact_104'
+   *
+   * _.uniqueId();
+   * // => '105'
+   */
+  function uniqueId(prefix) {
+    var id = ++idCounter;
+    return toString(prefix) + id;
+  }
+
+  /*------------------------------------------------------------------------*/
+
+  /**
+   * Computes the maximum value of `array`. If `array` is empty or falsey,
+   * `undefined` is returned.
+   *
+   * @static
+   * @since 0.1.0
+   * @memberOf _
+   * @category Math
+   * @param {Array} array The array to iterate over.
+   * @returns {*} Returns the maximum value.
+   * @example
+   *
+   * _.max([4, 2, 8, 6]);
+   * // => 8
+   *
+   * _.max([]);
+   * // => undefined
+   */
+  function max(array) {
+    return (array && array.length)
+      ? baseExtremum(array, identity, baseGt)
+      : undefined;
+  }
+
+  /**
+   * Computes the minimum value of `array`. If `array` is empty or falsey,
+   * `undefined` is returned.
+   *
+   * @static
+   * @since 0.1.0
+   * @memberOf _
+   * @category Math
+   * @param {Array} array The array to iterate over.
+   * @returns {*} Returns the minimum value.
+   * @example
+   *
+   * _.min([4, 2, 8, 6]);
+   * // => 2
+   *
+   * _.min([]);
+   * // => undefined
+   */
+  function min(array) {
+    return (array && array.length)
+      ? baseExtremum(array, identity, baseLt)
+      : undefined;
+  }
+
+  /*------------------------------------------------------------------------*/
+
+  // Add methods that return wrapped values in chain sequences.
+  lodash.assignIn = assignIn;
+  lodash.before = before;
+  lodash.bind = bind;
+  lodash.chain = chain;
+  lodash.compact = compact;
+  lodash.concat = concat;
+  lodash.create = create;
+  lodash.defaults = defaults;
+  lodash.defer = defer;
+  lodash.delay = delay;
+  lodash.filter = filter;
+  lodash.flatten = flatten;
+  lodash.flattenDeep = flattenDeep;
+  lodash.iteratee = iteratee;
+  lodash.keys = keys;
+  lodash.map = map;
+  lodash.matches = matches;
+  lodash.mixin = mixin;
+  lodash.negate = negate;
+  lodash.once = once;
+  lodash.pick = pick;
+  lodash.slice = slice;
+  lodash.sortBy = sortBy;
+  lodash.tap = tap;
+  lodash.thru = thru;
+  lodash.toArray = toArray;
+  lodash.values = values;
+
+  // Add aliases.
+  lodash.extend = assignIn;
+
+  // Add methods to `lodash.prototype`.
+  mixin(lodash, lodash);
+
+  /*------------------------------------------------------------------------*/
+
+  // Add methods that return unwrapped values in chain sequences.
+  lodash.clone = clone;
+  lodash.escape = escape;
+  lodash.every = every;
+  lodash.find = find;
+  lodash.forEach = forEach;
+  lodash.has = has;
+  lodash.head = head;
+  lodash.identity = identity;
+  lodash.indexOf = indexOf;
+  lodash.isArguments = isArguments;
+  lodash.isArray = isArray;
+  lodash.isBoolean = isBoolean;
+  lodash.isDate = isDate;
+  lodash.isEmpty = isEmpty;
+  lodash.isEqual = isEqual;
+  lodash.isFinite = isFinite;
+  lodash.isFunction = isFunction;
+  lodash.isNaN = isNaN;
+  lodash.isNull = isNull;
+  lodash.isNumber = isNumber;
+  lodash.isObject = isObject;
+  lodash.isRegExp = isRegExp;
+  lodash.isString = isString;
+  lodash.isUndefined = isUndefined;
+  lodash.last = last;
+  lodash.max = max;
+  lodash.min = min;
+  lodash.noConflict = noConflict;
+  lodash.noop = noop;
+  lodash.reduce = reduce;
+  lodash.result = result;
+  lodash.size = size;
+  lodash.some = some;
+  lodash.uniqueId = uniqueId;
+
+  // Add aliases.
+  lodash.each = forEach;
+  lodash.first = head;
+
+  mixin(lodash, (function() {
+    var source = {};
+    baseForOwn(lodash, function(func, methodName) {
+      if (!hasOwnProperty.call(lodash.prototype, methodName)) {
+        source[methodName] = func;
+      }
+    });
+    return source;
+  }()), { 'chain': false });
+
+  /*------------------------------------------------------------------------*/
+
+  /**
+   * The semantic version number.
+   *
+   * @static
+   * @memberOf _
+   * @type {string}
+   */
+  lodash.VERSION = VERSION;
+
+  // Add `Array` methods to `lodash.prototype`.
+  baseEach(['pop', 'join', 'replace', 'reverse', 'split', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
+    var func = (/^(?:replace|split)$/.test(methodName) ? String.prototype : arrayProto)[methodName],
+        chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
+        retUnwrapped = /^(?:pop|join|replace|shift)$/.test(methodName);
+
+    lodash.prototype[methodName] = function() {
+      var args = arguments;
+      if (retUnwrapped && !this.__chain__) {
+        var value = this.value();
+        return func.apply(isArray(value) ? value : [], args);
+      }
+      return this[chainName](function(value) {
+        return func.apply(isArray(value) ? value : [], args);
+      });
+    };
+  });
+
+  // Add chain sequence methods to the `lodash` wrapper.
+  lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
+
+  /*--------------------------------------------------------------------------*/
+
+  // Some AMD build optimizers, like r.js, check for condition patterns like:
+  if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
+    // Expose Lodash on the global object to prevent errors when Lodash is
+    // loaded by a script tag in the presence of an AMD loader.
+    // See http://requirejs.org/docs/errors.html#mismatch for more details.
+    // Use `_.noConflict` to remove Lodash from the global object.
+    root._ = lodash;
+
+    // Define as an anonymous module so, through path mapping, it can be
+    // referenced as the "underscore" module.
+    define(function() {
+      return lodash;
+    });
+  }
+  // Check for `exports` after `define` in case a build optimizer adds it.
+  else if (freeModule) {
+    // Export for Node.js.
+    (freeModule.exports = lodash)._ = lodash;
+    // Export for CommonJS support.
+    freeExports._ = lodash;
+  }
+  else {
+    // Export to the global object.
+    root._ = lodash;
+  }
+}.call(this));
diff --git a/vendor/mobx-5.13.0.umd.js b/vendor/mobx-5.13.0.umd.js
new file mode 100644
index 0000000..f7781d5
--- /dev/null
+++ b/vendor/mobx-5.13.0.umd.js
@@ -0,0 +1,4499 @@
+/** MobX - (c) Michel Weststrate 2015 - 2019 - MIT Licensed */
+(function (global, factory) {
+    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+    typeof define === 'function' && define.amd ? define(['exports'], factory) :
+    (global = global || self, factory(global.mobx = {}));
+}(this, function (exports) { 'use strict';
+
+    /*! *****************************************************************************
+    Copyright (c) Microsoft Corporation. All rights reserved.
+    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
+
+    THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
+    WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
+    MERCHANTABLITY OR NON-INFRINGEMENT.
+
+    See the Apache Version 2.0 License for specific language governing permissions
+    and limitations under the License.
+    ***************************************************************************** */
+    /* global Reflect, Promise */
+
+    var extendStatics = function(d, b) {
+        extendStatics = Object.setPrototypeOf ||
+            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+        return extendStatics(d, b);
+    };
+
+    function __extends(d, b) {
+        extendStatics(d, b);
+        function __() { this.constructor = d; }
+        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+    }
+
+    var __assign = function() {
+        __assign = Object.assign || function __assign(t) {
+            for (var s, i = 1, n = arguments.length; i < n; i++) {
+                s = arguments[i];
+                for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+            }
+            return t;
+        };
+        return __assign.apply(this, arguments);
+    };
+
+    function __values(o) {
+        var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
+        if (m) return m.call(o);
+        return {
+            next: function () {
+                if (o && i >= o.length) o = void 0;
+                return { value: o && o[i++], done: !o };
+            }
+        };
+    }
+
+    function __read(o, n) {
+        var m = typeof Symbol === "function" && o[Symbol.iterator];
+        if (!m) return o;
+        var i = m.call(o), r, ar = [], e;
+        try {
+            while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+        }
+        catch (error) { e = { error: error }; }
+        finally {
+            try {
+                if (r && !r.done && (m = i["return"])) m.call(i);
+            }
+            finally { if (e) throw e.error; }
+        }
+        return ar;
+    }
+
+    function __spread() {
+        for (var ar = [], i = 0; i < arguments.length; i++)
+            ar = ar.concat(__read(arguments[i]));
+        return ar;
+    }
+
+    var OBFUSCATED_ERROR = "An invariant failed, however the error is obfuscated because this is an production build.";
+    var EMPTY_ARRAY = [];
+    Object.freeze(EMPTY_ARRAY);
+    var EMPTY_OBJECT = {};
+    Object.freeze(EMPTY_OBJECT);
+    function getNextId() {
+        return ++globalState.mobxGuid;
+    }
+    function fail(message) {
+        invariant(false, message);
+        throw "X"; // unreachable
+    }
+    function invariant(check, message) {
+        if (!check)
+            throw new Error("[mobx] " + (message || OBFUSCATED_ERROR));
+    }
+    /**
+     * Prints a deprecation message, but only one time.
+     * Returns false if the deprecated message was already printed before
+     */
+    var deprecatedMessages = [];
+    function deprecated(msg, thing) {
+        if (process.env.NODE_ENV === "production")
+            return false;
+        if (thing) {
+            return deprecated("'" + msg + "', use '" + thing + "' instead.");
+        }
+        if (deprecatedMessages.indexOf(msg) !== -1)
+            return false;
+        deprecatedMessages.push(msg);
+        console.error("[mobx] Deprecated: " + msg);
+        return true;
+    }
+    /**
+     * Makes sure that the provided function is invoked at most once.
+     */
+    function once(func) {
+        var invoked = false;
+        return function () {
+            if (invoked)
+                return;
+            invoked = true;
+            return func.apply(this, arguments);
+        };
+    }
+    var noop = function () { };
+    function unique(list) {
+        var res = [];
+        list.forEach(function (item) {
+            if (res.indexOf(item) === -1)
+                res.push(item);
+        });
+        return res;
+    }
+    function isObject(value) {
+        return value !== null && typeof value === "object";
+    }
+    function isPlainObject(value) {
+        if (value === null || typeof value !== "object")
+            return false;
+        var proto = Object.getPrototypeOf(value);
+        return proto === Object.prototype || proto === null;
+    }
+    function addHiddenProp(object, propName, value) {
+        Object.defineProperty(object, propName, {
+            enumerable: false,
+            writable: true,
+            configurable: true,
+            value: value
+        });
+    }
+    function addHiddenFinalProp(object, propName, value) {
+        Object.defineProperty(object, propName, {
+            enumerable: false,
+            writable: false,
+            configurable: true,
+            value: value
+        });
+    }
+    function isPropertyConfigurable(object, prop) {
+        var descriptor = Object.getOwnPropertyDescriptor(object, prop);
+        return !descriptor || (descriptor.configurable !== false && descriptor.writable !== false);
+    }
+    function assertPropertyConfigurable(object, prop) {
+        if (process.env.NODE_ENV !== "production" && !isPropertyConfigurable(object, prop))
+            fail("Cannot make property '" + prop.toString() + "' observable, it is not configurable and writable in the target object");
+    }
+    function createInstanceofPredicate(name, clazz) {
+        var propName = "isMobX" + name;
+        clazz.prototype[propName] = true;
+        return function (x) {
+            return isObject(x) && x[propName] === true;
+        };
+    }
+    /**
+     * Returns whether the argument is an array, disregarding observability.
+     */
+    function isArrayLike(x) {
+        return Array.isArray(x) || isObservableArray(x);
+    }
+    function isES6Map(thing) {
+        return thing instanceof Map;
+    }
+    function isES6Set(thing) {
+        return thing instanceof Set;
+    }
+    /**
+     * Returns the following: own keys, prototype keys & own symbol keys, if they are enumerable.
+     */
+    function getPlainObjectKeys(object) {
+        var enumerables = new Set();
+        for (var key in object)
+            enumerables.add(key); // *all* enumerables
+        Object.getOwnPropertySymbols(object).forEach(function (k) {
+            if (Object.getOwnPropertyDescriptor(object, k).enumerable)
+                enumerables.add(k);
+        }); // *own* symbols
+        // Note: this implementation is missing enumerable, inherited, symbolic property names! That would however pretty expensive to add,
+        // as there is no efficient iterator that returns *all* properties
+        return Array.from(enumerables);
+    }
+    function stringifyKey(key) {
+        if (key && key.toString)
+            return key.toString();
+        else
+            return new String(key).toString();
+    }
+    function getMapLikeKeys(map) {
+        if (isPlainObject(map))
+            return Object.keys(map);
+        if (Array.isArray(map))
+            return map.map(function (_a) {
+                var _b = __read(_a, 1), key = _b[0];
+                return key;
+            });
+        if (isES6Map(map) || isObservableMap(map))
+            return Array.from(map.keys());
+        return fail("Cannot get keys from '" + map + "'");
+    }
+    function toPrimitive(value) {
+        return value === null ? null : typeof value === "object" ? "" + value : value;
+    }
+
+    var $mobx = Symbol("mobx administration");
+    var Atom = /** @class */ (function () {
+        /**
+         * Create a new atom. For debugging purposes it is recommended to give it a name.
+         * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.
+         */
+        function Atom(name) {
+            if (name === void 0) { name = "Atom@" + getNextId(); }
+            this.name = name;
+            this.isPendingUnobservation = false; // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
+            this.isBeingObserved = false;
+            this.observers = new Set();
+            this.diffValue = 0;
+            this.lastAccessedBy = 0;
+            this.lowestObserverState = exports.IDerivationState.NOT_TRACKING;
+        }
+        Atom.prototype.onBecomeObserved = function () {
+            if (this.onBecomeObservedListeners) {
+                this.onBecomeObservedListeners.forEach(function (listener) { return listener(); });
+            }
+        };
+        Atom.prototype.onBecomeUnobserved = function () {
+            if (this.onBecomeUnobservedListeners) {
+                this.onBecomeUnobservedListeners.forEach(function (listener) { return listener(); });
+            }
+        };
+        /**
+         * Invoke this method to notify mobx that your atom has been used somehow.
+         * Returns true if there is currently a reactive context.
+         */
+        Atom.prototype.reportObserved = function () {
+            return reportObserved(this);
+        };
+        /**
+         * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.
+         */
+        Atom.prototype.reportChanged = function () {
+            startBatch();
+            propagateChanged(this);
+            endBatch();
+        };
+        Atom.prototype.toString = function () {
+            return this.name;
+        };
+        return Atom;
+    }());
+    var isAtom = createInstanceofPredicate("Atom", Atom);
+    function createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {
+        if (onBecomeObservedHandler === void 0) { onBecomeObservedHandler = noop; }
+        if (onBecomeUnobservedHandler === void 0) { onBecomeUnobservedHandler = noop; }
+        var atom = new Atom(name);
+        // default `noop` listener will not initialize the hook Set
+        if (onBecomeObservedHandler !== noop) {
+            onBecomeObserved(atom, onBecomeObservedHandler);
+        }
+        if (onBecomeUnobservedHandler !== noop) {
+            onBecomeUnobserved(atom, onBecomeUnobservedHandler);
+        }
+        return atom;
+    }
+
+    function identityComparer(a, b) {
+        return a === b;
+    }
+    function structuralComparer(a, b) {
+        return deepEqual(a, b);
+    }
+    function defaultComparer(a, b) {
+        return Object.is(a, b);
+    }
+    var comparer = {
+        identity: identityComparer,
+        structural: structuralComparer,
+        default: defaultComparer
+    };
+
+    var mobxDidRunLazyInitializersSymbol = Symbol("mobx did run lazy initializers");
+    var mobxPendingDecorators = Symbol("mobx pending decorators");
+    var enumerableDescriptorCache = {};
+    var nonEnumerableDescriptorCache = {};
+    function createPropertyInitializerDescriptor(prop, enumerable) {
+        var cache = enumerable ? enumerableDescriptorCache : nonEnumerableDescriptorCache;
+        return (cache[prop] ||
+            (cache[prop] = {
+                configurable: true,
+                enumerable: enumerable,
+                get: function () {
+                    initializeInstance(this);
+                    return this[prop];
+                },
+                set: function (value) {
+                    initializeInstance(this);
+                    this[prop] = value;
+                }
+            }));
+    }
+    function initializeInstance(target) {
+        if (target[mobxDidRunLazyInitializersSymbol] === true)
+            return;
+        var decorators = target[mobxPendingDecorators];
+        if (decorators) {
+            addHiddenProp(target, mobxDidRunLazyInitializersSymbol, true);
+            for (var key in decorators) {
+                var d = decorators[key];
+                d.propertyCreator(target, d.prop, d.descriptor, d.decoratorTarget, d.decoratorArguments);
+            }
+        }
+    }
+    function createPropDecorator(propertyInitiallyEnumerable, propertyCreator) {
+        return function decoratorFactory() {
+            var decoratorArguments;
+            var decorator = function decorate(target, prop, descriptor, applyImmediately
+            // This is a special parameter to signal the direct application of a decorator, allow extendObservable to skip the entire type decoration part,
+            // as the instance to apply the decorator to equals the target
+            ) {
+                if (applyImmediately === true) {
+                    propertyCreator(target, prop, descriptor, target, decoratorArguments);
+                    return null;
+                }
+                if (process.env.NODE_ENV !== "production" && !quacksLikeADecorator(arguments))
+                    fail("This function is a decorator, but it wasn't invoked like a decorator");
+                if (!Object.prototype.hasOwnProperty.call(target, mobxPendingDecorators)) {
+                    var inheritedDecorators = target[mobxPendingDecorators];
+                    addHiddenProp(target, mobxPendingDecorators, __assign({}, inheritedDecorators));
+                }
+                target[mobxPendingDecorators][prop] = {
+                    prop: prop,
+                    propertyCreator: propertyCreator,
+                    descriptor: descriptor,
+                    decoratorTarget: target,
+                    decoratorArguments: decoratorArguments
+                };
+                return createPropertyInitializerDescriptor(prop, propertyInitiallyEnumerable);
+            };
+            if (quacksLikeADecorator(arguments)) {
+                // @decorator
+                decoratorArguments = EMPTY_ARRAY;
+                return decorator.apply(null, arguments);
+            }
+            else {
+                // @decorator(args)
+                decoratorArguments = Array.prototype.slice.call(arguments);
+                return decorator;
+            }
+        };
+    }
+    function quacksLikeADecorator(args) {
+        return (((args.length === 2 || args.length === 3) && typeof args[1] === "string") ||
+            (args.length === 4 && args[3] === true));
+    }
+
+    function deepEnhancer(v, _, name) {
+        // it is an observable already, done
+        if (isObservable(v))
+            return v;
+        // something that can be converted and mutated?
+        if (Array.isArray(v))
+            return observable.array(v, { name: name });
+        if (isPlainObject(v))
+            return observable.object(v, undefined, { name: name });
+        if (isES6Map(v))
+            return observable.map(v, { name: name });
+        if (isES6Set(v))
+            return observable.set(v, { name: name });
+        return v;
+    }
+    function shallowEnhancer(v, _, name) {
+        if (v === undefined || v === null)
+            return v;
+        if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v))
+            return v;
+        if (Array.isArray(v))
+            return observable.array(v, { name: name, deep: false });
+        if (isPlainObject(v))
+            return observable.object(v, undefined, { name: name, deep: false });
+        if (isES6Map(v))
+            return observable.map(v, { name: name, deep: false });
+        if (isES6Set(v))
+            return observable.set(v, { name: name, deep: false });
+        return fail(process.env.NODE_ENV !== "production" &&
+            "The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets");
+    }
+    function referenceEnhancer(newValue) {
+        // never turn into an observable
+        return newValue;
+    }
+    function refStructEnhancer(v, oldValue, name) {
+        if (process.env.NODE_ENV !== "production" && isObservable(v))
+            throw "observable.struct should not be used with observable values";
+        if (deepEqual(v, oldValue))
+            return oldValue;
+        return v;
+    }
+
+    function createDecoratorForEnhancer(enhancer) {
+        invariant(enhancer);
+        var decorator = createPropDecorator(true, function (target, propertyName, descriptor, _decoratorTarget, decoratorArgs) {
+            if (process.env.NODE_ENV !== "production") {
+                invariant(!descriptor || !descriptor.get, "@observable cannot be used on getter (property \"" + stringifyKey(propertyName) + "\"), use @computed instead.");
+            }
+            var initialValue = descriptor
+                ? descriptor.initializer
+                    ? descriptor.initializer.call(target)
+                    : descriptor.value
+                : undefined;
+            asObservableObject(target).addObservableProp(propertyName, initialValue, enhancer);
+        });
+        var res = 
+        // Extra process checks, as this happens during module initialization
+        typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production"
+            ? function observableDecorator() {
+                // This wrapper function is just to detect illegal decorator invocations, deprecate in a next version
+                // and simply return the created prop decorator
+                if (arguments.length < 2)
+                    return fail("Incorrect decorator invocation. @observable decorator doesn't expect any arguments");
+                return decorator.apply(null, arguments);
+            }
+            : decorator;
+        res.enhancer = enhancer;
+        return res;
+    }
+
+    // Predefined bags of create observable options, to avoid allocating temporarily option objects
+    // in the majority of cases
+    var defaultCreateObservableOptions = {
+        deep: true,
+        name: undefined,
+        defaultDecorator: undefined,
+        proxy: true
+    };
+    Object.freeze(defaultCreateObservableOptions);
+    function assertValidOption(key) {
+        if (!/^(deep|name|equals|defaultDecorator|proxy)$/.test(key))
+            fail("invalid option for (extend)observable: " + key);
+    }
+    function asCreateObservableOptions(thing) {
+        if (thing === null || thing === undefined)
+            return defaultCreateObservableOptions;
+        if (typeof thing === "string")
+            return { name: thing, deep: true, proxy: true };
+        if (process.env.NODE_ENV !== "production") {
+            if (typeof thing !== "object")
+                return fail("expected options object");
+            Object.keys(thing).forEach(assertValidOption);
+        }
+        return thing;
+    }
+    var deepDecorator = createDecoratorForEnhancer(deepEnhancer);
+    var shallowDecorator = createDecoratorForEnhancer(shallowEnhancer);
+    var refDecorator = createDecoratorForEnhancer(referenceEnhancer);
+    var refStructDecorator = createDecoratorForEnhancer(refStructEnhancer);
+    function getEnhancerFromOptions(options) {
+        return options.defaultDecorator
+            ? options.defaultDecorator.enhancer
+            : options.deep === false
+                ? referenceEnhancer
+                : deepEnhancer;
+    }
+    /**
+     * Turns an object, array or function into a reactive structure.
+     * @param v the value which should become observable.
+     */
+    function createObservable(v, arg2, arg3) {
+        // @observable someProp;
+        if (typeof arguments[1] === "string") {
+            return deepDecorator.apply(null, arguments);
+        }
+        // it is an observable already, done
+        if (isObservable(v))
+            return v;
+        // something that can be converted and mutated?
+        var res = isPlainObject(v)
+            ? observable.object(v, arg2, arg3)
+            : Array.isArray(v)
+                ? observable.array(v, arg2)
+                : isES6Map(v)
+                    ? observable.map(v, arg2)
+                    : isES6Set(v)
+                        ? observable.set(v, arg2)
+                        : v;
+        // this value could be converted to a new observable data structure, return it
+        if (res !== v)
+            return res;
+        // otherwise, just box it
+        fail(process.env.NODE_ENV !== "production" &&
+            "The provided value could not be converted into an observable. If you want just create an observable reference to the object use 'observable.box(value)'");
+    }
+    var observableFactories = {
+        box: function (value, options) {
+            if (arguments.length > 2)
+                incorrectlyUsedAsDecorator("box");
+            var o = asCreateObservableOptions(options);
+            return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals);
+        },
+        array: function (initialValues, options) {
+            if (arguments.length > 2)
+                incorrectlyUsedAsDecorator("array");
+            var o = asCreateObservableOptions(options);
+            return createObservableArray(initialValues, getEnhancerFromOptions(o), o.name);
+        },
+        map: function (initialValues, options) {
+            if (arguments.length > 2)
+                incorrectlyUsedAsDecorator("map");
+            var o = asCreateObservableOptions(options);
+            return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name);
+        },
+        set: function (initialValues, options) {
+            if (arguments.length > 2)
+                incorrectlyUsedAsDecorator("set");
+            var o = asCreateObservableOptions(options);
+            return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name);
+        },
+        object: function (props, decorators, options) {
+            if (typeof arguments[1] === "string")
+                incorrectlyUsedAsDecorator("object");
+            var o = asCreateObservableOptions(options);
+            if (o.proxy === false) {
+                return extendObservable({}, props, decorators, o);
+            }
+            else {
+                var defaultDecorator = getDefaultDecoratorFromObjectOptions(o);
+                var base = extendObservable({}, undefined, undefined, o);
+                var proxy = createDynamicObservableObject(base);
+                extendObservableObjectWithProperties(proxy, props, decorators, defaultDecorator);
+                return proxy;
+            }
+        },
+        ref: refDecorator,
+        shallow: shallowDecorator,
+        deep: deepDecorator,
+        struct: refStructDecorator
+    };
+    var observable = createObservable;
+    // weird trick to keep our typings nicely with our funcs, and still extend the observable function
+    Object.keys(observableFactories).forEach(function (name) { return (observable[name] = observableFactories[name]); });
+    function incorrectlyUsedAsDecorator(methodName) {
+        fail(
+        // process.env.NODE_ENV !== "production" &&
+        "Expected one or two arguments to observable." + methodName + ". Did you accidentally try to use observable." + methodName + " as decorator?");
+    }
+
+    var computedDecorator = createPropDecorator(false, function (instance, propertyName, descriptor, decoratorTarget, decoratorArgs) {
+        var get = descriptor.get, set = descriptor.set; // initialValue is the descriptor for get / set props
+        // Optimization: faster on decorator target or instance? Assuming target
+        // Optimization: find out if declaring on instance isn't just faster. (also makes the property descriptor simpler). But, more memory usage..
+        // Forcing instance now, fixes hot reloadig issues on React Native:
+        var options = decoratorArgs[0] || {};
+        asObservableObject(instance).addComputedProp(instance, propertyName, __assign({ get: get,
+            set: set, context: instance }, options));
+    });
+    var computedStructDecorator = computedDecorator({ equals: comparer.structural });
+    /**
+     * Decorator for class properties: @computed get value() { return expr; }.
+     * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;
+     */
+    var computed = function computed(arg1, arg2, arg3) {
+        if (typeof arg2 === "string") {
+            // @computed
+            return computedDecorator.apply(null, arguments);
+        }
+        if (arg1 !== null && typeof arg1 === "object" && arguments.length === 1) {
+            // @computed({ options })
+            return computedDecorator.apply(null, arguments);
+        }
+        // computed(expr, options?)
+        if (process.env.NODE_ENV !== "production") {
+            invariant(typeof arg1 === "function", "First argument to `computed` should be an expression.");
+            invariant(arguments.length < 3, "Computed takes one or two arguments if used as function");
+        }
+        var opts = typeof arg2 === "object" ? arg2 : {};
+        opts.get = arg1;
+        opts.set = typeof arg2 === "function" ? arg2 : opts.set;
+        opts.name = opts.name || arg1.name || ""; /* for generated name */
+        return new ComputedValue(opts);
+    };
+    computed.struct = computedStructDecorator;
+
+    function createAction(actionName, fn, ref) {
+        if (process.env.NODE_ENV !== "production") {
+            invariant(typeof fn === "function", "`action` can only be invoked on functions");
+            if (typeof actionName !== "string" || !actionName)
+                fail("actions should have valid names, got: '" + actionName + "'");
+        }
+        var res = function () {
+            return executeAction(actionName, fn, ref || this, arguments);
+        };
+        res.isMobxAction = true;
+        return res;
+    }
+    function executeAction(actionName, fn, scope, args) {
+        var runInfo = startAction(actionName, fn, scope, args);
+        var shouldSupressReactionError = true;
+        try {
+            var res = fn.apply(scope, args);
+            shouldSupressReactionError = false;
+            return res;
+        }
+        finally {
+            if (shouldSupressReactionError) {
+                globalState.suppressReactionErrors = shouldSupressReactionError;
+                endAction(runInfo);
+                globalState.suppressReactionErrors = false;
+            }
+            else {
+                endAction(runInfo);
+            }
+        }
+    }
+    function startAction(actionName, fn, scope, args) {
+        var notifySpy = isSpyEnabled() && !!actionName;
+        var startTime = 0;
+        if (notifySpy && process.env.NODE_ENV !== "production") {
+            startTime = Date.now();
+            var l = (args && args.length) || 0;
+            var flattendArgs = new Array(l);
+            if (l > 0)
+                for (var i = 0; i < l; i++)
+                    flattendArgs[i] = args[i];
+            spyReportStart({
+                type: "action",
+                name: actionName,
+                object: scope,
+                arguments: flattendArgs
+            });
+        }
+        var prevDerivation = untrackedStart();
+        startBatch();
+        var prevAllowStateChanges = allowStateChangesStart(true);
+        return {
+            prevDerivation: prevDerivation,
+            prevAllowStateChanges: prevAllowStateChanges,
+            notifySpy: notifySpy,
+            startTime: startTime
+        };
+    }
+    function endAction(runInfo) {
+        allowStateChangesEnd(runInfo.prevAllowStateChanges);
+        endBatch();
+        untrackedEnd(runInfo.prevDerivation);
+        if (runInfo.notifySpy && process.env.NODE_ENV !== "production")
+            spyReportEnd({ time: Date.now() - runInfo.startTime });
+    }
+    function allowStateChanges(allowStateChanges, func) {
+        var prev = allowStateChangesStart(allowStateChanges);
+        var res;
+        try {
+            res = func();
+        }
+        finally {
+            allowStateChangesEnd(prev);
+        }
+        return res;
+    }
+    function allowStateChangesStart(allowStateChanges) {
+        var prev = globalState.allowStateChanges;
+        globalState.allowStateChanges = allowStateChanges;
+        return prev;
+    }
+    function allowStateChangesEnd(prev) {
+        globalState.allowStateChanges = prev;
+    }
+    function allowStateChangesInsideComputed(func) {
+        var prev = globalState.computationDepth;
+        globalState.computationDepth = 0;
+        var res;
+        try {
+            res = func();
+        }
+        finally {
+            globalState.computationDepth = prev;
+        }
+        return res;
+    }
+
+    var ObservableValue = /** @class */ (function (_super) {
+        __extends(ObservableValue, _super);
+        function ObservableValue(value, enhancer, name, notifySpy, equals) {
+            if (name === void 0) { name = "ObservableValue@" + getNextId(); }
+            if (notifySpy === void 0) { notifySpy = true; }
+            if (equals === void 0) { equals = comparer.default; }
+            var _this = _super.call(this, name) || this;
+            _this.enhancer = enhancer;
+            _this.name = name;
+            _this.equals = equals;
+            _this.hasUnreportedChange = false;
+            _this.value = enhancer(value, undefined, name);
+            if (notifySpy && isSpyEnabled() && process.env.NODE_ENV !== "production") {
+                // only notify spy if this is a stand-alone observable
+                spyReport({ type: "create", name: _this.name, newValue: "" + _this.value });
+            }
+            return _this;
+        }
+        ObservableValue.prototype.dehanceValue = function (value) {
+            if (this.dehancer !== undefined)
+                return this.dehancer(value);
+            return value;
+        };
+        ObservableValue.prototype.set = function (newValue) {
+            var oldValue = this.value;
+            newValue = this.prepareNewValue(newValue);
+            if (newValue !== globalState.UNCHANGED) {
+                var notifySpy = isSpyEnabled();
+                if (notifySpy && process.env.NODE_ENV !== "production") {
+                    spyReportStart({
+                        type: "update",
+                        name: this.name,
+                        newValue: newValue,
+                        oldValue: oldValue
+                    });
+                }
+                this.setNewValue(newValue);
+                if (notifySpy && process.env.NODE_ENV !== "production")
+                    spyReportEnd();
+            }
+        };
+        ObservableValue.prototype.prepareNewValue = function (newValue) {
+            checkIfStateModificationsAreAllowed(this);
+            if (hasInterceptors(this)) {
+                var change = interceptChange(this, {
+                    object: this,
+                    type: "update",
+                    newValue: newValue
+                });
+                if (!change)
+                    return globalState.UNCHANGED;
+                newValue = change.newValue;
+            }
+            // apply modifier
+            newValue = this.enhancer(newValue, this.value, this.name);
+            return this.equals(this.value, newValue) ? globalState.UNCHANGED : newValue;
+        };
+        ObservableValue.prototype.setNewValue = function (newValue) {
+            var oldValue = this.value;
+            this.value = newValue;
+            this.reportChanged();
+            if (hasListeners(this)) {
+                notifyListeners(this, {
+                    type: "update",
+                    object: this,
+                    newValue: newValue,
+                    oldValue: oldValue
+                });
+            }
+        };
+        ObservableValue.prototype.get = function () {
+            this.reportObserved();
+            return this.dehanceValue(this.value);
+        };
+        ObservableValue.prototype.intercept = function (handler) {
+            return registerInterceptor(this, handler);
+        };
+        ObservableValue.prototype.observe = function (listener, fireImmediately) {
+            if (fireImmediately)
+                listener({
+                    object: this,
+                    type: "update",
+                    newValue: this.value,
+                    oldValue: undefined
+                });
+            return registerListener(this, listener);
+        };
+        ObservableValue.prototype.toJSON = function () {
+            return this.get();
+        };
+        ObservableValue.prototype.toString = function () {
+            return this.name + "[" + this.value + "]";
+        };
+        ObservableValue.prototype.valueOf = function () {
+            return toPrimitive(this.get());
+        };
+        ObservableValue.prototype[Symbol.toPrimitive] = function () {
+            return this.valueOf();
+        };
+        return ObservableValue;
+    }(Atom));
+    var isObservableValue = createInstanceofPredicate("ObservableValue", ObservableValue);
+
+    /**
+     * A node in the state dependency root that observes other nodes, and can be observed itself.
+     *
+     * ComputedValue will remember the result of the computation for the duration of the batch, or
+     * while being observed.
+     *
+     * During this time it will recompute only when one of its direct dependencies changed,
+     * but only when it is being accessed with `ComputedValue.get()`.
+     *
+     * Implementation description:
+     * 1. First time it's being accessed it will compute and remember result
+     *    give back remembered result until 2. happens
+     * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.
+     * 3. When it's being accessed, recompute if any shallow dependency changed.
+     *    if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.
+     *    go to step 2. either way
+     *
+     * If at any point it's outside batch and it isn't observed: reset everything and go to 1.
+     */
+    var ComputedValue = /** @class */ (function () {
+        /**
+         * Create a new computed value based on a function expression.
+         *
+         * The `name` property is for debug purposes only.
+         *
+         * The `equals` property specifies the comparer function to use to determine if a newly produced
+         * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`
+         * compares based on identity comparison (===), and `structualComparer` deeply compares the structure.
+         * Structural comparison can be convenient if you always produce a new aggregated object and
+         * don't want to notify observers if it is structurally the same.
+         * This is useful for working with vectors, mouse coordinates etc.
+         */
+        function ComputedValue(options) {
+            this.dependenciesState = exports.IDerivationState.NOT_TRACKING;
+            this.observing = []; // nodes we are looking at. Our value depends on these nodes
+            this.newObserving = null; // during tracking it's an array with new observed observers
+            this.isBeingObserved = false;
+            this.isPendingUnobservation = false;
+            this.observers = new Set();
+            this.diffValue = 0;
+            this.runId = 0;
+            this.lastAccessedBy = 0;
+            this.lowestObserverState = exports.IDerivationState.UP_TO_DATE;
+            this.unboundDepsCount = 0;
+            this.__mapid = "#" + getNextId();
+            this.value = new CaughtException(null);
+            this.isComputing = false; // to check for cycles
+            this.isRunningSetter = false;
+            this.isTracing = TraceMode.NONE;
+            if (process.env.NODE_ENV !== "production" && !options.get)
+                throw "[mobx] missing option for computed: get";
+            this.derivation = options.get;
+            this.name = options.name || "ComputedValue@" + getNextId();
+            if (options.set)
+                this.setter = createAction(this.name + "-setter", options.set);
+            this.equals =
+                options.equals ||
+                    (options.compareStructural || options.struct
+                        ? comparer.structural
+                        : comparer.default);
+            this.scope = options.context;
+            this.requiresReaction = !!options.requiresReaction;
+            this.keepAlive = !!options.keepAlive;
+        }
+        ComputedValue.prototype.onBecomeStale = function () {
+            propagateMaybeChanged(this);
+        };
+        ComputedValue.prototype.onBecomeObserved = function () {
+            if (this.onBecomeObservedListeners) {
+                this.onBecomeObservedListeners.forEach(function (listener) { return listener(); });
+            }
+        };
+        ComputedValue.prototype.onBecomeUnobserved = function () {
+            if (this.onBecomeUnobservedListeners) {
+                this.onBecomeUnobservedListeners.forEach(function (listener) { return listener(); });
+            }
+        };
+        /**
+         * Returns the current value of this computed value.
+         * Will evaluate its computation first if needed.
+         */
+        ComputedValue.prototype.get = function () {
+            if (this.isComputing)
+                fail("Cycle detected in computation " + this.name + ": " + this.derivation);
+            if (globalState.inBatch === 0 && this.observers.size === 0 && !this.keepAlive) {
+                if (shouldCompute(this)) {
+                    this.warnAboutUntrackedRead();
+                    startBatch(); // See perf test 'computed memoization'
+                    this.value = this.computeValue(false);
+                    endBatch();
+                }
+            }
+            else {
+                reportObserved(this);
+                if (shouldCompute(this))
+                    if (this.trackAndCompute())
+                        propagateChangeConfirmed(this);
+            }
+            var result = this.value;
+            if (isCaughtException(result))
+                throw result.cause;
+            return result;
+        };
+        ComputedValue.prototype.peek = function () {
+            var res = this.computeValue(false);
+            if (isCaughtException(res))
+                throw res.cause;
+            return res;
+        };
+        ComputedValue.prototype.set = function (value) {
+            if (this.setter) {
+                invariant(!this.isRunningSetter, "The setter of computed value '" + this.name + "' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?");
+                this.isRunningSetter = true;
+                try {
+                    this.setter.call(this.scope, value);
+                }
+                finally {
+                    this.isRunningSetter = false;
+                }
+            }
+            else
+                invariant(false, process.env.NODE_ENV !== "production" &&
+                    "[ComputedValue '" + this.name + "'] It is not possible to assign a new value to a computed value.");
+        };
+        ComputedValue.prototype.trackAndCompute = function () {
+            if (isSpyEnabled() && process.env.NODE_ENV !== "production") {
+                spyReport({
+                    object: this.scope,
+                    type: "compute",
+                    name: this.name
+                });
+            }
+            var oldValue = this.value;
+            var wasSuspended = 
+            /* see #1208 */ this.dependenciesState === exports.IDerivationState.NOT_TRACKING;
+            var newValue = this.computeValue(true);
+            var changed = wasSuspended ||
+                isCaughtException(oldValue) ||
+                isCaughtException(newValue) ||
+                !this.equals(oldValue, newValue);
+            if (changed) {
+                this.value = newValue;
+            }
+            return changed;
+        };
+        ComputedValue.prototype.computeValue = function (track) {
+            this.isComputing = true;
+            globalState.computationDepth++;
+            var res;
+            if (track) {
+                res = trackDerivedFunction(this, this.derivation, this.scope);
+            }
+            else {
+                if (globalState.disableErrorBoundaries === true) {
+                    res = this.derivation.call(this.scope);
+                }
+                else {
+                    try {
+                        res = this.derivation.call(this.scope);
+                    }
+                    catch (e) {
+                        res = new CaughtException(e);
+                    }
+                }
+            }
+            globalState.computationDepth--;
+            this.isComputing = false;
+            return res;
+        };
+        ComputedValue.prototype.suspend = function () {
+            if (!this.keepAlive) {
+                clearObserving(this);
+                this.value = undefined; // don't hold on to computed value!
+            }
+        };
+        ComputedValue.prototype.observe = function (listener, fireImmediately) {
+            var _this = this;
+            var firstTime = true;
+            var prevValue = undefined;
+            return autorun(function () {
+                var newValue = _this.get();
+                if (!firstTime || fireImmediately) {
+                    var prevU = untrackedStart();
+                    listener({
+                        type: "update",
+                        object: _this,
+                        newValue: newValue,
+                        oldValue: prevValue
+                    });
+                    untrackedEnd(prevU);
+                }
+                firstTime = false;
+                prevValue = newValue;
+            });
+        };
+        ComputedValue.prototype.warnAboutUntrackedRead = function () {
+            if (process.env.NODE_ENV === "production")
+                return;
+            if (this.requiresReaction === true) {
+                fail("[mobx] Computed value " + this.name + " is read outside a reactive context");
+            }
+            if (this.isTracing !== TraceMode.NONE) {
+                console.log("[mobx.trace] '" + this.name + "' is being read outside a reactive context. Doing a full recompute");
+            }
+            if (globalState.computedRequiresReaction) {
+                console.warn("[mobx] Computed value " + this.name + " is being read outside a reactive context. Doing a full recompute");
+            }
+        };
+        ComputedValue.prototype.toJSON = function () {
+            return this.get();
+        };
+        ComputedValue.prototype.toString = function () {
+            return this.name + "[" + this.derivation.toString() + "]";
+        };
+        ComputedValue.prototype.valueOf = function () {
+            return toPrimitive(this.get());
+        };
+        ComputedValue.prototype[Symbol.toPrimitive] = function () {
+            return this.valueOf();
+        };
+        return ComputedValue;
+    }());
+    var isComputedValue = createInstanceofPredicate("ComputedValue", ComputedValue);
+
+    (function (IDerivationState) {
+        // before being run or (outside batch and not being observed)
+        // at this point derivation is not holding any data about dependency tree
+        IDerivationState[IDerivationState["NOT_TRACKING"] = -1] = "NOT_TRACKING";
+        // no shallow dependency changed since last computation
+        // won't recalculate derivation
+        // this is what makes mobx fast
+        IDerivationState[IDerivationState["UP_TO_DATE"] = 0] = "UP_TO_DATE";
+        // some deep dependency changed, but don't know if shallow dependency changed
+        // will require to check first if UP_TO_DATE or POSSIBLY_STALE
+        // currently only ComputedValue will propagate POSSIBLY_STALE
+        //
+        // having this state is second big optimization:
+        // don't have to recompute on every dependency change, but only when it's needed
+        IDerivationState[IDerivationState["POSSIBLY_STALE"] = 1] = "POSSIBLY_STALE";
+        // A shallow dependency has changed since last computation and the derivation
+        // will need to recompute when it's needed next.
+        IDerivationState[IDerivationState["STALE"] = 2] = "STALE";
+    })(exports.IDerivationState || (exports.IDerivationState = {}));
+    var TraceMode;
+    (function (TraceMode) {
+        TraceMode[TraceMode["NONE"] = 0] = "NONE";
+        TraceMode[TraceMode["LOG"] = 1] = "LOG";
+        TraceMode[TraceMode["BREAK"] = 2] = "BREAK";
+    })(TraceMode || (TraceMode = {}));
+    var CaughtException = /** @class */ (function () {
+        function CaughtException(cause) {
+            this.cause = cause;
+            // Empty
+        }
+        return CaughtException;
+    }());
+    function isCaughtException(e) {
+        return e instanceof CaughtException;
+    }
+    /**
+     * Finds out whether any dependency of the derivation has actually changed.
+     * If dependenciesState is 1 then it will recalculate dependencies,
+     * if any dependency changed it will propagate it by changing dependenciesState to 2.
+     *
+     * By iterating over the dependencies in the same order that they were reported and
+     * stopping on the first change, all the recalculations are only called for ComputedValues
+     * that will be tracked by derivation. That is because we assume that if the first x
+     * dependencies of the derivation doesn't change then the derivation should run the same way
+     * up until accessing x-th dependency.
+     */
+    function shouldCompute(derivation) {
+        switch (derivation.dependenciesState) {
+            case exports.IDerivationState.UP_TO_DATE:
+                return false;
+            case exports.IDerivationState.NOT_TRACKING:
+            case exports.IDerivationState.STALE:
+                return true;
+            case exports.IDerivationState.POSSIBLY_STALE: {
+                var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.
+                var obs = derivation.observing, l = obs.length;
+                for (var i = 0; i < l; i++) {
+                    var obj = obs[i];
+                    if (isComputedValue(obj)) {
+                        if (globalState.disableErrorBoundaries) {
+                            obj.get();
+                        }
+                        else {
+                            try {
+                                obj.get();
+                            }
+                            catch (e) {
+                                // we are not interested in the value *or* exception at this moment, but if there is one, notify all
+                                untrackedEnd(prevUntracked);
+                                return true;
+                            }
+                        }
+                        // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.
+                        // and `derivation` is an observer of `obj`
+                        // invariantShouldCompute(derivation)
+                        if (derivation.dependenciesState === exports.IDerivationState.STALE) {
+                            untrackedEnd(prevUntracked);
+                            return true;
+                        }
+                    }
+                }
+                changeDependenciesStateTo0(derivation);
+                untrackedEnd(prevUntracked);
+                return false;
+            }
+        }
+    }
+    // function invariantShouldCompute(derivation: IDerivation) {
+    //     const newDepState = (derivation as any).dependenciesState
+    //     if (
+    //         process.env.NODE_ENV === "production" &&
+    //         (newDepState === IDerivationState.POSSIBLY_STALE ||
+    //             newDepState === IDerivationState.NOT_TRACKING)
+    //     )
+    //         fail("Illegal dependency state")
+    // }
+    function isComputingDerivation() {
+        return globalState.trackingDerivation !== null; // filter out actions inside computations
+    }
+    function checkIfStateModificationsAreAllowed(atom) {
+        var hasObservers = atom.observers.size > 0;
+        // Should never be possible to change an observed observable from inside computed, see #798
+        if (globalState.computationDepth > 0 && hasObservers)
+            fail(process.env.NODE_ENV !== "production" &&
+                "Computed values are not allowed to cause side effects by changing observables that are already being observed. Tried to modify: " + atom.name);
+        // Should not be possible to change observed state outside strict mode, except during initialization, see #563
+        if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === "strict"))
+            fail(process.env.NODE_ENV !== "production" &&
+                (globalState.enforceActions
+                    ? "Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended. Tried to modify: "
+                    : "Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, the render function of a React component? Tried to modify: ") +
+                    atom.name);
+    }
+    /**
+     * Executes the provided function `f` and tracks which observables are being accessed.
+     * The tracking information is stored on the `derivation` object and the derivation is registered
+     * as observer of any of the accessed observables.
+     */
+    function trackDerivedFunction(derivation, f, context) {
+        // pre allocate array allocation + room for variation in deps
+        // array will be trimmed by bindDependencies
+        changeDependenciesStateTo0(derivation);
+        derivation.newObserving = new Array(derivation.observing.length + 100);
+        derivation.unboundDepsCount = 0;
+        derivation.runId = ++globalState.runId;
+        var prevTracking = globalState.trackingDerivation;
+        globalState.trackingDerivation = derivation;
+        var result;
+        if (globalState.disableErrorBoundaries === true) {
+            result = f.call(context);
+        }
+        else {
+            try {
+                result = f.call(context);
+            }
+            catch (e) {
+                result = new CaughtException(e);
+            }
+        }
+        globalState.trackingDerivation = prevTracking;
+        bindDependencies(derivation);
+        return result;
+    }
+    /**
+     * diffs newObserving with observing.
+     * update observing to be newObserving with unique observables
+     * notify observers that become observed/unobserved
+     */
+    function bindDependencies(derivation) {
+        // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, "INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1");
+        var prevObserving = derivation.observing;
+        var observing = (derivation.observing = derivation.newObserving);
+        var lowestNewObservingDerivationState = exports.IDerivationState.UP_TO_DATE;
+        // Go through all new observables and check diffValue: (this list can contain duplicates):
+        //   0: first occurrence, change to 1 and keep it
+        //   1: extra occurrence, drop it
+        var i0 = 0, l = derivation.unboundDepsCount;
+        for (var i = 0; i < l; i++) {
+            var dep = observing[i];
+            if (dep.diffValue === 0) {
+                dep.diffValue = 1;
+                if (i0 !== i)
+                    observing[i0] = dep;
+                i0++;
+            }
+            // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,
+            // not hitting the condition
+            if (dep.dependenciesState > lowestNewObservingDerivationState) {
+                lowestNewObservingDerivationState = dep.dependenciesState;
+            }
+        }
+        observing.length = i0;
+        derivation.newObserving = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)
+        // Go through all old observables and check diffValue: (it is unique after last bindDependencies)
+        //   0: it's not in new observables, unobserve it
+        //   1: it keeps being observed, don't want to notify it. change to 0
+        l = prevObserving.length;
+        while (l--) {
+            var dep = prevObserving[l];
+            if (dep.diffValue === 0) {
+                removeObserver(dep, derivation);
+            }
+            dep.diffValue = 0;
+        }
+        // Go through all new observables and check diffValue: (now it should be unique)
+        //   0: it was set to 0 in last loop. don't need to do anything.
+        //   1: it wasn't observed, let's observe it. set back to 0
+        while (i0--) {
+            var dep = observing[i0];
+            if (dep.diffValue === 1) {
+                dep.diffValue = 0;
+                addObserver(dep, derivation);
+            }
+        }
+        // Some new observed derivations may become stale during this derivation computation
+        // so they have had no chance to propagate staleness (#916)
+        if (lowestNewObservingDerivationState !== exports.IDerivationState.UP_TO_DATE) {
+            derivation.dependenciesState = lowestNewObservingDerivationState;
+            derivation.onBecomeStale();
+        }
+    }
+    function clearObserving(derivation) {
+        // invariant(globalState.inBatch > 0, "INTERNAL ERROR clearObserving should be called only inside batch");
+        var obs = derivation.observing;
+        derivation.observing = [];
+        var i = obs.length;
+        while (i--)
+            removeObserver(obs[i], derivation);
+        derivation.dependenciesState = exports.IDerivationState.NOT_TRACKING;
+    }
+    function untracked(action) {
+        var prev = untrackedStart();
+        try {
+            return action();
+        }
+        finally {
+            untrackedEnd(prev);
+        }
+    }
+    function untrackedStart() {
+        var prev = globalState.trackingDerivation;
+        globalState.trackingDerivation = null;
+        return prev;
+    }
+    function untrackedEnd(prev) {
+        globalState.trackingDerivation = prev;
+    }
+    /**
+     * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0
+     *
+     */
+    function changeDependenciesStateTo0(derivation) {
+        if (derivation.dependenciesState === exports.IDerivationState.UP_TO_DATE)
+            return;
+        derivation.dependenciesState = exports.IDerivationState.UP_TO_DATE;
+        var obs = derivation.observing;
+        var i = obs.length;
+        while (i--)
+            obs[i].lowestObserverState = exports.IDerivationState.UP_TO_DATE;
+    }
+
+    /**
+     * These values will persist if global state is reset
+     */
+    var persistentKeys = [
+        "mobxGuid",
+        "spyListeners",
+        "enforceActions",
+        "computedRequiresReaction",
+        "disableErrorBoundaries",
+        "runId",
+        "UNCHANGED"
+    ];
+    var MobXGlobals = /** @class */ (function () {
+        function MobXGlobals() {
+            /**
+             * MobXGlobals version.
+             * MobX compatiblity with other versions loaded in memory as long as this version matches.
+             * It indicates that the global state still stores similar information
+             *
+             * N.B: this version is unrelated to the package version of MobX, and is only the version of the
+             * internal state storage of MobX, and can be the same across many different package versions
+             */
+            this.version = 5;
+            /**
+             * globally unique token to signal unchanged
+             */
+            this.UNCHANGED = {};
+            /**
+             * Currently running derivation
+             */
+            this.trackingDerivation = null;
+            /**
+             * Are we running a computation currently? (not a reaction)
+             */
+            this.computationDepth = 0;
+            /**
+             * Each time a derivation is tracked, it is assigned a unique run-id
+             */
+            this.runId = 0;
+            /**
+             * 'guid' for general purpose. Will be persisted amongst resets.
+             */
+            this.mobxGuid = 0;
+            /**
+             * Are we in a batch block? (and how many of them)
+             */
+            this.inBatch = 0;
+            /**
+             * Observables that don't have observers anymore, and are about to be
+             * suspended, unless somebody else accesses it in the same batch
+             *
+             * @type {IObservable[]}
+             */
+            this.pendingUnobservations = [];
+            /**
+             * List of scheduled, not yet executed, reactions.
+             */
+            this.pendingReactions = [];
+            /**
+             * Are we currently processing reactions?
+             */
+            this.isRunningReactions = false;
+            /**
+             * Is it allowed to change observables at this point?
+             * In general, MobX doesn't allow that when running computations and React.render.
+             * To ensure that those functions stay pure.
+             */
+            this.allowStateChanges = true;
+            /**
+             * If strict mode is enabled, state changes are by default not allowed
+             */
+            this.enforceActions = false;
+            /**
+             * Spy callbacks
+             */
+            this.spyListeners = [];
+            /**
+             * Globally attached error handlers that react specifically to errors in reactions
+             */
+            this.globalReactionErrorHandlers = [];
+            /**
+             * Warn if computed values are accessed outside a reactive context
+             */
+            this.computedRequiresReaction = false;
+            /**
+             * Allows overwriting of computed properties, useful in tests but not prod as it can cause
+             * memory leaks. See https://github.com/mobxjs/mobx/issues/1867
+             */
+            this.computedConfigurable = false;
+            /*
+             * Don't catch and rethrow exceptions. This is useful for inspecting the state of
+             * the stack when an exception occurs while debugging.
+             */
+            this.disableErrorBoundaries = false;
+            /*
+             * If true, we are already handling an exception in an action. Any errors in reactions should be supressed, as
+             * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836
+             */
+            this.suppressReactionErrors = false;
+        }
+        return MobXGlobals;
+    }());
+    var canMergeGlobalState = true;
+    var isolateCalled = false;
+    var globalState = (function () {
+        var global = getGlobal();
+        if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals)
+            canMergeGlobalState = false;
+        if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version)
+            canMergeGlobalState = false;
+        if (!canMergeGlobalState) {
+            setTimeout(function () {
+                if (!isolateCalled) {
+                    fail("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`");
+                }
+            }, 1);
+            return new MobXGlobals();
+        }
+        else if (global.__mobxGlobals) {
+            global.__mobxInstanceCount += 1;
+            if (!global.__mobxGlobals.UNCHANGED)
+                global.__mobxGlobals.UNCHANGED = {}; // make merge backward compatible
+            return global.__mobxGlobals;
+        }
+        else {
+            global.__mobxInstanceCount = 1;
+            return (global.__mobxGlobals = new MobXGlobals());
+        }
+    })();
+    function isolateGlobalState() {
+        if (globalState.pendingReactions.length ||
+            globalState.inBatch ||
+            globalState.isRunningReactions)
+            fail("isolateGlobalState should be called before MobX is running any reactions");
+        isolateCalled = true;
+        if (canMergeGlobalState) {
+            if (--getGlobal().__mobxInstanceCount === 0)
+                getGlobal().__mobxGlobals = undefined;
+            globalState = new MobXGlobals();
+        }
+    }
+    function getGlobalState() {
+        return globalState;
+    }
+    /**
+     * For testing purposes only; this will break the internal state of existing observables,
+     * but can be used to get back at a stable state after throwing errors
+     */
+    function resetGlobalState() {
+        var defaultGlobals = new MobXGlobals();
+        for (var key in defaultGlobals)
+            if (persistentKeys.indexOf(key) === -1)
+                globalState[key] = defaultGlobals[key];
+        globalState.allowStateChanges = !globalState.enforceActions;
+    }
+    function getGlobal() {
+        return typeof window !== "undefined" ? window : global;
+    }
+
+    function hasObservers(observable) {
+        return observable.observers && observable.observers.size > 0;
+    }
+    function getObservers(observable) {
+        return observable.observers;
+    }
+    // function invariantObservers(observable: IObservable) {
+    //     const list = observable.observers
+    //     const map = observable.observersIndexes
+    //     const l = list.length
+    //     for (let i = 0; i < l; i++) {
+    //         const id = list[i].__mapid
+    //         if (i) {
+    //             invariant(map[id] === i, "INTERNAL ERROR maps derivation.__mapid to index in list") // for performance
+    //         } else {
+    //             invariant(!(id in map), "INTERNAL ERROR observer on index 0 shouldn't be held in map.") // for performance
+    //         }
+    //     }
+    //     invariant(
+    //         list.length === 0 || Object.keys(map).length === list.length - 1,
+    //         "INTERNAL ERROR there is no junk in map"
+    //     )
+    // }
+    function addObserver(observable, node) {
+        // invariant(node.dependenciesState !== -1, "INTERNAL ERROR, can add only dependenciesState !== -1");
+        // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR add already added node");
+        // invariantObservers(observable);
+        observable.observers.add(node);
+        if (observable.lowestObserverState > node.dependenciesState)
+            observable.lowestObserverState = node.dependenciesState;
+        // invariantObservers(observable);
+        // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node");
+    }
+    function removeObserver(observable, node) {
+        // invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch");
+        // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR remove already removed node");
+        // invariantObservers(observable);
+        observable.observers.delete(node);
+        if (observable.observers.size === 0) {
+            // deleting last observer
+            queueForUnobservation(observable);
+        }
+        // invariantObservers(observable);
+        // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR remove already removed node2");
+    }
+    function queueForUnobservation(observable) {
+        if (observable.isPendingUnobservation === false) {
+            // invariant(observable._observers.length === 0, "INTERNAL ERROR, should only queue for unobservation unobserved observables");
+            observable.isPendingUnobservation = true;
+            globalState.pendingUnobservations.push(observable);
+        }
+    }
+    /**
+     * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.
+     * During a batch `onBecomeUnobserved` will be called at most once per observable.
+     * Avoids unnecessary recalculations.
+     */
+    function startBatch() {
+        globalState.inBatch++;
+    }
+    function endBatch() {
+        if (--globalState.inBatch === 0) {
+            runReactions();
+            // the batch is actually about to finish, all unobserving should happen here.
+            var list = globalState.pendingUnobservations;
+            for (var i = 0; i < list.length; i++) {
+                var observable = list[i];
+                observable.isPendingUnobservation = false;
+                if (observable.observers.size === 0) {
+                    if (observable.isBeingObserved) {
+                        // if this observable had reactive observers, trigger the hooks
+                        observable.isBeingObserved = false;
+                        observable.onBecomeUnobserved();
+                    }
+                    if (observable instanceof ComputedValue) {
+                        // computed values are automatically teared down when the last observer leaves
+                        // this process happens recursively, this computed might be the last observabe of another, etc..
+                        observable.suspend();
+                    }
+                }
+            }
+            globalState.pendingUnobservations = [];
+        }
+    }
+    function reportObserved(observable) {
+        var derivation = globalState.trackingDerivation;
+        if (derivation !== null) {
+            /**
+             * Simple optimization, give each derivation run an unique id (runId)
+             * Check if last time this observable was accessed the same runId is used
+             * if this is the case, the relation is already known
+             */
+            if (derivation.runId !== observable.lastAccessedBy) {
+                observable.lastAccessedBy = derivation.runId;
+                // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...
+                derivation.newObserving[derivation.unboundDepsCount++] = observable;
+                if (!observable.isBeingObserved) {
+                    observable.isBeingObserved = true;
+                    observable.onBecomeObserved();
+                }
+            }
+            return true;
+        }
+        else if (observable.observers.size === 0 && globalState.inBatch > 0) {
+            queueForUnobservation(observable);
+        }
+        return false;
+    }
+    // function invariantLOS(observable: IObservable, msg: string) {
+    //     // it's expensive so better not run it in produciton. but temporarily helpful for testing
+    //     const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)
+    //     if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`
+    //     throw new Error(
+    //         "lowestObserverState is wrong for " +
+    //             msg +
+    //             " because " +
+    //             min +
+    //             " < " +
+    //             observable.lowestObserverState
+    //     )
+    // }
+    /**
+     * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly
+     * It will propagate changes to observers from previous run
+     * It's hard or maybe impossible (with reasonable perf) to get it right with current approach
+     * Hopefully self reruning autoruns aren't a feature people should depend on
+     * Also most basic use cases should be ok
+     */
+    // Called by Atom when its value changes
+    function propagateChanged(observable) {
+        // invariantLOS(observable, "changed start");
+        if (observable.lowestObserverState === exports.IDerivationState.STALE)
+            return;
+        observable.lowestObserverState = exports.IDerivationState.STALE;
+        // Ideally we use for..of here, but the downcompiled version is really slow...
+        observable.observers.forEach(function (d) {
+            if (d.dependenciesState === exports.IDerivationState.UP_TO_DATE) {
+                if (d.isTracing !== TraceMode.NONE) {
+                    logTraceInfo(d, observable);
+                }
+                d.onBecomeStale();
+            }
+            d.dependenciesState = exports.IDerivationState.STALE;
+        });
+        // invariantLOS(observable, "changed end");
+    }
+    // Called by ComputedValue when it recalculate and its value changed
+    function propagateChangeConfirmed(observable) {
+        // invariantLOS(observable, "confirmed start");
+        if (observable.lowestObserverState === exports.IDerivationState.STALE)
+            return;
+        observable.lowestObserverState = exports.IDerivationState.STALE;
+        observable.observers.forEach(function (d) {
+            if (d.dependenciesState === exports.IDerivationState.POSSIBLY_STALE)
+                d.dependenciesState = exports.IDerivationState.STALE;
+            else if (d.dependenciesState === exports.IDerivationState.UP_TO_DATE // this happens during computing of `d`, just keep lowestObserverState up to date.
+            )
+                observable.lowestObserverState = exports.IDerivationState.UP_TO_DATE;
+        });
+        // invariantLOS(observable, "confirmed end");
+    }
+    // Used by computed when its dependency changed, but we don't wan't to immediately recompute.
+    function propagateMaybeChanged(observable) {
+        // invariantLOS(observable, "maybe start");
+        if (observable.lowestObserverState !== exports.IDerivationState.UP_TO_DATE)
+            return;
+        observable.lowestObserverState = exports.IDerivationState.POSSIBLY_STALE;
+        observable.observers.forEach(function (d) {
+            if (d.dependenciesState === exports.IDerivationState.UP_TO_DATE) {
+                d.dependenciesState = exports.IDerivationState.POSSIBLY_STALE;
+                if (d.isTracing !== TraceMode.NONE) {
+                    logTraceInfo(d, observable);
+                }
+                d.onBecomeStale();
+            }
+        });
+        // invariantLOS(observable, "maybe end");
+    }
+    function logTraceInfo(derivation, observable) {
+        console.log("[mobx.trace] '" + derivation.name + "' is invalidated due to a change in: '" + observable.name + "'");
+        if (derivation.isTracing === TraceMode.BREAK) {
+            var lines = [];
+            printDepTree(getDependencyTree(derivation), lines, 1);
+            // prettier-ignore
+            new Function("debugger;\n/*\nTracing '" + derivation.name + "'\n\nYou are entering this break point because derivation '" + derivation.name + "' is being traced and '" + observable.name + "' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\//g, "/") : "") + "\n\nThe dependencies for this derivation are:\n\n" + lines.join("\n") + "\n*/\n    ")();
+        }
+    }
+    function printDepTree(tree, lines, depth) {
+        if (lines.length >= 1000) {
+            lines.push("(and many more)");
+            return;
+        }
+        lines.push("" + new Array(depth).join("\t") + tree.name); // MWE: not the fastest, but the easiest way :)
+        if (tree.dependencies)
+            tree.dependencies.forEach(function (child) { return printDepTree(child, lines, depth + 1); });
+    }
+
+    var Reaction = /** @class */ (function () {
+        function Reaction(name, onInvalidate, errorHandler) {
+            if (name === void 0) { name = "Reaction@" + getNextId(); }
+            this.name = name;
+            this.onInvalidate = onInvalidate;
+            this.errorHandler = errorHandler;
+            this.observing = []; // nodes we are looking at. Our value depends on these nodes
+            this.newObserving = [];
+            this.dependenciesState = exports.IDerivationState.NOT_TRACKING;
+            this.diffValue = 0;
+            this.runId = 0;
+            this.unboundDepsCount = 0;
+            this.__mapid = "#" + getNextId();
+            this.isDisposed = false;
+            this._isScheduled = false;
+            this._isTrackPending = false;
+            this._isRunning = false;
+            this.isTracing = TraceMode.NONE;
+        }
+        Reaction.prototype.onBecomeStale = function () {
+            this.schedule();
+        };
+        Reaction.prototype.schedule = function () {
+            if (!this._isScheduled) {
+                this._isScheduled = true;
+                globalState.pendingReactions.push(this);
+                runReactions();
+            }
+        };
+        Reaction.prototype.isScheduled = function () {
+            return this._isScheduled;
+        };
+        /**
+         * internal, use schedule() if you intend to kick off a reaction
+         */
+        Reaction.prototype.runReaction = function () {
+            if (!this.isDisposed) {
+                startBatch();
+                this._isScheduled = false;
+                if (shouldCompute(this)) {
+                    this._isTrackPending = true;
+                    try {
+                        this.onInvalidate();
+                        if (this._isTrackPending &&
+                            isSpyEnabled() &&
+                            process.env.NODE_ENV !== "production") {
+                            // onInvalidate didn't trigger track right away..
+                            spyReport({
+                                name: this.name,
+                                type: "scheduled-reaction"
+                            });
+                        }
+                    }
+                    catch (e) {
+                        this.reportExceptionInDerivation(e);
+                    }
+                }
+                endBatch();
+            }
+        };
+        Reaction.prototype.track = function (fn) {
+            if (this.isDisposed) {
+                return;
+                // console.warn("Reaction already disposed") // Note: Not a warning / error in mobx 4 either
+            }
+            startBatch();
+            var notify = isSpyEnabled();
+            var startTime;
+            if (notify && process.env.NODE_ENV !== "production") {
+                startTime = Date.now();
+                spyReportStart({
+                    name: this.name,
+                    type: "reaction"
+                });
+            }
+            this._isRunning = true;
+            var result = trackDerivedFunction(this, fn, undefined);
+            this._isRunning = false;
+            this._isTrackPending = false;
+            if (this.isDisposed) {
+                // disposed during last run. Clean up everything that was bound after the dispose call.
+                clearObserving(this);
+            }
+            if (isCaughtException(result))
+                this.reportExceptionInDerivation(result.cause);
+            if (notify && process.env.NODE_ENV !== "production") {
+                spyReportEnd({
+                    time: Date.now() - startTime
+                });
+            }
+            endBatch();
+        };
+        Reaction.prototype.reportExceptionInDerivation = function (error) {
+            var _this = this;
+            if (this.errorHandler) {
+                this.errorHandler(error, this);
+                return;
+            }
+            if (globalState.disableErrorBoundaries)
+                throw error;
+            var message = "[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '" + this + "'";
+            if (globalState.suppressReactionErrors) {
+                console.warn("[mobx] (error in reaction '" + this.name + "' suppressed, fix error of causing action below)"); // prettier-ignore
+            }
+            else {
+                console.error(message, error);
+                /** If debugging brought you here, please, read the above message :-). Tnx! */
+            }
+            if (isSpyEnabled()) {
+                spyReport({
+                    type: "error",
+                    name: this.name,
+                    message: message,
+                    error: "" + error
+                });
+            }
+            globalState.globalReactionErrorHandlers.forEach(function (f) { return f(error, _this); });
+        };
+        Reaction.prototype.dispose = function () {
+            if (!this.isDisposed) {
+                this.isDisposed = true;
+                if (!this._isRunning) {
+                    // if disposed while running, clean up later. Maybe not optimal, but rare case
+                    startBatch();
+                    clearObserving(this);
+                    endBatch();
+                }
+            }
+        };
+        Reaction.prototype.getDisposer = function () {
+            var r = this.dispose.bind(this);
+            r[$mobx] = this;
+            return r;
+        };
+        Reaction.prototype.toString = function () {
+            return "Reaction[" + this.name + "]";
+        };
+        Reaction.prototype.trace = function (enterBreakPoint) {
+            if (enterBreakPoint === void 0) { enterBreakPoint = false; }
+            trace(this, enterBreakPoint);
+        };
+        return Reaction;
+    }());
+    function onReactionError(handler) {
+        globalState.globalReactionErrorHandlers.push(handler);
+        return function () {
+            var idx = globalState.globalReactionErrorHandlers.indexOf(handler);
+            if (idx >= 0)
+                globalState.globalReactionErrorHandlers.splice(idx, 1);
+        };
+    }
+    /**
+     * Magic number alert!
+     * Defines within how many times a reaction is allowed to re-trigger itself
+     * until it is assumed that this is gonna be a never ending loop...
+     */
+    var MAX_REACTION_ITERATIONS = 100;
+    var reactionScheduler = function (f) { return f(); };
+    function runReactions() {
+        // Trampolining, if runReactions are already running, new reactions will be picked up
+        if (globalState.inBatch > 0 || globalState.isRunningReactions)
+            return;
+        reactionScheduler(runReactionsHelper);
+    }
+    function runReactionsHelper() {
+        globalState.isRunningReactions = true;
+        var allReactions = globalState.pendingReactions;
+        var iterations = 0;
+        // While running reactions, new reactions might be triggered.
+        // Hence we work with two variables and check whether
+        // we converge to no remaining reactions after a while.
+        while (allReactions.length > 0) {
+            if (++iterations === MAX_REACTION_ITERATIONS) {
+                console.error("Reaction doesn't converge to a stable state after " + MAX_REACTION_ITERATIONS + " iterations." +
+                    (" Probably there is a cycle in the reactive function: " + allReactions[0]));
+                allReactions.splice(0); // clear reactions
+            }
+            var remainingReactions = allReactions.splice(0);
+            for (var i = 0, l = remainingReactions.length; i < l; i++)
+                remainingReactions[i].runReaction();
+        }
+        globalState.isRunningReactions = false;
+    }
+    var isReaction = createInstanceofPredicate("Reaction", Reaction);
+    function setReactionScheduler(fn) {
+        var baseScheduler = reactionScheduler;
+        reactionScheduler = function (f) { return fn(function () { return baseScheduler(f); }); };
+    }
+
+    function isSpyEnabled() {
+        return process.env.NODE_ENV !== "production" && !!globalState.spyListeners.length;
+    }
+    function spyReport(event) {
+        if (process.env.NODE_ENV === "production")
+            return; // dead code elimination can do the rest
+        if (!globalState.spyListeners.length)
+            return;
+        var listeners = globalState.spyListeners;
+        for (var i = 0, l = listeners.length; i < l; i++)
+            listeners[i](event);
+    }
+    function spyReportStart(event) {
+        if (process.env.NODE_ENV === "production")
+            return;
+        var change = __assign({}, event, { spyReportStart: true });
+        spyReport(change);
+    }
+    var END_EVENT = { spyReportEnd: true };
+    function spyReportEnd(change) {
+        if (process.env.NODE_ENV === "production")
+            return;
+        if (change)
+            spyReport(__assign({}, change, { spyReportEnd: true }));
+        else
+            spyReport(END_EVENT);
+    }
+    function spy(listener) {
+        if (process.env.NODE_ENV === "production") {
+            console.warn("[mobx.spy] Is a no-op in production builds");
+            return function () { };
+        }
+        else {
+            globalState.spyListeners.push(listener);
+            return once(function () {
+                globalState.spyListeners = globalState.spyListeners.filter(function (l) { return l !== listener; });
+            });
+        }
+    }
+
+    function dontReassignFields() {
+        fail(process.env.NODE_ENV !== "production" && "@action fields are not reassignable");
+    }
+    function namedActionDecorator(name) {
+        return function (target, prop, descriptor) {
+            if (descriptor) {
+                if (process.env.NODE_ENV !== "production" && descriptor.get !== undefined) {
+                    return fail("@action cannot be used with getters");
+                }
+                // babel / typescript
+                // @action method() { }
+                if (descriptor.value) {
+                    // typescript
+                    return {
+                        value: createAction(name, descriptor.value),
+                        enumerable: false,
+                        configurable: true,
+                        writable: true // for typescript, this must be writable, otherwise it cannot inherit :/ (see inheritable actions test)
+                    };
+                }
+                // babel only: @action method = () => {}
+                var initializer_1 = descriptor.initializer;
+                return {
+                    enumerable: false,
+                    configurable: true,
+                    writable: true,
+                    initializer: function () {
+                        // N.B: we can't immediately invoke initializer; this would be wrong
+                        return createAction(name, initializer_1.call(this));
+                    }
+                };
+            }
+            // bound instance methods
+            return actionFieldDecorator(name).apply(this, arguments);
+        };
+    }
+    function actionFieldDecorator(name) {
+        // Simple property that writes on first invocation to the current instance
+        return function (target, prop, descriptor) {
+            Object.defineProperty(target, prop, {
+                configurable: true,
+                enumerable: false,
+                get: function () {
+                    return undefined;
+                },
+                set: function (value) {
+                    addHiddenProp(this, prop, action(name, value));
+                }
+            });
+        };
+    }
+    function boundActionDecorator(target, propertyName, descriptor, applyToInstance) {
+        if (applyToInstance === true) {
+            defineBoundAction(target, propertyName, descriptor.value);
+            return null;
+        }
+        if (descriptor) {
+            // if (descriptor.value)
+            // Typescript / Babel: @action.bound method() { }
+            // also: babel @action.bound method = () => {}
+            return {
+                configurable: true,
+                enumerable: false,
+                get: function () {
+                    defineBoundAction(this, propertyName, descriptor.value || descriptor.initializer.call(this));
+                    return this[propertyName];
+                },
+                set: dontReassignFields
+            };
+        }
+        // field decorator Typescript @action.bound method = () => {}
+        return {
+            enumerable: false,
+            configurable: true,
+            set: function (v) {
+                defineBoundAction(this, propertyName, v);
+            },
+            get: function () {
+                return undefined;
+            }
+        };
+    }
+
+    var action = function action(arg1, arg2, arg3, arg4) {
+        // action(fn() {})
+        if (arguments.length === 1 && typeof arg1 === "function")
+            return createAction(arg1.name || "", arg1);
+        // action("name", fn() {})
+        if (arguments.length === 2 && typeof arg2 === "function")
+            return createAction(arg1, arg2);
+        // @action("name") fn() {}
+        if (arguments.length === 1 && typeof arg1 === "string")
+            return namedActionDecorator(arg1);
+        // @action fn() {}
+        if (arg4 === true) {
+            // apply to instance immediately
+            addHiddenProp(arg1, arg2, createAction(arg1.name || arg2, arg3.value, this));
+        }
+        else {
+            return namedActionDecorator(arg2).apply(null, arguments);
+        }
+    };
+    action.bound = boundActionDecorator;
+    function runInAction(arg1, arg2) {
+        var actionName = typeof arg1 === "string" ? arg1 : arg1.name || "";
+        var fn = typeof arg1 === "function" ? arg1 : arg2;
+        if (process.env.NODE_ENV !== "production") {
+            invariant(typeof fn === "function" && fn.length === 0, "`runInAction` expects a function without arguments");
+            if (typeof actionName !== "string" || !actionName)
+                fail("actions should have valid names, got: '" + actionName + "'");
+        }
+        return executeAction(actionName, fn, this, undefined);
+    }
+    function isAction(thing) {
+        return typeof thing === "function" && thing.isMobxAction === true;
+    }
+    function defineBoundAction(target, propertyName, fn) {
+        addHiddenProp(target, propertyName, createAction(propertyName, fn.bind(target)));
+    }
+
+    /**
+     * Creates a named reactive view and keeps it alive, so that the view is always
+     * updated if one of the dependencies changes, even when the view is not further used by something else.
+     * @param view The reactive view
+     * @returns disposer function, which can be used to stop the view from being updated in the future.
+     */
+    function autorun(view, opts) {
+        if (opts === void 0) { opts = EMPTY_OBJECT; }
+        if (process.env.NODE_ENV !== "production") {
+            invariant(typeof view === "function", "Autorun expects a function as first argument");
+            invariant(isAction(view) === false, "Autorun does not accept actions since actions are untrackable");
+        }
+        var name = (opts && opts.name) || view.name || "Autorun@" + getNextId();
+        var runSync = !opts.scheduler && !opts.delay;
+        var reaction;
+        if (runSync) {
+            // normal autorun
+            reaction = new Reaction(name, function () {
+                this.track(reactionRunner);
+            }, opts.onError);
+        }
+        else {
+            var scheduler_1 = createSchedulerFromOptions(opts);
+            // debounced autorun
+            var isScheduled_1 = false;
+            reaction = new Reaction(name, function () {
+                if (!isScheduled_1) {
+                    isScheduled_1 = true;
+                    scheduler_1(function () {
+                        isScheduled_1 = false;
+                        if (!reaction.isDisposed)
+                            reaction.track(reactionRunner);
+                    });
+                }
+            }, opts.onError);
+        }
+        function reactionRunner() {
+            view(reaction);
+        }
+        reaction.schedule();
+        return reaction.getDisposer();
+    }
+    var run = function (f) { return f(); };
+    function createSchedulerFromOptions(opts) {
+        return opts.scheduler
+            ? opts.scheduler
+            : opts.delay
+                ? function (f) { return setTimeout(f, opts.delay); }
+                : run;
+    }
+    function reaction(expression, effect, opts) {
+        if (opts === void 0) { opts = EMPTY_OBJECT; }
+        if (process.env.NODE_ENV !== "production") {
+            invariant(typeof expression === "function", "First argument to reaction should be a function");
+            invariant(typeof opts === "object", "Third argument of reactions should be an object");
+        }
+        var name = opts.name || "Reaction@" + getNextId();
+        var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);
+        var runSync = !opts.scheduler && !opts.delay;
+        var scheduler = createSchedulerFromOptions(opts);
+        var firstTime = true;
+        var isScheduled = false;
+        var value;
+        var equals = opts.compareStructural
+            ? comparer.structural
+            : opts.equals || comparer.default;
+        var r = new Reaction(name, function () {
+            if (firstTime || runSync) {
+                reactionRunner();
+            }
+            else if (!isScheduled) {
+                isScheduled = true;
+                scheduler(reactionRunner);
+            }
+        }, opts.onError);
+        function reactionRunner() {
+            isScheduled = false; // Q: move into reaction runner?
+            if (r.isDisposed)
+                return;
+            var changed = false;
+            r.track(function () {
+                var nextValue = expression(r);
+                changed = firstTime || !equals(value, nextValue);
+                value = nextValue;
+            });
+            if (firstTime && opts.fireImmediately)
+                effectAction(value, r);
+            if (!firstTime && changed === true)
+                effectAction(value, r);
+            if (firstTime)
+                firstTime = false;
+        }
+        r.schedule();
+        return r.getDisposer();
+    }
+    function wrapErrorHandler(errorHandler, baseFn) {
+        return function () {
+            try {
+                return baseFn.apply(this, arguments);
+            }
+            catch (e) {
+                errorHandler.call(this, e);
+            }
+        };
+    }
+
+    function onBecomeObserved(thing, arg2, arg3) {
+        return interceptHook("onBecomeObserved", thing, arg2, arg3);
+    }
+    function onBecomeUnobserved(thing, arg2, arg3) {
+        return interceptHook("onBecomeUnobserved", thing, arg2, arg3);
+    }
+    function interceptHook(hook, thing, arg2, arg3) {
+        var atom = typeof arg2 === "string" ? getAtom(thing, arg2) : getAtom(thing);
+        var cb = typeof arg2 === "string" ? arg3 : arg2;
+        var listenersKey = hook + "Listeners";
+        if (atom[listenersKey]) {
+            atom[listenersKey].add(cb);
+        }
+        else {
+            atom[listenersKey] = new Set([cb]);
+        }
+        var orig = atom[hook];
+        if (typeof orig !== "function")
+            return fail(process.env.NODE_ENV !== "production" && "Not an atom that can be (un)observed");
+        return function () {
+            var hookListeners = atom[listenersKey];
+            if (hookListeners) {
+                hookListeners.delete(cb);
+                if (hookListeners.size === 0) {
+                    delete atom[listenersKey];
+                }
+            }
+        };
+    }
+
+    function configure(options) {
+        var enforceActions = options.enforceActions, computedRequiresReaction = options.computedRequiresReaction, computedConfigurable = options.computedConfigurable, disableErrorBoundaries = options.disableErrorBoundaries, reactionScheduler = options.reactionScheduler;
+        if (options.isolateGlobalState === true) {
+            isolateGlobalState();
+        }
+        if (enforceActions !== undefined) {
+            if (typeof enforceActions === "boolean" || enforceActions === "strict")
+                deprecated("Deprecated value for 'enforceActions', use 'false' => '\"never\"', 'true' => '\"observed\"', '\"strict\"' => \"'always'\" instead");
+            var ea = void 0;
+            switch (enforceActions) {
+                case true:
+                case "observed":
+                    ea = true;
+                    break;
+                case false:
+                case "never":
+                    ea = false;
+                    break;
+                case "strict":
+                case "always":
+                    ea = "strict";
+                    break;
+                default:
+                    fail("Invalid value for 'enforceActions': '" + enforceActions + "', expected 'never', 'always' or 'observed'");
+            }
+            globalState.enforceActions = ea;
+            globalState.allowStateChanges = ea === true || ea === "strict" ? false : true;
+        }
+        if (computedRequiresReaction !== undefined) {
+            globalState.computedRequiresReaction = !!computedRequiresReaction;
+        }
+        if (computedConfigurable !== undefined) {
+            globalState.computedConfigurable = !!computedConfigurable;
+        }
+        if (disableErrorBoundaries !== undefined) {
+            if (disableErrorBoundaries === true)
+                console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.");
+            globalState.disableErrorBoundaries = !!disableErrorBoundaries;
+        }
+        if (reactionScheduler) {
+            setReactionScheduler(reactionScheduler);
+        }
+    }
+
+    function decorate(thing, decorators) {
+        process.env.NODE_ENV !== "production" &&
+            invariant(isPlainObject(decorators), "Decorators should be a key value map");
+        var target = typeof thing === "function" ? thing.prototype : thing;
+        var _loop_1 = function (prop) {
+            var propertyDecorators = decorators[prop];
+            if (!Array.isArray(propertyDecorators)) {
+                propertyDecorators = [propertyDecorators];
+            }
+            process.env.NODE_ENV !== "production" &&
+                invariant(propertyDecorators.every(function (decorator) { return typeof decorator === "function"; }), "Decorate: expected a decorator function or array of decorator functions for '" + prop + "'");
+            var descriptor = Object.getOwnPropertyDescriptor(target, prop);
+            var newDescriptor = propertyDecorators.reduce(function (accDescriptor, decorator) { return decorator(target, prop, accDescriptor); }, descriptor);
+            if (newDescriptor)
+                Object.defineProperty(target, prop, newDescriptor);
+        };
+        for (var prop in decorators) {
+            _loop_1(prop);
+        }
+        return thing;
+    }
+
+    function extendObservable(target, properties, decorators, options) {
+        if (process.env.NODE_ENV !== "production") {
+            invariant(arguments.length >= 2 && arguments.length <= 4, "'extendObservable' expected 2-4 arguments");
+            invariant(typeof target === "object", "'extendObservable' expects an object as first argument");
+            invariant(!isObservableMap(target), "'extendObservable' should not be used on maps, use map.merge instead");
+        }
+        options = asCreateObservableOptions(options);
+        var defaultDecorator = getDefaultDecoratorFromObjectOptions(options);
+        initializeInstance(target); // Fixes #1740
+        asObservableObject(target, options.name, defaultDecorator.enhancer); // make sure object is observable, even without initial props
+        if (properties)
+            extendObservableObjectWithProperties(target, properties, decorators, defaultDecorator);
+        return target;
+    }
+    function getDefaultDecoratorFromObjectOptions(options) {
+        return options.defaultDecorator || (options.deep === false ? refDecorator : deepDecorator);
+    }
+    function extendObservableObjectWithProperties(target, properties, decorators, defaultDecorator) {
+        var e_1, _a, e_2, _b;
+        if (process.env.NODE_ENV !== "production") {
+            invariant(!isObservable(properties), "Extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540");
+            if (decorators) {
+                var keys = getPlainObjectKeys(decorators);
+                try {
+                    for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
+                        var key = keys_1_1.value;
+                        if (!(key in properties))
+                            fail("Trying to declare a decorator for unspecified property '" + stringifyKey(key) + "'");
+                    }
+                }
+                catch (e_1_1) { e_1 = { error: e_1_1 }; }
+                finally {
+                    try {
+                        if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
+                    }
+                    finally { if (e_1) throw e_1.error; }
+                }
+            }
+        }
+        startBatch();
+        try {
+            var keys = getPlainObjectKeys(properties);
+            try {
+                for (var keys_2 = __values(keys), keys_2_1 = keys_2.next(); !keys_2_1.done; keys_2_1 = keys_2.next()) {
+                    var key = keys_2_1.value;
+                    var descriptor = Object.getOwnPropertyDescriptor(properties, key);
+                    if (process.env.NODE_ENV !== "production") {
+                        if (Object.getOwnPropertyDescriptor(target, key))
+                            fail("'extendObservable' can only be used to introduce new properties. Use 'set' or 'decorate' instead. The property '" + stringifyKey(key) + "' already exists on '" + target + "'");
+                        if (isComputed(descriptor.value))
+                            fail("Passing a 'computed' as initial property value is no longer supported by extendObservable. Use a getter or decorator instead");
+                    }
+                    var decorator = decorators && key in decorators
+                        ? decorators[key]
+                        : descriptor.get
+                            ? computedDecorator
+                            : defaultDecorator;
+                    if (process.env.NODE_ENV !== "production" && typeof decorator !== "function")
+                        fail("Not a valid decorator for '" + stringifyKey(key) + "', got: " + decorator);
+                    var resultDescriptor = decorator(target, key, descriptor, true);
+                    if (resultDescriptor // otherwise, assume already applied, due to `applyToInstance`
+                    )
+                        Object.defineProperty(target, key, resultDescriptor);
+                }
+            }
+            catch (e_2_1) { e_2 = { error: e_2_1 }; }
+            finally {
+                try {
+                    if (keys_2_1 && !keys_2_1.done && (_b = keys_2.return)) _b.call(keys_2);
+                }
+                finally { if (e_2) throw e_2.error; }
+            }
+        }
+        finally {
+            endBatch();
+        }
+    }
+
+    function getDependencyTree(thing, property) {
+        return nodeToDependencyTree(getAtom(thing, property));
+    }
+    function nodeToDependencyTree(node) {
+        var result = {
+            name: node.name
+        };
+        if (node.observing && node.observing.length > 0)
+            result.dependencies = unique(node.observing).map(nodeToDependencyTree);
+        return result;
+    }
+    function getObserverTree(thing, property) {
+        return nodeToObserverTree(getAtom(thing, property));
+    }
+    function nodeToObserverTree(node) {
+        var result = {
+            name: node.name
+        };
+        if (hasObservers(node))
+            result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);
+        return result;
+    }
+
+    var generatorId = 0;
+    function flow(generator) {
+        if (arguments.length !== 1)
+            fail(!!process.env.NODE_ENV && "Flow expects one 1 argument and cannot be used as decorator");
+        var name = generator.name || "";
+        // Implementation based on https://github.com/tj/co/blob/master/index.js
+        return function () {
+            var ctx = this;
+            var args = arguments;
+            var runId = ++generatorId;
+            var gen = action(name + " - runid: " + runId + " - init", generator).apply(ctx, args);
+            var rejector;
+            var pendingPromise = undefined;
+            var promise = new Promise(function (resolve, reject) {
+                var stepId = 0;
+                rejector = reject;
+                function onFulfilled(res) {
+                    pendingPromise = undefined;
+                    var ret;
+                    try {
+                        ret = action(name + " - runid: " + runId + " - yield " + stepId++, gen.next).call(gen, res);
+                    }
+                    catch (e) {
+                        return reject(e);
+                    }
+                    next(ret);
+                }
+                function onRejected(err) {
+                    pendingPromise = undefined;
+                    var ret;
+                    try {
+                        ret = action(name + " - runid: " + runId + " - yield " + stepId++, gen.throw).call(gen, err);
+                    }
+                    catch (e) {
+                        return reject(e);
+                    }
+                    next(ret);
+                }
+                function next(ret) {
+                    if (ret && typeof ret.then === "function") {
+                        // an async iterator
+                        ret.then(next, reject);
+                        return;
+                    }
+                    if (ret.done)
+                        return resolve(ret.value);
+                    pendingPromise = Promise.resolve(ret.value);
+                    return pendingPromise.then(onFulfilled, onRejected);
+                }
+                onFulfilled(undefined); // kick off the process
+            });
+            promise.cancel = action(name + " - runid: " + runId + " - cancel", function () {
+                try {
+                    if (pendingPromise)
+                        cancelPromise(pendingPromise);
+                    // Finally block can return (or yield) stuff..
+                    var res = gen.return();
+                    // eat anything that promise would do, it's cancelled!
+                    var yieldedPromise = Promise.resolve(res.value);
+                    yieldedPromise.then(noop, noop);
+                    cancelPromise(yieldedPromise); // maybe it can be cancelled :)
+                    // reject our original promise
+                    rejector(new Error("FLOW_CANCELLED"));
+                }
+                catch (e) {
+                    rejector(e); // there could be a throwing finally block
+                }
+            });
+            return promise;
+        };
+    }
+    function cancelPromise(promise) {
+        if (typeof promise.cancel === "function")
+            promise.cancel();
+    }
+
+    function interceptReads(thing, propOrHandler, handler) {
+        var target;
+        if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {
+            target = getAdministration(thing);
+        }
+        else if (isObservableObject(thing)) {
+            if (typeof propOrHandler !== "string")
+                return fail(process.env.NODE_ENV !== "production" &&
+                    "InterceptReads can only be used with a specific property, not with an object in general");
+            target = getAdministration(thing, propOrHandler);
+        }
+        else {
+            return fail(process.env.NODE_ENV !== "production" &&
+                "Expected observable map, object or array as first array");
+        }
+        if (target.dehancer !== undefined)
+            return fail(process.env.NODE_ENV !== "production" && "An intercept reader was already established");
+        target.dehancer = typeof propOrHandler === "function" ? propOrHandler : handler;
+        return function () {
+            target.dehancer = undefined;
+        };
+    }
+
+    function intercept(thing, propOrHandler, handler) {
+        if (typeof handler === "function")
+            return interceptProperty(thing, propOrHandler, handler);
+        else
+            return interceptInterceptable(thing, propOrHandler);
+    }
+    function interceptInterceptable(thing, handler) {
+        return getAdministration(thing).intercept(handler);
+    }
+    function interceptProperty(thing, property, handler) {
+        return getAdministration(thing, property).intercept(handler);
+    }
+
+    function _isComputed(value, property) {
+        if (value === null || value === undefined)
+            return false;
+        if (property !== undefined) {
+            if (isObservableObject(value) === false)
+                return false;
+            if (!value[$mobx].values.has(property))
+                return false;
+            var atom = getAtom(value, property);
+            return isComputedValue(atom);
+        }
+        return isComputedValue(value);
+    }
+    function isComputed(value) {
+        if (arguments.length > 1)
+            return fail(process.env.NODE_ENV !== "production" &&
+                "isComputed expects only 1 argument. Use isObservableProp to inspect the observability of a property");
+        return _isComputed(value);
+    }
+    function isComputedProp(value, propName) {
+        if (typeof propName !== "string")
+            return fail(process.env.NODE_ENV !== "production" &&
+                "isComputed expected a property name as second argument");
+        return _isComputed(value, propName);
+    }
+
+    function _isObservable(value, property) {
+        if (value === null || value === undefined)
+            return false;
+        if (property !== undefined) {
+            if (process.env.NODE_ENV !== "production" &&
+                (isObservableMap(value) || isObservableArray(value)))
+                return fail("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");
+            if (isObservableObject(value)) {
+                return value[$mobx].values.has(property);
+            }
+            return false;
+        }
+        // For first check, see #701
+        return (isObservableObject(value) ||
+            !!value[$mobx] ||
+            isAtom(value) ||
+            isReaction(value) ||
+            isComputedValue(value));
+    }
+    function isObservable(value) {
+        if (arguments.length !== 1)
+            fail(process.env.NODE_ENV !== "production" &&
+                "isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property");
+        return _isObservable(value);
+    }
+    function isObservableProp(value, propName) {
+        if (typeof propName !== "string")
+            return fail(process.env.NODE_ENV !== "production" && "expected a property name as second argument");
+        return _isObservable(value, propName);
+    }
+
+    function keys(obj) {
+        if (isObservableObject(obj)) {
+            return obj[$mobx].getKeys();
+        }
+        if (isObservableMap(obj)) {
+            return Array.from(obj.keys());
+        }
+        if (isObservableSet(obj)) {
+            return Array.from(obj.keys());
+        }
+        if (isObservableArray(obj)) {
+            return obj.map(function (_, index) { return index; });
+        }
+        return fail(process.env.NODE_ENV !== "production" &&
+            "'keys()' can only be used on observable objects, arrays, sets and maps");
+    }
+    function values(obj) {
+        if (isObservableObject(obj)) {
+            return keys(obj).map(function (key) { return obj[key]; });
+        }
+        if (isObservableMap(obj)) {
+            return keys(obj).map(function (key) { return obj.get(key); });
+        }
+        if (isObservableSet(obj)) {
+            return Array.from(obj.values());
+        }
+        if (isObservableArray(obj)) {
+            return obj.slice();
+        }
+        return fail(process.env.NODE_ENV !== "production" &&
+            "'values()' can only be used on observable objects, arrays, sets and maps");
+    }
+    function entries(obj) {
+        if (isObservableObject(obj)) {
+            return keys(obj).map(function (key) { return [key, obj[key]]; });
+        }
+        if (isObservableMap(obj)) {
+            return keys(obj).map(function (key) { return [key, obj.get(key)]; });
+        }
+        if (isObservableSet(obj)) {
+            return Array.from(obj.entries());
+        }
+        if (isObservableArray(obj)) {
+            return obj.map(function (key, index) { return [index, key]; });
+        }
+        return fail(process.env.NODE_ENV !== "production" &&
+            "'entries()' can only be used on observable objects, arrays and maps");
+    }
+    function set(obj, key, value) {
+        if (arguments.length === 2 && !isObservableSet(obj)) {
+            startBatch();
+            var values_1 = key;
+            try {
+                for (var key_1 in values_1)
+                    set(obj, key_1, values_1[key_1]);
+            }
+            finally {
+                endBatch();
+            }
+            return;
+        }
+        if (isObservableObject(obj)) {
+            var adm = obj[$mobx];
+            var existingObservable = adm.values.get(key);
+            if (existingObservable) {
+                adm.write(key, value);
+            }
+            else {
+                adm.addObservableProp(key, value, adm.defaultEnhancer);
+            }
+        }
+        else if (isObservableMap(obj)) {
+            obj.set(key, value);
+        }
+        else if (isObservableSet(obj)) {
+            obj.add(key);
+        }
+        else if (isObservableArray(obj)) {
+            if (typeof key !== "number")
+                key = parseInt(key, 10);
+            invariant(key >= 0, "Not a valid index: '" + key + "'");
+            startBatch();
+            if (key >= obj.length)
+                obj.length = key + 1;
+            obj[key] = value;
+            endBatch();
+        }
+        else {
+            return fail(process.env.NODE_ENV !== "production" &&
+                "'set()' can only be used on observable objects, arrays and maps");
+        }
+    }
+    function remove(obj, key) {
+        if (isObservableObject(obj)) {
+            obj[$mobx].remove(key);
+        }
+        else if (isObservableMap(obj)) {
+            obj.delete(key);
+        }
+        else if (isObservableSet(obj)) {
+            obj.delete(key);
+        }
+        else if (isObservableArray(obj)) {
+            if (typeof key !== "number")
+                key = parseInt(key, 10);
+            invariant(key >= 0, "Not a valid index: '" + key + "'");
+            obj.splice(key, 1);
+        }
+        else {
+            return fail(process.env.NODE_ENV !== "production" &&
+                "'remove()' can only be used on observable objects, arrays and maps");
+        }
+    }
+    function has(obj, key) {
+        if (isObservableObject(obj)) {
+            // return keys(obj).indexOf(key) >= 0
+            var adm = getAdministration(obj);
+            return adm.has(key);
+        }
+        else if (isObservableMap(obj)) {
+            return obj.has(key);
+        }
+        else if (isObservableSet(obj)) {
+            return obj.has(key);
+        }
+        else if (isObservableArray(obj)) {
+            return key >= 0 && key < obj.length;
+        }
+        else {
+            return fail(process.env.NODE_ENV !== "production" &&
+                "'has()' can only be used on observable objects, arrays and maps");
+        }
+    }
+    function get(obj, key) {
+        if (!has(obj, key))
+            return undefined;
+        if (isObservableObject(obj)) {
+            return obj[key];
+        }
+        else if (isObservableMap(obj)) {
+            return obj.get(key);
+        }
+        else if (isObservableArray(obj)) {
+            return obj[key];
+        }
+        else {
+            return fail(process.env.NODE_ENV !== "production" &&
+                "'get()' can only be used on observable objects, arrays and maps");
+        }
+    }
+
+    function observe(thing, propOrCb, cbOrFire, fireImmediately) {
+        if (typeof cbOrFire === "function")
+            return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);
+        else
+            return observeObservable(thing, propOrCb, cbOrFire);
+    }
+    function observeObservable(thing, listener, fireImmediately) {
+        return getAdministration(thing).observe(listener, fireImmediately);
+    }
+    function observeObservableProperty(thing, property, listener, fireImmediately) {
+        return getAdministration(thing, property).observe(listener, fireImmediately);
+    }
+
+    var defaultOptions = {
+        detectCycles: true,
+        exportMapsAsObjects: true,
+        recurseEverything: false
+    };
+    function cache(map, key, value, options) {
+        if (options.detectCycles)
+            map.set(key, value);
+        return value;
+    }
+    function toJSHelper(source, options, __alreadySeen) {
+        if (!options.recurseEverything && !isObservable(source))
+            return source;
+        if (typeof source !== "object")
+            return source;
+        // Directly return null if source is null
+        if (source === null)
+            return null;
+        // Directly return the Date object itself if contained in the observable
+        if (source instanceof Date)
+            return source;
+        if (isObservableValue(source))
+            return toJSHelper(source.get(), options, __alreadySeen);
+        // make sure we track the keys of the object
+        if (isObservable(source))
+            keys(source);
+        var detectCycles = options.detectCycles === true;
+        if (detectCycles && source !== null && __alreadySeen.has(source)) {
+            return __alreadySeen.get(source);
+        }
+        if (isObservableArray(source) || Array.isArray(source)) {
+            var res_1 = cache(__alreadySeen, source, [], options);
+            var toAdd = source.map(function (value) { return toJSHelper(value, options, __alreadySeen); });
+            res_1.length = toAdd.length;
+            for (var i = 0, l = toAdd.length; i < l; i++)
+                res_1[i] = toAdd[i];
+            return res_1;
+        }
+        if (isObservableSet(source) || Object.getPrototypeOf(source) === Set.prototype) {
+            if (options.exportMapsAsObjects === false) {
+                var res_2 = cache(__alreadySeen, source, new Set(), options);
+                source.forEach(function (value) {
+                    res_2.add(toJSHelper(value, options, __alreadySeen));
+                });
+                return res_2;
+            }
+            else {
+                var res_3 = cache(__alreadySeen, source, [], options);
+                source.forEach(function (value) {
+                    res_3.push(toJSHelper(value, options, __alreadySeen));
+                });
+                return res_3;
+            }
+        }
+        if (isObservableMap(source) || Object.getPrototypeOf(source) === Map.prototype) {
+            if (options.exportMapsAsObjects === false) {
+                var res_4 = cache(__alreadySeen, source, new Map(), options);
+                source.forEach(function (value, key) {
+                    res_4.set(key, toJSHelper(value, options, __alreadySeen));
+                });
+                return res_4;
+            }
+            else {
+                var res_5 = cache(__alreadySeen, source, {}, options);
+                source.forEach(function (value, key) {
+                    res_5[key] = toJSHelper(value, options, __alreadySeen);
+                });
+                return res_5;
+            }
+        }
+        // Fallback to the situation that source is an ObservableObject or a plain object
+        var res = cache(__alreadySeen, source, {}, options);
+        getPlainObjectKeys(source).forEach(function (key) {
+            res[key] = toJSHelper(source[key], options, __alreadySeen);
+        });
+        return res;
+    }
+    function toJS(source, options) {
+        // backward compatibility
+        if (typeof options === "boolean")
+            options = { detectCycles: options };
+        if (!options)
+            options = defaultOptions;
+        options.detectCycles =
+            options.detectCycles === undefined
+                ? options.recurseEverything === true
+                : options.detectCycles === true;
+        var __alreadySeen;
+        if (options.detectCycles)
+            __alreadySeen = new Map();
+        return toJSHelper(source, options, __alreadySeen);
+    }
+
+    function trace() {
+        var args = [];
+        for (var _i = 0; _i < arguments.length; _i++) {
+            args[_i] = arguments[_i];
+        }
+        var enterBreakPoint = false;
+        if (typeof args[args.length - 1] === "boolean")
+            enterBreakPoint = args.pop();
+        var derivation = getAtomFromArgs(args);
+        if (!derivation) {
+            return fail(process.env.NODE_ENV !== "production" &&
+                "'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");
+        }
+        if (derivation.isTracing === TraceMode.NONE) {
+            console.log("[mobx.trace] '" + derivation.name + "' tracing enabled");
+        }
+        derivation.isTracing = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG;
+    }
+    function getAtomFromArgs(args) {
+        switch (args.length) {
+            case 0:
+                return globalState.trackingDerivation;
+            case 1:
+                return getAtom(args[0]);
+            case 2:
+                return getAtom(args[0], args[1]);
+        }
+    }
+
+    /**
+     * During a transaction no views are updated until the end of the transaction.
+     * The transaction will be run synchronously nonetheless.
+     *
+     * @param action a function that updates some reactive state
+     * @returns any value that was returned by the 'action' parameter.
+     */
+    function transaction(action, thisArg) {
+        if (thisArg === void 0) { thisArg = undefined; }
+        startBatch();
+        try {
+            return action.apply(thisArg);
+        }
+        finally {
+            endBatch();
+        }
+    }
+
+    function when(predicate, arg1, arg2) {
+        if (arguments.length === 1 || (arg1 && typeof arg1 === "object"))
+            return whenPromise(predicate, arg1);
+        return _when(predicate, arg1, arg2 || {});
+    }
+    function _when(predicate, effect, opts) {
+        var timeoutHandle;
+        if (typeof opts.timeout === "number") {
+            timeoutHandle = setTimeout(function () {
+                if (!disposer[$mobx].isDisposed) {
+                    disposer();
+                    var error = new Error("WHEN_TIMEOUT");
+                    if (opts.onError)
+                        opts.onError(error);
+                    else
+                        throw error;
+                }
+            }, opts.timeout);
+        }
+        opts.name = opts.name || "When@" + getNextId();
+        var effectAction = createAction(opts.name + "-effect", effect);
+        var disposer = autorun(function (r) {
+            if (predicate()) {
+                r.dispose();
+                if (timeoutHandle)
+                    clearTimeout(timeoutHandle);
+                effectAction();
+            }
+        }, opts);
+        return disposer;
+    }
+    function whenPromise(predicate, opts) {
+        if (process.env.NODE_ENV !== "production" && opts && opts.onError)
+            return fail("the options 'onError' and 'promise' cannot be combined");
+        var cancel;
+        var res = new Promise(function (resolve, reject) {
+            var disposer = _when(predicate, resolve, __assign({}, opts, { onError: reject }));
+            cancel = function () {
+                disposer();
+                reject("WHEN_CANCELLED");
+            };
+        });
+        res.cancel = cancel;
+        return res;
+    }
+
+    function getAdm(target) {
+        return target[$mobx];
+    }
+    function isPropertyKey(val) {
+        return typeof val === "string" || typeof val === "number" || typeof val === "symbol";
+    }
+    // Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,
+    // and skip either the internal values map, or the base object with its property descriptors!
+    var objectProxyTraps = {
+        has: function (target, name) {
+            if (name === $mobx || name === "constructor" || name === mobxDidRunLazyInitializersSymbol)
+                return true;
+            var adm = getAdm(target);
+            // MWE: should `in` operator be reactive? If not, below code path will be faster / more memory efficient
+            // TODO: check performance stats!
+            // if (adm.values.get(name as string)) return true
+            if (isPropertyKey(name))
+                return adm.has(name);
+            return name in target;
+        },
+        get: function (target, name) {
+            if (name === $mobx || name === "constructor" || name === mobxDidRunLazyInitializersSymbol)
+                return target[name];
+            var adm = getAdm(target);
+            var observable = adm.values.get(name);
+            if (observable instanceof Atom) {
+                var result = observable.get();
+                if (result === undefined) {
+                    // This fixes #1796, because deleting a prop that has an
+                    // undefined value won't retrigger a observer (no visible effect),
+                    // the autorun wouldn't subscribe to future key changes (see also next comment)
+                    adm.has(name);
+                }
+                return result;
+            }
+            // make sure we start listening to future keys
+            // note that we only do this here for optimization
+            if (isPropertyKey(name))
+                adm.has(name);
+            return target[name];
+        },
+        set: function (target, name, value) {
+            if (!isPropertyKey(name))
+                return false;
+            set(target, name, value);
+            return true;
+        },
+        deleteProperty: function (target, name) {
+            if (!isPropertyKey(name))
+                return false;
+            var adm = getAdm(target);
+            adm.remove(name);
+            return true;
+        },
+        ownKeys: function (target) {
+            var adm = getAdm(target);
+            adm.keysAtom.reportObserved();
+            return Reflect.ownKeys(target);
+        },
+        preventExtensions: function (target) {
+            fail("Dynamic observable objects cannot be frozen");
+            return false;
+        }
+    };
+    function createDynamicObservableObject(base) {
+        var proxy = new Proxy(base, objectProxyTraps);
+        base[$mobx].proxy = proxy;
+        return proxy;
+    }
+
+    function hasInterceptors(interceptable) {
+        return interceptable.interceptors !== undefined && interceptable.interceptors.length > 0;
+    }
+    function registerInterceptor(interceptable, handler) {
+        var interceptors = interceptable.interceptors || (interceptable.interceptors = []);
+        interceptors.push(handler);
+        return once(function () {
+            var idx = interceptors.indexOf(handler);
+            if (idx !== -1)
+                interceptors.splice(idx, 1);
+        });
+    }
+    function interceptChange(interceptable, change) {
+        var prevU = untrackedStart();
+        try {
+            var interceptors = interceptable.interceptors;
+            if (interceptors)
+                for (var i = 0, l = interceptors.length; i < l; i++) {
+                    change = interceptors[i](change);
+                    invariant(!change || change.type, "Intercept handlers should return nothing or a change object");
+                    if (!change)
+                        break;
+                }
+            return change;
+        }
+        finally {
+            untrackedEnd(prevU);
+        }
+    }
+
+    function hasListeners(listenable) {
+        return listenable.changeListeners !== undefined && listenable.changeListeners.length > 0;
+    }
+    function registerListener(listenable, handler) {
+        var listeners = listenable.changeListeners || (listenable.changeListeners = []);
+        listeners.push(handler);
+        return once(function () {
+            var idx = listeners.indexOf(handler);
+            if (idx !== -1)
+                listeners.splice(idx, 1);
+        });
+    }
+    function notifyListeners(listenable, change) {
+        var prevU = untrackedStart();
+        var listeners = listenable.changeListeners;
+        if (!listeners)
+            return;
+        listeners = listeners.slice();
+        for (var i = 0, l = listeners.length; i < l; i++) {
+            listeners[i](change);
+        }
+        untrackedEnd(prevU);
+    }
+
+    var MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859
+    var arrayTraps = {
+        get: function (target, name) {
+            if (name === $mobx)
+                return target[$mobx];
+            if (name === "length")
+                return target[$mobx].getArrayLength();
+            if (typeof name === "number") {
+                return arrayExtensions.get.call(target, name);
+            }
+            if (typeof name === "string" && !isNaN(name)) {
+                return arrayExtensions.get.call(target, parseInt(name));
+            }
+            if (arrayExtensions.hasOwnProperty(name)) {
+                return arrayExtensions[name];
+            }
+            return target[name];
+        },
+        set: function (target, name, value) {
+            if (name === "length") {
+                target[$mobx].setArrayLength(value);
+            }
+            if (typeof name === "number") {
+                arrayExtensions.set.call(target, name, value);
+            }
+            if (typeof name === "symbol" || isNaN(name)) {
+                target[name] = value;
+            }
+            else {
+                // numeric string
+                arrayExtensions.set.call(target, parseInt(name), value);
+            }
+            return true;
+        },
+        preventExtensions: function (target) {
+            fail("Observable arrays cannot be frozen");
+            return false;
+        }
+    };
+    function createObservableArray(initialValues, enhancer, name, owned) {
+        if (name === void 0) { name = "ObservableArray@" + getNextId(); }
+        if (owned === void 0) { owned = false; }
+        var adm = new ObservableArrayAdministration(name, enhancer, owned);
+        addHiddenFinalProp(adm.values, $mobx, adm);
+        var proxy = new Proxy(adm.values, arrayTraps);
+        adm.proxy = proxy;
+        if (initialValues && initialValues.length) {
+            var prev = allowStateChangesStart(true);
+            adm.spliceWithArray(0, 0, initialValues);
+            allowStateChangesEnd(prev);
+        }
+        return proxy;
+    }
+    var ObservableArrayAdministration = /** @class */ (function () {
+        function ObservableArrayAdministration(name, enhancer, owned) {
+            this.owned = owned;
+            this.values = [];
+            this.proxy = undefined;
+            this.lastKnownLength = 0;
+            this.atom = new Atom(name || "ObservableArray@" + getNextId());
+            this.enhancer = function (newV, oldV) { return enhancer(newV, oldV, name + "[..]"); };
+        }
+        ObservableArrayAdministration.prototype.dehanceValue = function (value) {
+            if (this.dehancer !== undefined)
+                return this.dehancer(value);
+            return value;
+        };
+        ObservableArrayAdministration.prototype.dehanceValues = function (values) {
+            if (this.dehancer !== undefined && values.length > 0)
+                return values.map(this.dehancer);
+            return values;
+        };
+        ObservableArrayAdministration.prototype.intercept = function (handler) {
+            return registerInterceptor(this, handler);
+        };
+        ObservableArrayAdministration.prototype.observe = function (listener, fireImmediately) {
+            if (fireImmediately === void 0) { fireImmediately = false; }
+            if (fireImmediately) {
+                listener({
+                    object: this.proxy,
+                    type: "splice",
+                    index: 0,
+                    added: this.values.slice(),
+                    addedCount: this.values.length,
+                    removed: [],
+                    removedCount: 0
+                });
+            }
+            return registerListener(this, listener);
+        };
+        ObservableArrayAdministration.prototype.getArrayLength = function () {
+            this.atom.reportObserved();
+            return this.values.length;
+        };
+        ObservableArrayAdministration.prototype.setArrayLength = function (newLength) {
+            if (typeof newLength !== "number" || newLength < 0)
+                throw new Error("[mobx.array] Out of range: " + newLength);
+            var currentLength = this.values.length;
+            if (newLength === currentLength)
+                return;
+            else if (newLength > currentLength) {
+                var newItems = new Array(newLength - currentLength);
+                for (var i = 0; i < newLength - currentLength; i++)
+                    newItems[i] = undefined; // No Array.fill everywhere...
+                this.spliceWithArray(currentLength, 0, newItems);
+            }
+            else
+                this.spliceWithArray(newLength, currentLength - newLength);
+        };
+        ObservableArrayAdministration.prototype.updateArrayLength = function (oldLength, delta) {
+            if (oldLength !== this.lastKnownLength)
+                throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed.");
+            this.lastKnownLength += delta;
+        };
+        ObservableArrayAdministration.prototype.spliceWithArray = function (index, deleteCount, newItems) {
+            var _this = this;
+            checkIfStateModificationsAreAllowed(this.atom);
+            var length = this.values.length;
+            if (index === undefined)
+                index = 0;
+            else if (index > length)
+                index = length;
+            else if (index < 0)
+                index = Math.max(0, length + index);
+            if (arguments.length === 1)
+                deleteCount = length - index;
+            else if (deleteCount === undefined || deleteCount === null)
+                deleteCount = 0;
+            else
+                deleteCount = Math.max(0, Math.min(deleteCount, length - index));
+            if (newItems === undefined)
+                newItems = EMPTY_ARRAY;
+            if (hasInterceptors(this)) {
+                var change = interceptChange(this, {
+                    object: this.proxy,
+                    type: "splice",
+                    index: index,
+                    removedCount: deleteCount,
+                    added: newItems
+                });
+                if (!change)
+                    return EMPTY_ARRAY;
+                deleteCount = change.removedCount;
+                newItems = change.added;
+            }
+            newItems = newItems.length === 0 ? newItems : newItems.map(function (v) { return _this.enhancer(v, undefined); });
+            if (process.env.NODE_ENV !== "production") {
+                var lengthDelta = newItems.length - deleteCount;
+                this.updateArrayLength(length, lengthDelta); // checks if internal array wasn't modified
+            }
+            var res = this.spliceItemsIntoValues(index, deleteCount, newItems);
+            if (deleteCount !== 0 || newItems.length !== 0)
+                this.notifyArraySplice(index, newItems, res);
+            return this.dehanceValues(res);
+        };
+        ObservableArrayAdministration.prototype.spliceItemsIntoValues = function (index, deleteCount, newItems) {
+            var _a;
+            if (newItems.length < MAX_SPLICE_SIZE) {
+                return (_a = this.values).splice.apply(_a, __spread([index, deleteCount], newItems));
+            }
+            else {
+                var res = this.values.slice(index, index + deleteCount);
+                this.values = this.values
+                    .slice(0, index)
+                    .concat(newItems, this.values.slice(index + deleteCount));
+                return res;
+            }
+        };
+        ObservableArrayAdministration.prototype.notifyArrayChildUpdate = function (index, newValue, oldValue) {
+            var notifySpy = !this.owned && isSpyEnabled();
+            var notify = hasListeners(this);
+            var change = notify || notifySpy
+                ? {
+                    object: this.proxy,
+                    type: "update",
+                    index: index,
+                    newValue: newValue,
+                    oldValue: oldValue
+                }
+                : null;
+            // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't
+            // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled
+            if (notifySpy && process.env.NODE_ENV !== "production")
+                spyReportStart(__assign({}, change, { name: this.atom.name }));
+            this.atom.reportChanged();
+            if (notify)
+                notifyListeners(this, change);
+            if (notifySpy && process.env.NODE_ENV !== "production")
+                spyReportEnd();
+        };
+        ObservableArrayAdministration.prototype.notifyArraySplice = function (index, added, removed) {
+            var notifySpy = !this.owned && isSpyEnabled();
+            var notify = hasListeners(this);
+            var change = notify || notifySpy
+                ? {
+                    object: this.proxy,
+                    type: "splice",
+                    index: index,
+                    removed: removed,
+                    added: added,
+                    removedCount: removed.length,
+                    addedCount: added.length
+                }
+                : null;
+            if (notifySpy && process.env.NODE_ENV !== "production")
+                spyReportStart(__assign({}, change, { name: this.atom.name }));
+            this.atom.reportChanged();
+            // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe
+            if (notify)
+                notifyListeners(this, change);
+            if (notifySpy && process.env.NODE_ENV !== "production")
+                spyReportEnd();
+        };
+        return ObservableArrayAdministration;
+    }());
+    var arrayExtensions = {
+        intercept: function (handler) {
+            return this[$mobx].intercept(handler);
+        },
+        observe: function (listener, fireImmediately) {
+            if (fireImmediately === void 0) { fireImmediately = false; }
+            var adm = this[$mobx];
+            return adm.observe(listener, fireImmediately);
+        },
+        clear: function () {
+            return this.splice(0);
+        },
+        replace: function (newItems) {
+            var adm = this[$mobx];
+            return adm.spliceWithArray(0, adm.values.length, newItems);
+        },
+        /**
+         * Converts this array back to a (shallow) javascript structure.
+         * For a deep clone use mobx.toJS
+         */
+        toJS: function () {
+            return this.slice();
+        },
+        toJSON: function () {
+            // Used by JSON.stringify
+            return this.toJS();
+        },
+        /*
+         * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)
+         * since these functions alter the inner structure of the array, the have side effects.
+         * Because the have side effects, they should not be used in computed function,
+         * and for that reason the do not call dependencyState.notifyObserved
+         */
+        splice: function (index, deleteCount) {
+            var newItems = [];
+            for (var _i = 2; _i < arguments.length; _i++) {
+                newItems[_i - 2] = arguments[_i];
+            }
+            var adm = this[$mobx];
+            switch (arguments.length) {
+                case 0:
+                    return [];
+                case 1:
+                    return adm.spliceWithArray(index);
+                case 2:
+                    return adm.spliceWithArray(index, deleteCount);
+            }
+            return adm.spliceWithArray(index, deleteCount, newItems);
+        },
+        spliceWithArray: function (index, deleteCount, newItems) {
+            var adm = this[$mobx];
+            return adm.spliceWithArray(index, deleteCount, newItems);
+        },
+        push: function () {
+            var items = [];
+            for (var _i = 0; _i < arguments.length; _i++) {
+                items[_i] = arguments[_i];
+            }
+            var adm = this[$mobx];
+            adm.spliceWithArray(adm.values.length, 0, items);
+            return adm.values.length;
+        },
+        pop: function () {
+            return this.splice(Math.max(this[$mobx].values.length - 1, 0), 1)[0];
+        },
+        shift: function () {
+            return this.splice(0, 1)[0];
+        },
+        unshift: function () {
+            var items = [];
+            for (var _i = 0; _i < arguments.length; _i++) {
+                items[_i] = arguments[_i];
+            }
+            var adm = this[$mobx];
+            adm.spliceWithArray(0, 0, items);
+            return adm.values.length;
+        },
+        reverse: function () {
+            // reverse by default mutates in place before returning the result
+            // which makes it both a 'derivation' and a 'mutation'.
+            // so we deviate from the default and just make it an dervitation
+            if (process.env.NODE_ENV !== "production") {
+                console.warn("[mobx] `observableArray.reverse()` will not update the array in place. Use `observableArray.slice().reverse()` to supress this warning and perform the operation on a copy, or `observableArray.replace(observableArray.slice().reverse())` to reverse & update in place");
+            }
+            var clone = this.slice();
+            return clone.reverse.apply(clone, arguments);
+        },
+        sort: function (compareFn) {
+            // sort by default mutates in place before returning the result
+            // which goes against all good practices. Let's not change the array in place!
+            if (process.env.NODE_ENV !== "production") {
+                console.warn("[mobx] `observableArray.sort()` will not update the array in place. Use `observableArray.slice().sort()` to supress this warning and perform the operation on a copy, or `observableArray.replace(observableArray.slice().sort())` to sort & update in place");
+            }
+            var clone = this.slice();
+            return clone.sort.apply(clone, arguments);
+        },
+        remove: function (value) {
+            var adm = this[$mobx];
+            var idx = adm.dehanceValues(adm.values).indexOf(value);
+            if (idx > -1) {
+                this.splice(idx, 1);
+                return true;
+            }
+            return false;
+        },
+        get: function (index) {
+            var adm = this[$mobx];
+            if (adm) {
+                if (index < adm.values.length) {
+                    adm.atom.reportObserved();
+                    return adm.dehanceValue(adm.values[index]);
+                }
+                console.warn("[mobx.array] Attempt to read an array index (" + index + ") that is out of bounds (" + adm.values.length + "). Please check length first. Out of bound indices will not be tracked by MobX");
+            }
+            return undefined;
+        },
+        set: function (index, newValue) {
+            var adm = this[$mobx];
+            var values = adm.values;
+            if (index < values.length) {
+                // update at index in range
+                checkIfStateModificationsAreAllowed(adm.atom);
+                var oldValue = values[index];
+                if (hasInterceptors(adm)) {
+                    var change = interceptChange(adm, {
+                        type: "update",
+                        object: adm.proxy,
+                        index: index,
+                        newValue: newValue
+                    });
+                    if (!change)
+                        return;
+                    newValue = change.newValue;
+                }
+                newValue = adm.enhancer(newValue, oldValue);
+                var changed = newValue !== oldValue;
+                if (changed) {
+                    values[index] = newValue;
+                    adm.notifyArrayChildUpdate(index, newValue, oldValue);
+                }
+            }
+            else if (index === values.length) {
+                // add a new item
+                adm.spliceWithArray(index, 0, [newValue]);
+            }
+            else {
+                // out of bounds
+                throw new Error("[mobx.array] Index out of bounds, " + index + " is larger than " + values.length);
+            }
+        }
+    };
+    [
+        "concat",
+        "every",
+        "filter",
+        "forEach",
+        "indexOf",
+        "join",
+        "lastIndexOf",
+        "map",
+        "reduce",
+        "reduceRight",
+        "slice",
+        "some",
+        "toString",
+        "toLocaleString"
+    ].forEach(function (funcName) {
+        arrayExtensions[funcName] = function () {
+            var adm = this[$mobx];
+            adm.atom.reportObserved();
+            var res = adm.dehanceValues(adm.values);
+            return res[funcName].apply(res, arguments);
+        };
+    });
+    var isObservableArrayAdministration = createInstanceofPredicate("ObservableArrayAdministration", ObservableArrayAdministration);
+    function isObservableArray(thing) {
+        return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);
+    }
+
+    var _a;
+    var ObservableMapMarker = {};
+    // just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54
+    // But: https://github.com/mobxjs/mobx/issues/1556
+    var ObservableMap = /** @class */ (function () {
+        function ObservableMap(initialData, enhancer, name) {
+            if (enhancer === void 0) { enhancer = deepEnhancer; }
+            if (name === void 0) { name = "ObservableMap@" + getNextId(); }
+            this.enhancer = enhancer;
+            this.name = name;
+            this[_a] = ObservableMapMarker;
+            this._keysAtom = createAtom(this.name + ".keys()");
+            this[Symbol.toStringTag] = "Map";
+            if (typeof Map !== "function") {
+                throw new Error("mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js");
+            }
+            this._data = new Map();
+            this._hasMap = new Map();
+            this.merge(initialData);
+        }
+        ObservableMap.prototype._has = function (key) {
+            return this._data.has(key);
+        };
+        ObservableMap.prototype.has = function (key) {
+            var _this = this;
+            if (!globalState.trackingDerivation)
+                return this._has(key);
+            var entry = this._hasMap.get(key);
+            if (!entry) {
+                // todo: replace with atom (breaking change)
+                var newEntry = (entry = new ObservableValue(this._has(key), referenceEnhancer, this.name + "." + stringifyKey(key) + "?", false));
+                this._hasMap.set(key, newEntry);
+                onBecomeUnobserved(newEntry, function () { return _this._hasMap.delete(key); });
+            }
+            return entry.get();
+        };
+        ObservableMap.prototype.set = function (key, value) {
+            var hasKey = this._has(key);
+            if (hasInterceptors(this)) {
+                var change = interceptChange(this, {
+                    type: hasKey ? "update" : "add",
+                    object: this,
+                    newValue: value,
+                    name: key
+                });
+                if (!change)
+                    return this;
+                value = change.newValue;
+            }
+            if (hasKey) {
+                this._updateValue(key, value);
+            }
+            else {
+                this._addValue(key, value);
+            }
+            return this;
+        };
+        ObservableMap.prototype.delete = function (key) {
+            var _this = this;
+            if (hasInterceptors(this)) {
+                var change = interceptChange(this, {
+                    type: "delete",
+                    object: this,
+                    name: key
+                });
+                if (!change)
+                    return false;
+            }
+            if (this._has(key)) {
+                var notifySpy = isSpyEnabled();
+                var notify = hasListeners(this);
+                var change = notify || notifySpy
+                    ? {
+                        type: "delete",
+                        object: this,
+                        oldValue: this._data.get(key).value,
+                        name: key
+                    }
+                    : null;
+                if (notifySpy && process.env.NODE_ENV !== "production")
+                    spyReportStart(__assign({}, change, { name: this.name, key: key }));
+                transaction(function () {
+                    _this._keysAtom.reportChanged();
+                    _this._updateHasMapEntry(key, false);
+                    var observable = _this._data.get(key);
+                    observable.setNewValue(undefined);
+                    _this._data.delete(key);
+                });
+                if (notify)
+                    notifyListeners(this, change);
+                if (notifySpy && process.env.NODE_ENV !== "production")
+                    spyReportEnd();
+                return true;
+            }
+            return false;
+        };
+        ObservableMap.prototype._updateHasMapEntry = function (key, value) {
+            var entry = this._hasMap.get(key);
+            if (entry) {
+                entry.setNewValue(value);
+            }
+        };
+        ObservableMap.prototype._updateValue = function (key, newValue) {
+            var observable = this._data.get(key);
+            newValue = observable.prepareNewValue(newValue);
+            if (newValue !== globalState.UNCHANGED) {
+                var notifySpy = isSpyEnabled();
+                var notify = hasListeners(this);
+                var change = notify || notifySpy
+                    ? {
+                        type: "update",
+                        object: this,
+                        oldValue: observable.value,
+                        name: key,
+                        newValue: newValue
+                    }
+                    : null;
+                if (notifySpy && process.env.NODE_ENV !== "production")
+                    spyReportStart(__assign({}, change, { name: this.name, key: key }));
+                observable.setNewValue(newValue);
+                if (notify)
+                    notifyListeners(this, change);
+                if (notifySpy && process.env.NODE_ENV !== "production")
+                    spyReportEnd();
+            }
+        };
+        ObservableMap.prototype._addValue = function (key, newValue) {
+            var _this = this;
+            checkIfStateModificationsAreAllowed(this._keysAtom);
+            transaction(function () {
+                var observable = new ObservableValue(newValue, _this.enhancer, _this.name + "." + stringifyKey(key), false);
+                _this._data.set(key, observable);
+                newValue = observable.value; // value might have been changed
+                _this._updateHasMapEntry(key, true);
+                _this._keysAtom.reportChanged();
+            });
+            var notifySpy = isSpyEnabled();
+            var notify = hasListeners(this);
+            var change = notify || notifySpy
+                ? {
+                    type: "add",
+                    object: this,
+                    name: key,
+                    newValue: newValue
+                }
+                : null;
+            if (notifySpy && process.env.NODE_ENV !== "production")
+                spyReportStart(__assign({}, change, { name: this.name, key: key }));
+            if (notify)
+                notifyListeners(this, change);
+            if (notifySpy && process.env.NODE_ENV !== "production")
+                spyReportEnd();
+        };
+        ObservableMap.prototype.get = function (key) {
+            if (this.has(key))
+                return this.dehanceValue(this._data.get(key).get());
+            return this.dehanceValue(undefined);
+        };
+        ObservableMap.prototype.dehanceValue = function (value) {
+            if (this.dehancer !== undefined) {
+                return this.dehancer(value);
+            }
+            return value;
+        };
+        ObservableMap.prototype.keys = function () {
+            this._keysAtom.reportObserved();
+            return this._data.keys();
+        };
+        ObservableMap.prototype.values = function () {
+            var self = this;
+            var nextIndex = 0;
+            var keys = Array.from(this.keys());
+            return makeIterable({
+                next: function () {
+                    return nextIndex < keys.length
+                        ? { value: self.get(keys[nextIndex++]), done: false }
+                        : { done: true };
+                }
+            });
+        };
+        ObservableMap.prototype.entries = function () {
+            var self = this;
+            var nextIndex = 0;
+            var keys = Array.from(this.keys());
+            return makeIterable({
+                next: function () {
+                    if (nextIndex < keys.length) {
+                        var key = keys[nextIndex++];
+                        return {
+                            value: [key, self.get(key)],
+                            done: false
+                        };
+                    }
+                    return { done: true };
+                }
+            });
+        };
+        ObservableMap.prototype[(_a = $mobx, Symbol.iterator)] = function () {
+            return this.entries();
+        };
+        ObservableMap.prototype.forEach = function (callback, thisArg) {
+            var e_1, _a;
+            try {
+                for (var _b = __values(this), _c = _b.next(); !_c.done; _c = _b.next()) {
+                    var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
+                    callback.call(thisArg, value, key, this);
+                }
+            }
+            catch (e_1_1) { e_1 = { error: e_1_1 }; }
+            finally {
+                try {
+                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
+                }
+                finally { if (e_1) throw e_1.error; }
+            }
+        };
+        /** Merge another object into this object, returns this. */
+        ObservableMap.prototype.merge = function (other) {
+            var _this = this;
+            if (isObservableMap(other)) {
+                other = other.toJS();
+            }
+            transaction(function () {
+                if (isPlainObject(other))
+                    getPlainObjectKeys(other).forEach(function (key) { return _this.set(key, other[key]); });
+                else if (Array.isArray(other))
+                    other.forEach(function (_a) {
+                        var _b = __read(_a, 2), key = _b[0], value = _b[1];
+                        return _this.set(key, value);
+                    });
+                else if (isES6Map(other)) {
+                    if (other.constructor !== Map)
+                        fail("Cannot initialize from classes that inherit from Map: " + other.constructor.name); // prettier-ignore
+                    other.forEach(function (value, key) { return _this.set(key, value); });
+                }
+                else if (other !== null && other !== undefined)
+                    fail("Cannot initialize map from " + other);
+            });
+            return this;
+        };
+        ObservableMap.prototype.clear = function () {
+            var _this = this;
+            transaction(function () {
+                untracked(function () {
+                    var e_2, _a;
+                    try {
+                        for (var _b = __values(_this.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
+                            var key = _c.value;
+                            _this.delete(key);
+                        }
+                    }
+                    catch (e_2_1) { e_2 = { error: e_2_1 }; }
+                    finally {
+                        try {
+                            if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
+                        }
+                        finally { if (e_2) throw e_2.error; }
+                    }
+                });
+            });
+        };
+        ObservableMap.prototype.replace = function (values) {
+            var _this = this;
+            transaction(function () {
+                // grab all the keys that are present in the new map but not present in the current map
+                // and delete them from the map, then merge the new map
+                // this will cause reactions only on changed values
+                var newKeys = getMapLikeKeys(values);
+                var oldKeys = Array.from(_this.keys());
+                var missingKeys = oldKeys.filter(function (k) { return newKeys.indexOf(k) === -1; });
+                missingKeys.forEach(function (k) { return _this.delete(k); });
+                _this.merge(values);
+            });
+            return this;
+        };
+        Object.defineProperty(ObservableMap.prototype, "size", {
+            get: function () {
+                this._keysAtom.reportObserved();
+                return this._data.size;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        /**
+         * Returns a plain object that represents this map.
+         * Note that all the keys being stringified.
+         * If there are duplicating keys after converting them to strings, behaviour is undetermined.
+         */
+        ObservableMap.prototype.toPOJO = function () {
+            var e_3, _a;
+            var res = {};
+            try {
+                for (var _b = __values(this), _c = _b.next(); !_c.done; _c = _b.next()) {
+                    var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
+                    // We lie about symbol key types due to https://github.com/Microsoft/TypeScript/issues/1863
+                    res[typeof key === "symbol" ? key : stringifyKey(key)] = value;
+                }
+            }
+            catch (e_3_1) { e_3 = { error: e_3_1 }; }
+            finally {
+                try {
+                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
+                }
+                finally { if (e_3) throw e_3.error; }
+            }
+            return res;
+        };
+        /**
+         * Returns a shallow non observable object clone of this map.
+         * Note that the values migth still be observable. For a deep clone use mobx.toJS.
+         */
+        ObservableMap.prototype.toJS = function () {
+            return new Map(this);
+        };
+        ObservableMap.prototype.toJSON = function () {
+            // Used by JSON.stringify
+            return this.toPOJO();
+        };
+        ObservableMap.prototype.toString = function () {
+            var _this = this;
+            return (this.name +
+                "[{ " +
+                Array.from(this.keys())
+                    .map(function (key) { return stringifyKey(key) + ": " + ("" + _this.get(key)); })
+                    .join(", ") +
+                " }]");
+        };
+        /**
+         * Observes this object. Triggers for the events 'add', 'update' and 'delete'.
+         * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
+         * for callback details
+         */
+        ObservableMap.prototype.observe = function (listener, fireImmediately) {
+            process.env.NODE_ENV !== "production" &&
+                invariant(fireImmediately !== true, "`observe` doesn't support fireImmediately=true in combination with maps.");
+            return registerListener(this, listener);
+        };
+        ObservableMap.prototype.intercept = function (handler) {
+            return registerInterceptor(this, handler);
+        };
+        return ObservableMap;
+    }());
+    /* 'var' fixes small-build issue */
+    var isObservableMap = createInstanceofPredicate("ObservableMap", ObservableMap);
+
+    var _a$1;
+    var ObservableSetMarker = {};
+    var ObservableSet = /** @class */ (function () {
+        function ObservableSet(initialData, enhancer, name) {
+            if (enhancer === void 0) { enhancer = deepEnhancer; }
+            if (name === void 0) { name = "ObservableSet@" + getNextId(); }
+            this.name = name;
+            this[_a$1] = ObservableSetMarker;
+            this._data = new Set();
+            this._atom = createAtom(this.name);
+            this[Symbol.toStringTag] = "Set";
+            if (typeof Set !== "function") {
+                throw new Error("mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js");
+            }
+            this.enhancer = function (newV, oldV) { return enhancer(newV, oldV, name); };
+            if (initialData) {
+                this.replace(initialData);
+            }
+        }
+        ObservableSet.prototype.dehanceValue = function (value) {
+            if (this.dehancer !== undefined) {
+                return this.dehancer(value);
+            }
+            return value;
+        };
+        ObservableSet.prototype.clear = function () {
+            var _this = this;
+            transaction(function () {
+                untracked(function () {
+                    var e_1, _a;
+                    try {
+                        for (var _b = __values(_this._data.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
+                            var value = _c.value;
+                            _this.delete(value);
+                        }
+                    }
+                    catch (e_1_1) { e_1 = { error: e_1_1 }; }
+                    finally {
+                        try {
+                            if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
+                        }
+                        finally { if (e_1) throw e_1.error; }
+                    }
+                });
+            });
+        };
+        ObservableSet.prototype.forEach = function (callbackFn, thisArg) {
+            var e_2, _a;
+            try {
+                for (var _b = __values(this), _c = _b.next(); !_c.done; _c = _b.next()) {
+                    var value = _c.value;
+                    callbackFn.call(thisArg, value, value, this);
+                }
+            }
+            catch (e_2_1) { e_2 = { error: e_2_1 }; }
+            finally {
+                try {
+                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
+                }
+                finally { if (e_2) throw e_2.error; }
+            }
+        };
+        Object.defineProperty(ObservableSet.prototype, "size", {
+            get: function () {
+                this._atom.reportObserved();
+                return this._data.size;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        ObservableSet.prototype.add = function (value) {
+            var _this = this;
+            checkIfStateModificationsAreAllowed(this._atom);
+            if (hasInterceptors(this)) {
+                var change = interceptChange(this, {
+                    type: "add",
+                    object: this,
+                    newValue: value
+                });
+                if (!change)
+                    return this;
+                // TODO: ideally, value = change.value would be done here, so that values can be
+                // changed by interceptor. Same applies for other Set and Map api's.
+            }
+            if (!this.has(value)) {
+                transaction(function () {
+                    _this._data.add(_this.enhancer(value, undefined));
+                    _this._atom.reportChanged();
+                });
+                var notifySpy = isSpyEnabled();
+                var notify = hasListeners(this);
+                var change = notify || notifySpy
+                    ? {
+                        type: "add",
+                        object: this,
+                        newValue: value
+                    }
+                    : null;
+                if (notifySpy && process.env.NODE_ENV !== "production")
+                    spyReportStart(change);
+                if (notify)
+                    notifyListeners(this, change);
+                if (notifySpy && process.env.NODE_ENV !== "production")
+                    spyReportEnd();
+            }
+            return this;
+        };
+        ObservableSet.prototype.delete = function (value) {
+            var _this = this;
+            if (hasInterceptors(this)) {
+                var change = interceptChange(this, {
+                    type: "delete",
+                    object: this,
+                    oldValue: value
+                });
+                if (!change)
+                    return false;
+            }
+            if (this.has(value)) {
+                var notifySpy = isSpyEnabled();
+                var notify = hasListeners(this);
+                var change = notify || notifySpy
+                    ? {
+                        type: "delete",
+                        object: this,
+                        oldValue: value
+                    }
+                    : null;
+                if (notifySpy && process.env.NODE_ENV !== "production")
+                    spyReportStart(__assign({}, change, { name: this.name }));
+                transaction(function () {
+                    _this._atom.reportChanged();
+                    _this._data.delete(value);
+                });
+                if (notify)
+                    notifyListeners(this, change);
+                if (notifySpy && process.env.NODE_ENV !== "production")
+                    spyReportEnd();
+                return true;
+            }
+            return false;
+        };
+        ObservableSet.prototype.has = function (value) {
+            this._atom.reportObserved();
+            return this._data.has(this.dehanceValue(value));
+        };
+        ObservableSet.prototype.entries = function () {
+            var nextIndex = 0;
+            var keys = Array.from(this.keys());
+            var values = Array.from(this.values());
+            return makeIterable({
+                next: function () {
+                    var index = nextIndex;
+                    nextIndex += 1;
+                    return index < values.length
+                        ? { value: [keys[index], values[index]], done: false }
+                        : { done: true };
+                }
+            });
+        };
+        ObservableSet.prototype.keys = function () {
+            return this.values();
+        };
+        ObservableSet.prototype.values = function () {
+            this._atom.reportObserved();
+            var self = this;
+            var nextIndex = 0;
+            var observableValues = Array.from(this._data.values());
+            return makeIterable({
+                next: function () {
+                    return nextIndex < observableValues.length
+                        ? { value: self.dehanceValue(observableValues[nextIndex++]), done: false }
+                        : { done: true };
+                }
+            });
+        };
+        ObservableSet.prototype.replace = function (other) {
+            var _this = this;
+            if (isObservableSet(other)) {
+                other = other.toJS();
+            }
+            transaction(function () {
+                if (Array.isArray(other)) {
+                    _this.clear();
+                    other.forEach(function (value) { return _this.add(value); });
+                }
+                else if (isES6Set(other)) {
+                    _this.clear();
+                    other.forEach(function (value) { return _this.add(value); });
+                }
+                else if (other !== null && other !== undefined) {
+                    fail("Cannot initialize set from " + other);
+                }
+            });
+            return this;
+        };
+        ObservableSet.prototype.observe = function (listener, fireImmediately) {
+            // TODO 'fireImmediately' can be true?
+            process.env.NODE_ENV !== "production" &&
+                invariant(fireImmediately !== true, "`observe` doesn't support fireImmediately=true in combination with sets.");
+            return registerListener(this, listener);
+        };
+        ObservableSet.prototype.intercept = function (handler) {
+            return registerInterceptor(this, handler);
+        };
+        ObservableSet.prototype.toJS = function () {
+            return new Set(this);
+        };
+        ObservableSet.prototype.toString = function () {
+            return this.name + "[ " + Array.from(this).join(", ") + " ]";
+        };
+        ObservableSet.prototype[(_a$1 = $mobx, Symbol.iterator)] = function () {
+            return this.values();
+        };
+        return ObservableSet;
+    }());
+    var isObservableSet = createInstanceofPredicate("ObservableSet", ObservableSet);
+
+    var ObservableObjectAdministration = /** @class */ (function () {
+        function ObservableObjectAdministration(target, values, name, defaultEnhancer) {
+            if (values === void 0) { values = new Map(); }
+            this.target = target;
+            this.values = values;
+            this.name = name;
+            this.defaultEnhancer = defaultEnhancer;
+            this.keysAtom = new Atom(name + ".keys");
+        }
+        ObservableObjectAdministration.prototype.read = function (key) {
+            return this.values.get(key).get();
+        };
+        ObservableObjectAdministration.prototype.write = function (key, newValue) {
+            var instance = this.target;
+            var observable = this.values.get(key);
+            if (observable instanceof ComputedValue) {
+                observable.set(newValue);
+                return;
+            }
+            // intercept
+            if (hasInterceptors(this)) {
+                var change = interceptChange(this, {
+                    type: "update",
+                    object: this.proxy || instance,
+                    name: key,
+                    newValue: newValue
+                });
+                if (!change)
+                    return;
+                newValue = change.newValue;
+            }
+            newValue = observable.prepareNewValue(newValue);
+            // notify spy & observers
+            if (newValue !== globalState.UNCHANGED) {
+                var notify = hasListeners(this);
+                var notifySpy = isSpyEnabled();
+                var change = notify || notifySpy
+                    ? {
+                        type: "update",
+                        object: this.proxy || instance,
+                        oldValue: observable.value,
+                        name: key,
+                        newValue: newValue
+                    }
+                    : null;
+                if (notifySpy && process.env.NODE_ENV !== "production")
+                    spyReportStart(__assign({}, change, { name: this.name, key: key }));
+                observable.setNewValue(newValue);
+                if (notify)
+                    notifyListeners(this, change);
+                if (notifySpy && process.env.NODE_ENV !== "production")
+                    spyReportEnd();
+            }
+        };
+        ObservableObjectAdministration.prototype.has = function (key) {
+            var map = this.pendingKeys || (this.pendingKeys = new Map());
+            var entry = map.get(key);
+            if (entry)
+                return entry.get();
+            else {
+                var exists = !!this.values.get(key);
+                // Possible optimization: Don't have a separate map for non existing keys,
+                // but store them in the values map instead, using a special symbol to denote "not existing"
+                entry = new ObservableValue(exists, referenceEnhancer, this.name + "." + stringifyKey(key) + "?", false);
+                map.set(key, entry);
+                return entry.get(); // read to subscribe
+            }
+        };
+        ObservableObjectAdministration.prototype.addObservableProp = function (propName, newValue, enhancer) {
+            if (enhancer === void 0) { enhancer = this.defaultEnhancer; }
+            var target = this.target;
+            assertPropertyConfigurable(target, propName);
+            if (hasInterceptors(this)) {
+                var change = interceptChange(this, {
+                    object: this.proxy || target,
+                    name: propName,
+                    type: "add",
+                    newValue: newValue
+                });
+                if (!change)
+                    return;
+                newValue = change.newValue;
+            }
+            var observable = new ObservableValue(newValue, enhancer, this.name + "." + stringifyKey(propName), false);
+            this.values.set(propName, observable);
+            newValue = observable.value; // observableValue might have changed it
+            Object.defineProperty(target, propName, generateObservablePropConfig(propName));
+            this.notifyPropertyAddition(propName, newValue);
+        };
+        ObservableObjectAdministration.prototype.addComputedProp = function (propertyOwner, // where is the property declared?
+        propName, options) {
+            var target = this.target;
+            options.name = options.name || this.name + "." + stringifyKey(propName);
+            this.values.set(propName, new ComputedValue(options));
+            if (propertyOwner === target || isPropertyConfigurable(propertyOwner, propName))
+                Object.defineProperty(propertyOwner, propName, generateComputedPropConfig(propName));
+        };
+        ObservableObjectAdministration.prototype.remove = function (key) {
+            if (!this.values.has(key))
+                return;
+            var target = this.target;
+            if (hasInterceptors(this)) {
+                var change = interceptChange(this, {
+                    object: this.proxy || target,
+                    name: key,
+                    type: "remove"
+                });
+                if (!change)
+                    return;
+            }
+            try {
+                startBatch();
+                var notify = hasListeners(this);
+                var notifySpy = isSpyEnabled();
+                var oldObservable = this.values.get(key);
+                var oldValue = oldObservable && oldObservable.get();
+                oldObservable && oldObservable.set(undefined);
+                // notify key and keyset listeners
+                this.keysAtom.reportChanged();
+                this.values.delete(key);
+                if (this.pendingKeys) {
+                    var entry = this.pendingKeys.get(key);
+                    if (entry)
+                        entry.set(false);
+                }
+                // delete the prop
+                delete this.target[key];
+                var change = notify || notifySpy
+                    ? {
+                        type: "remove",
+                        object: this.proxy || target,
+                        oldValue: oldValue,
+                        name: key
+                    }
+                    : null;
+                if (notifySpy && process.env.NODE_ENV !== "production")
+                    spyReportStart(__assign({}, change, { name: this.name, key: key }));
+                if (notify)
+                    notifyListeners(this, change);
+                if (notifySpy && process.env.NODE_ENV !== "production")
+                    spyReportEnd();
+            }
+            finally {
+                endBatch();
+            }
+        };
+        ObservableObjectAdministration.prototype.illegalAccess = function (owner, propName) {
+            /**
+             * This happens if a property is accessed through the prototype chain, but the property was
+             * declared directly as own property on the prototype.
+             *
+             * E.g.:
+             * class A {
+             * }
+             * extendObservable(A.prototype, { x: 1 })
+             *
+             * classB extens A {
+             * }
+             * console.log(new B().x)
+             *
+             * It is unclear whether the property should be considered 'static' or inherited.
+             * Either use `console.log(A.x)`
+             * or: decorate(A, { x: observable })
+             *
+             * When using decorate, the property will always be redeclared as own property on the actual instance
+             */
+            console.warn("Property '" + propName + "' of '" + owner + "' was accessed through the prototype chain. Use 'decorate' instead to declare the prop or access it statically through it's owner");
+        };
+        /**
+         * Observes this object. Triggers for the events 'add', 'update' and 'delete'.
+         * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
+         * for callback details
+         */
+        ObservableObjectAdministration.prototype.observe = function (callback, fireImmediately) {
+            process.env.NODE_ENV !== "production" &&
+                invariant(fireImmediately !== true, "`observe` doesn't support the fire immediately property for observable objects.");
+            return registerListener(this, callback);
+        };
+        ObservableObjectAdministration.prototype.intercept = function (handler) {
+            return registerInterceptor(this, handler);
+        };
+        ObservableObjectAdministration.prototype.notifyPropertyAddition = function (key, newValue) {
+            var notify = hasListeners(this);
+            var notifySpy = isSpyEnabled();
+            var change = notify || notifySpy
+                ? {
+                    type: "add",
+                    object: this.proxy || this.target,
+                    name: key,
+                    newValue: newValue
+                }
+                : null;
+            if (notifySpy && process.env.NODE_ENV !== "production")
+                spyReportStart(__assign({}, change, { name: this.name, key: key }));
+            if (notify)
+                notifyListeners(this, change);
+            if (notifySpy && process.env.NODE_ENV !== "production")
+                spyReportEnd();
+            if (this.pendingKeys) {
+                var entry = this.pendingKeys.get(key);
+                if (entry)
+                    entry.set(true);
+            }
+            this.keysAtom.reportChanged();
+        };
+        ObservableObjectAdministration.prototype.getKeys = function () {
+            var e_1, _a;
+            this.keysAtom.reportObserved();
+            // return Reflect.ownKeys(this.values) as any
+            var res = [];
+            try {
+                for (var _b = __values(this.values), _c = _b.next(); !_c.done; _c = _b.next()) {
+                    var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
+                    if (value instanceof ObservableValue)
+                        res.push(key);
+                }
+            }
+            catch (e_1_1) { e_1 = { error: e_1_1 }; }
+            finally {
+                try {
+                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
+                }
+                finally { if (e_1) throw e_1.error; }
+            }
+            return res;
+        };
+        return ObservableObjectAdministration;
+    }());
+    function asObservableObject(target, name, defaultEnhancer) {
+        if (name === void 0) { name = ""; }
+        if (defaultEnhancer === void 0) { defaultEnhancer = deepEnhancer; }
+        if (Object.prototype.hasOwnProperty.call(target, $mobx))
+            return target[$mobx];
+        process.env.NODE_ENV !== "production" &&
+            invariant(Object.isExtensible(target), "Cannot make the designated object observable; it is not extensible");
+        if (!isPlainObject(target))
+            name = (target.constructor.name || "ObservableObject") + "@" + getNextId();
+        if (!name)
+            name = "ObservableObject@" + getNextId();
+        var adm = new ObservableObjectAdministration(target, new Map(), stringifyKey(name), defaultEnhancer);
+        addHiddenProp(target, $mobx, adm);
+        return adm;
+    }
+    var observablePropertyConfigs = Object.create(null);
+    var computedPropertyConfigs = Object.create(null);
+    function generateObservablePropConfig(propName) {
+        return (observablePropertyConfigs[propName] ||
+            (observablePropertyConfigs[propName] = {
+                configurable: true,
+                enumerable: true,
+                get: function () {
+                    return this[$mobx].read(propName);
+                },
+                set: function (v) {
+                    this[$mobx].write(propName, v);
+                }
+            }));
+    }
+    function getAdministrationForComputedPropOwner(owner) {
+        var adm = owner[$mobx];
+        if (!adm) {
+            // because computed props are declared on proty,
+            // the current instance might not have been initialized yet
+            initializeInstance(owner);
+            return owner[$mobx];
+        }
+        return adm;
+    }
+    function generateComputedPropConfig(propName) {
+        return (computedPropertyConfigs[propName] ||
+            (computedPropertyConfigs[propName] = {
+                configurable: globalState.computedConfigurable,
+                enumerable: false,
+                get: function () {
+                    return getAdministrationForComputedPropOwner(this).read(propName);
+                },
+                set: function (v) {
+                    getAdministrationForComputedPropOwner(this).write(propName, v);
+                }
+            }));
+    }
+    var isObservableObjectAdministration = createInstanceofPredicate("ObservableObjectAdministration", ObservableObjectAdministration);
+    function isObservableObject(thing) {
+        if (isObject(thing)) {
+            // Initializers run lazily when transpiling to babel, so make sure they are run...
+            initializeInstance(thing);
+            return isObservableObjectAdministration(thing[$mobx]);
+        }
+        return false;
+    }
+
+    function getAtom(thing, property) {
+        if (typeof thing === "object" && thing !== null) {
+            if (isObservableArray(thing)) {
+                if (property !== undefined)
+                    fail(process.env.NODE_ENV !== "production" &&
+                        "It is not possible to get index atoms from arrays");
+                return thing[$mobx].atom;
+            }
+            if (isObservableSet(thing)) {
+                return thing[$mobx];
+            }
+            if (isObservableMap(thing)) {
+                var anyThing = thing;
+                if (property === undefined)
+                    return anyThing._keysAtom;
+                var observable = anyThing._data.get(property) || anyThing._hasMap.get(property);
+                if (!observable)
+                    fail(process.env.NODE_ENV !== "production" &&
+                        "the entry '" + property + "' does not exist in the observable map '" + getDebugName(thing) + "'");
+                return observable;
+            }
+            // Initializers run lazily when transpiling to babel, so make sure they are run...
+            initializeInstance(thing);
+            if (property && !thing[$mobx])
+                thing[property]; // See #1072
+            if (isObservableObject(thing)) {
+                if (!property)
+                    return fail(process.env.NODE_ENV !== "production" && "please specify a property");
+                var observable = thing[$mobx].values.get(property);
+                if (!observable)
+                    fail(process.env.NODE_ENV !== "production" &&
+                        "no observable property '" + property + "' found on the observable object '" + getDebugName(thing) + "'");
+                return observable;
+            }
+            if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {
+                return thing;
+            }
+        }
+        else if (typeof thing === "function") {
+            if (isReaction(thing[$mobx])) {
+                // disposer function
+                return thing[$mobx];
+            }
+        }
+        return fail(process.env.NODE_ENV !== "production" && "Cannot obtain atom from " + thing);
+    }
+    function getAdministration(thing, property) {
+        if (!thing)
+            fail("Expecting some object");
+        if (property !== undefined)
+            return getAdministration(getAtom(thing, property));
+        if (isAtom(thing) || isComputedValue(thing) || isReaction(thing))
+            return thing;
+        if (isObservableMap(thing) || isObservableSet(thing))
+            return thing;
+        // Initializers run lazily when transpiling to babel, so make sure they are run...
+        initializeInstance(thing);
+        if (thing[$mobx])
+            return thing[$mobx];
+        fail(process.env.NODE_ENV !== "production" && "Cannot obtain administration from " + thing);
+    }
+    function getDebugName(thing, property) {
+        var named;
+        if (property !== undefined)
+            named = getAtom(thing, property);
+        else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing))
+            named = getAdministration(thing);
+        else
+            named = getAtom(thing); // valid for arrays as well
+        return named.name;
+    }
+
+    var toString = Object.prototype.toString;
+    function deepEqual(a, b) {
+        return eq(a, b);
+    }
+    // Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289
+    // Internal recursive comparison function for `isEqual`.
+    function eq(a, b, aStack, bStack) {
+        // Identical objects are equal. `0 === -0`, but they aren't identical.
+        // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
+        if (a === b)
+            return a !== 0 || 1 / a === 1 / b;
+        // `null` or `undefined` only equal to itself (strict comparison).
+        if (a == null || b == null)
+            return false;
+        // `NaN`s are equivalent, but non-reflexive.
+        if (a !== a)
+            return b !== b;
+        // Exhaust primitive checks
+        var type = typeof a;
+        if (type !== "function" && type !== "object" && typeof b != "object")
+            return false;
+        return deepEq(a, b, aStack, bStack);
+    }
+    // Internal recursive comparison function for `isEqual`.
+    function deepEq(a, b, aStack, bStack) {
+        // Unwrap any wrapped objects.
+        a = unwrap(a);
+        b = unwrap(b);
+        // Compare `[[Class]]` names.
+        var className = toString.call(a);
+        if (className !== toString.call(b))
+            return false;
+        switch (className) {
+            // Strings, numbers, regular expressions, dates, and booleans are compared by value.
+            case "[object RegExp]":
+            // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
+            case "[object String]":
+                // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
+                // equivalent to `new String("5")`.
+                return "" + a === "" + b;
+            case "[object Number]":
+                // `NaN`s are equivalent, but non-reflexive.
+                // Object(NaN) is equivalent to NaN.
+                if (+a !== +a)
+                    return +b !== +b;
+                // An `egal` comparison is performed for other numeric values.
+                return +a === 0 ? 1 / +a === 1 / b : +a === +b;
+            case "[object Date]":
+            case "[object Boolean]":
+                // Coerce dates and booleans to numeric primitive values. Dates are compared by their
+                // millisecond representations. Note that invalid dates with millisecond representations
+                // of `NaN` are not equivalent.
+                return +a === +b;
+            case "[object Symbol]":
+                return (typeof Symbol !== "undefined" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b));
+        }
+        var areArrays = className === "[object Array]";
+        if (!areArrays) {
+            if (typeof a != "object" || typeof b != "object")
+                return false;
+            // Objects with different constructors are not equivalent, but `Object`s or `Array`s
+            // from different frames are.
+            var aCtor = a.constructor, bCtor = b.constructor;
+            if (aCtor !== bCtor &&
+                !(typeof aCtor === "function" &&
+                    aCtor instanceof aCtor &&
+                    typeof bCtor === "function" &&
+                    bCtor instanceof bCtor) &&
+                ("constructor" in a && "constructor" in b)) {
+                return false;
+            }
+        }
+        // Assume equality for cyclic structures. The algorithm for detecting cyclic
+        // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
+        // Initializing stack of traversed objects.
+        // It's done here since we only need them for objects and arrays comparison.
+        aStack = aStack || [];
+        bStack = bStack || [];
+        var length = aStack.length;
+        while (length--) {
+            // Linear search. Performance is inversely proportional to the number of
+            // unique nested structures.
+            if (aStack[length] === a)
+                return bStack[length] === b;
+        }
+        // Add the first object to the stack of traversed objects.
+        aStack.push(a);
+        bStack.push(b);
+        // Recursively compare objects and arrays.
+        if (areArrays) {
+            // Compare array lengths to determine if a deep comparison is necessary.
+            length = a.length;
+            if (length !== b.length)
+                return false;
+            // Deep compare the contents, ignoring non-numeric properties.
+            while (length--) {
+                if (!eq(a[length], b[length], aStack, bStack))
+                    return false;
+            }
+        }
+        else {
+            // Deep compare objects.
+            var keys = Object.keys(a);
+            var key = void 0;
+            length = keys.length;
+            // Ensure that both objects contain the same number of properties before comparing deep equality.
+            if (Object.keys(b).length !== length)
+                return false;
+            while (length--) {
+                // Deep compare each member
+                key = keys[length];
+                if (!(has$1(b, key) && eq(a[key], b[key], aStack, bStack)))
+                    return false;
+            }
+        }
+        // Remove the first object from the stack of traversed objects.
+        aStack.pop();
+        bStack.pop();
+        return true;
+    }
+    function unwrap(a) {
+        if (isObservableArray(a))
+            return a.slice();
+        if (isES6Map(a) || isObservableMap(a))
+            return Array.from(a.entries());
+        if (isES6Set(a) || isObservableSet(a))
+            return Array.from(a.entries());
+        return a;
+    }
+    function has$1(a, key) {
+        return Object.prototype.hasOwnProperty.call(a, key);
+    }
+
+    function makeIterable(iterator) {
+        iterator[Symbol.iterator] = self;
+        return iterator;
+    }
+    function self() {
+        return this;
+    }
+
+    /*
+    The only reason for this file to exist is pure horror:
+    Without it rollup can make the bundling fail at any point in time; when it rolls up the files in the wrong order
+    it will cause undefined errors (for example because super classes or local variables not being hosted).
+    With this file that will still happen,
+    but at least in this file we can magically reorder the imports with trial and error until the build succeeds again.
+    */
+
+    /**
+     * (c) Michel Weststrate 2015 - 2018
+     * MIT Licensed
+     *
+     * Welcome to the mobx sources! To get an global overview of how MobX internally works,
+     * this is a good place to start:
+     * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74
+     *
+     * Source folders:
+     * ===============
+     *
+     * - api/     Most of the public static methods exposed by the module can be found here.
+     * - core/    Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.
+     * - types/   All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.
+     * - utils/   Utility stuff.
+     *
+     */
+    if (typeof Proxy === "undefined" || typeof Symbol === "undefined") {
+        throw new Error("[mobx] MobX 5+ requires Proxy and Symbol objects. If your environment doesn't support Symbol or Proxy objects, please downgrade to MobX 4. For React Native Android, consider upgrading JSCore.");
+    }
+    try {
+        // define process.env if needed
+        // if this is not a production build in the first place
+        // (in which case the expression below would be substituted with 'production')
+        process.env.NODE_ENV;
+    }
+    catch (e) {
+        var g = typeof window !== "undefined" ? window : global;
+        if (typeof process === "undefined")
+            g.process = {};
+        g.process.env = {};
+    }
+    (function () {
+        function testCodeMinification() { }
+        if (testCodeMinification.name !== "testCodeMinification" &&
+            process.env.NODE_ENV !== "production" &&
+            process.env.IGNORE_MOBX_MINIFY_WARNING !== "true") {
+            // trick so it doesn't get replaced
+            var varName = ["process", "env", "NODE_ENV"].join(".");
+            console.warn("[mobx] you are running a minified build, but '" + varName + "' was not set to 'production' in your bundler. This results in an unnecessarily large and slow bundle");
+        }
+    })();
+    if (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === "object") {
+        // See: https://github.com/andykog/mobx-devtools/
+        __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({
+            spy: spy,
+            extras: {
+                getDebugName: getDebugName
+            },
+            $mobx: $mobx
+        });
+    }
+
+    exports.$mobx = $mobx;
+    exports.ObservableMap = ObservableMap;
+    exports.ObservableSet = ObservableSet;
+    exports.Reaction = Reaction;
+    exports._allowStateChanges = allowStateChanges;
+    exports._allowStateChangesInsideComputed = allowStateChangesInsideComputed;
+    exports._getAdministration = getAdministration;
+    exports._getGlobalState = getGlobalState;
+    exports._interceptReads = interceptReads;
+    exports._isComputingDerivation = isComputingDerivation;
+    exports._resetGlobalState = resetGlobalState;
+    exports.action = action;
+    exports.autorun = autorun;
+    exports.comparer = comparer;
+    exports.computed = computed;
+    exports.configure = configure;
+    exports.createAtom = createAtom;
+    exports.decorate = decorate;
+    exports.entries = entries;
+    exports.extendObservable = extendObservable;
+    exports.flow = flow;
+    exports.get = get;
+    exports.getAtom = getAtom;
+    exports.getDebugName = getDebugName;
+    exports.getDependencyTree = getDependencyTree;
+    exports.getObserverTree = getObserverTree;
+    exports.has = has;
+    exports.intercept = intercept;
+    exports.isAction = isAction;
+    exports.isArrayLike = isArrayLike;
+    exports.isBoxedObservable = isObservableValue;
+    exports.isComputed = isComputed;
+    exports.isComputedProp = isComputedProp;
+    exports.isObservable = isObservable;
+    exports.isObservableArray = isObservableArray;
+    exports.isObservableMap = isObservableMap;
+    exports.isObservableObject = isObservableObject;
+    exports.isObservableProp = isObservableProp;
+    exports.isObservableSet = isObservableSet;
+    exports.keys = keys;
+    exports.observable = observable;
+    exports.observe = observe;
+    exports.onBecomeObserved = onBecomeObserved;
+    exports.onBecomeUnobserved = onBecomeUnobserved;
+    exports.onReactionError = onReactionError;
+    exports.reaction = reaction;
+    exports.remove = remove;
+    exports.runInAction = runInAction;
+    exports.set = set;
+    exports.spy = spy;
+    exports.toJS = toJS;
+    exports.trace = trace;
+    exports.transaction = transaction;
+    exports.untracked = untracked;
+    exports.values = values;
+    exports.when = when;
+
+    Object.defineProperty(exports, '__esModule', { value: true });
+
+}));
diff --git a/vendor/vue-2.6.11.js b/vendor/vue-2.6.11.js
new file mode 100644
index 0000000..e22cf13
--- /dev/null
+++ b/vendor/vue-2.6.11.js
@@ -0,0 +1,11965 @@
+/*!
+ * Vue.js v2.6.11
+ * (c) 2014-2019 Evan You
+ * Released under the MIT License.
+ */
+(function (global, factory) {
+  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+  typeof define === 'function' && define.amd ? define(factory) :
+  (global = global || self, global.Vue = factory());
+}(this, function () { 'use strict';
+
+  /*  */
+
+  var emptyObject = Object.freeze({});
+
+  // These helpers produce better VM code in JS engines due to their
+  // explicitness and function inlining.
+  function isUndef (v) {
+    return v === undefined || v === null
+  }
+
+  function isDef (v) {
+    return v !== undefined && v !== null
+  }
+
+  function isTrue (v) {
+    return v === true
+  }
+
+  function isFalse (v) {
+    return v === false
+  }
+
+  /**
+   * Check if value is primitive.
+   */
+  function isPrimitive (value) {
+    return (
+      typeof value === 'string' ||
+      typeof value === 'number' ||
+      // $flow-disable-line
+      typeof value === 'symbol' ||
+      typeof value === 'boolean'
+    )
+  }
+
+  /**
+   * Quick object check - this is primarily used to tell
+   * Objects from primitive values when we know the value
+   * is a JSON-compliant type.
+   */
+  function isObject (obj) {
+    return obj !== null && typeof obj === 'object'
+  }
+
+  /**
+   * Get the raw type string of a value, e.g., [object Object].
+   */
+  var _toString = Object.prototype.toString;
+
+  function toRawType (value) {
+    return _toString.call(value).slice(8, -1)
+  }
+
+  /**
+   * Strict object type check. Only returns true
+   * for plain JavaScript objects.
+   */
+  function isPlainObject (obj) {
+    return _toString.call(obj) === '[object Object]'
+  }
+
+  function isRegExp (v) {
+    return _toString.call(v) === '[object RegExp]'
+  }
+
+  /**
+   * Check if val is a valid array index.
+   */
+  function isValidArrayIndex (val) {
+    var n = parseFloat(String(val));
+    return n >= 0 && Math.floor(n) === n && isFinite(val)
+  }
+
+  function isPromise (val) {
+    return (
+      isDef(val) &&
+      typeof val.then === 'function' &&
+      typeof val.catch === 'function'
+    )
+  }
+
+  /**
+   * Convert a value to a string that is actually rendered.
+   */
+  function toString (val) {
+    return val == null
+      ? ''
+      : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
+        ? JSON.stringify(val, null, 2)
+        : String(val)
+  }
+
+  /**
+   * Convert an input value to a number for persistence.
+   * If the conversion fails, return original string.
+   */
+  function toNumber (val) {
+    var n = parseFloat(val);
+    return isNaN(n) ? val : n
+  }
+
+  /**
+   * Make a map and return a function for checking if a key
+   * is in that map.
+   */
+  function makeMap (
+    str,
+    expectsLowerCase
+  ) {
+    var map = Object.create(null);
+    var list = str.split(',');
+    for (var i = 0; i < list.length; i++) {
+      map[list[i]] = true;
+    }
+    return expectsLowerCase
+      ? function (val) { return map[val.toLowerCase()]; }
+      : function (val) { return map[val]; }
+  }
+
+  /**
+   * Check if a tag is a built-in tag.
+   */
+  var isBuiltInTag = makeMap('slot,component', true);
+
+  /**
+   * Check if an attribute is a reserved attribute.
+   */
+  var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
+
+  /**
+   * Remove an item from an array.
+   */
+  function remove (arr, item) {
+    if (arr.length) {
+      var index = arr.indexOf(item);
+      if (index > -1) {
+        return arr.splice(index, 1)
+      }
+    }
+  }
+
+  /**
+   * Check whether an object has the property.
+   */
+  var hasOwnProperty = Object.prototype.hasOwnProperty;
+  function hasOwn (obj, key) {
+    return hasOwnProperty.call(obj, key)
+  }
+
+  /**
+   * Create a cached version of a pure function.
+   */
+  function cached (fn) {
+    var cache = Object.create(null);
+    return (function cachedFn (str) {
+      var hit = cache[str];
+      return hit || (cache[str] = fn(str))
+    })
+  }
+
+  /**
+   * Camelize a hyphen-delimited string.
+   */
+  var camelizeRE = /-(\w)/g;
+  var camelize = cached(function (str) {
+    return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
+  });
+
+  /**
+   * Capitalize a string.
+   */
+  var capitalize = cached(function (str) {
+    return str.charAt(0).toUpperCase() + str.slice(1)
+  });
+
+  /**
+   * Hyphenate a camelCase string.
+   */
+  var hyphenateRE = /\B([A-Z])/g;
+  var hyphenate = cached(function (str) {
+    return str.replace(hyphenateRE, '-$1').toLowerCase()
+  });
+
+  /**
+   * Simple bind polyfill for environments that do not support it,
+   * e.g., PhantomJS 1.x. Technically, we don't need this anymore
+   * since native bind is now performant enough in most browsers.
+   * But removing it would mean breaking code that was able to run in
+   * PhantomJS 1.x, so this must be kept for backward compatibility.
+   */
+
+  /* istanbul ignore next */
+  function polyfillBind (fn, ctx) {
+    function boundFn (a) {
+      var l = arguments.length;
+      return l
+        ? l > 1
+          ? fn.apply(ctx, arguments)
+          : fn.call(ctx, a)
+        : fn.call(ctx)
+    }
+
+    boundFn._length = fn.length;
+    return boundFn
+  }
+
+  function nativeBind (fn, ctx) {
+    return fn.bind(ctx)
+  }
+
+  var bind = Function.prototype.bind
+    ? nativeBind
+    : polyfillBind;
+
+  /**
+   * Convert an Array-like object to a real Array.
+   */
+  function toArray (list, start) {
+    start = start || 0;
+    var i = list.length - start;
+    var ret = new Array(i);
+    while (i--) {
+      ret[i] = list[i + start];
+    }
+    return ret
+  }
+
+  /**
+   * Mix properties into target object.
+   */
+  function extend (to, _from) {
+    for (var key in _from) {
+      to[key] = _from[key];
+    }
+    return to
+  }
+
+  /**
+   * Merge an Array of Objects into a single Object.
+   */
+  function toObject (arr) {
+    var res = {};
+    for (var i = 0; i < arr.length; i++) {
+      if (arr[i]) {
+        extend(res, arr[i]);
+      }
+    }
+    return res
+  }
+
+  /* eslint-disable no-unused-vars */
+
+  /**
+   * Perform no operation.
+   * Stubbing args to make Flow happy without leaving useless transpiled code
+   * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
+   */
+  function noop (a, b, c) {}
+
+  /**
+   * Always return false.
+   */
+  var no = function (a, b, c) { return false; };
+
+  /* eslint-enable no-unused-vars */
+
+  /**
+   * Return the same value.
+   */
+  var identity = function (_) { return _; };
+
+  /**
+   * Generate a string containing static keys from compiler modules.
+   */
+  function genStaticKeys (modules) {
+    return modules.reduce(function (keys, m) {
+      return keys.concat(m.staticKeys || [])
+    }, []).join(',')
+  }
+
+  /**
+   * Check if two values are loosely equal - that is,
+   * if they are plain objects, do they have the same shape?
+   */
+  function looseEqual (a, b) {
+    if (a === b) { return true }
+    var isObjectA = isObject(a);
+    var isObjectB = isObject(b);
+    if (isObjectA && isObjectB) {
+      try {
+        var isArrayA = Array.isArray(a);
+        var isArrayB = Array.isArray(b);
+        if (isArrayA && isArrayB) {
+          return a.length === b.length && a.every(function (e, i) {
+            return looseEqual(e, b[i])
+          })
+        } else if (a instanceof Date && b instanceof Date) {
+          return a.getTime() === b.getTime()
+        } else if (!isArrayA && !isArrayB) {
+          var keysA = Object.keys(a);
+          var keysB = Object.keys(b);
+          return keysA.length === keysB.length && keysA.every(function (key) {
+            return looseEqual(a[key], b[key])
+          })
+        } else {
+          /* istanbul ignore next */
+          return false
+        }
+      } catch (e) {
+        /* istanbul ignore next */
+        return false
+      }
+    } else if (!isObjectA && !isObjectB) {
+      return String(a) === String(b)
+    } else {
+      return false
+    }
+  }
+
+  /**
+   * Return the first index at which a loosely equal value can be
+   * found in the array (if value is a plain object, the array must
+   * contain an object of the same shape), or -1 if it is not present.
+   */
+  function looseIndexOf (arr, val) {
+    for (var i = 0; i < arr.length; i++) {
+      if (looseEqual(arr[i], val)) { return i }
+    }
+    return -1
+  }
+
+  /**
+   * Ensure a function is called only once.
+   */
+  function once (fn) {
+    var called = false;
+    return function () {
+      if (!called) {
+        called = true;
+        fn.apply(this, arguments);
+      }
+    }
+  }
+
+  var SSR_ATTR = 'data-server-rendered';
+
+  var ASSET_TYPES = [
+    'component',
+    'directive',
+    'filter'
+  ];
+
+  var LIFECYCLE_HOOKS = [
+    'beforeCreate',
+    'created',
+    'beforeMount',
+    'mounted',
+    'beforeUpdate',
+    'updated',
+    'beforeDestroy',
+    'destroyed',
+    'activated',
+    'deactivated',
+    'errorCaptured',
+    'serverPrefetch'
+  ];
+
+  /*  */
+
+
+
+  var config = ({
+    /**
+     * Option merge strategies (used in core/util/options)
+     */
+    // $flow-disable-line
+    optionMergeStrategies: Object.create(null),
+
+    /**
+     * Whether to suppress warnings.
+     */
+    silent: false,
+
+    /**
+     * Show production mode tip message on boot?
+     */
+    productionTip: "development" !== 'production',
+
+    /**
+     * Whether to enable devtools
+     */
+    devtools: "development" !== 'production',
+
+    /**
+     * Whether to record perf
+     */
+    performance: false,
+
+    /**
+     * Error handler for watcher errors
+     */
+    errorHandler: null,
+
+    /**
+     * Warn handler for watcher warns
+     */
+    warnHandler: null,
+
+    /**
+     * Ignore certain custom elements
+     */
+    ignoredElements: [],
+
+    /**
+     * Custom user key aliases for v-on
+     */
+    // $flow-disable-line
+    keyCodes: Object.create(null),
+
+    /**
+     * Check if a tag is reserved so that it cannot be registered as a
+     * component. This is platform-dependent and may be overwritten.
+     */
+    isReservedTag: no,
+
+    /**
+     * Check if an attribute is reserved so that it cannot be used as a component
+     * prop. This is platform-dependent and may be overwritten.
+     */
+    isReservedAttr: no,
+
+    /**
+     * Check if a tag is an unknown element.
+     * Platform-dependent.
+     */
+    isUnknownElement: no,
+
+    /**
+     * Get the namespace of an element
+     */
+    getTagNamespace: noop,
+
+    /**
+     * Parse the real tag name for the specific platform.
+     */
+    parsePlatformTagName: identity,
+
+    /**
+     * Check if an attribute must be bound using property, e.g. value
+     * Platform-dependent.
+     */
+    mustUseProp: no,
+
+    /**
+     * Perform updates asynchronously. Intended to be used by Vue Test Utils
+     * This will significantly reduce performance if set to false.
+     */
+    async: true,
+
+    /**
+     * Exposed for legacy reasons
+     */
+    _lifecycleHooks: LIFECYCLE_HOOKS
+  });
+
+  /*  */
+
+  /**
+   * unicode letters used for parsing html tags, component names and property paths.
+   * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
+   * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
+   */
+  var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
+
+  /**
+   * Check if a string starts with $ or _
+   */
+  function isReserved (str) {
+    var c = (str + '').charCodeAt(0);
+    return c === 0x24 || c === 0x5F
+  }
+
+  /**
+   * Define a property.
+   */
+  function def (obj, key, val, enumerable) {
+    Object.defineProperty(obj, key, {
+      value: val,
+      enumerable: !!enumerable,
+      writable: true,
+      configurable: true
+    });
+  }
+
+  /**
+   * Parse simple path.
+   */
+  var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
+  function parsePath (path) {
+    if (bailRE.test(path)) {
+      return
+    }
+    var segments = path.split('.');
+    return function (obj) {
+      for (var i = 0; i < segments.length; i++) {
+        if (!obj) { return }
+        obj = obj[segments[i]];
+      }
+      return obj
+    }
+  }
+
+  /*  */
+
+  // can we use __proto__?
+  var hasProto = '__proto__' in {};
+
+  // Browser environment sniffing
+  var inBrowser = typeof window !== 'undefined';
+  var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
+  var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
+  var UA = inBrowser && window.navigator.userAgent.toLowerCase();
+  var isIE = UA && /msie|trident/.test(UA);
+  var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
+  var isEdge = UA && UA.indexOf('edge/') > 0;
+  var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
+  var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
+  var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
+  var isPhantomJS = UA && /phantomjs/.test(UA);
+  var isFF = UA && UA.match(/firefox\/(\d+)/);
+
+  // Firefox has a "watch" function on Object.prototype...
+  var nativeWatch = ({}).watch;
+
+  var supportsPassive = false;
+  if (inBrowser) {
+    try {
+      var opts = {};
+      Object.defineProperty(opts, 'passive', ({
+        get: function get () {
+          /* istanbul ignore next */
+          supportsPassive = true;
+        }
+      })); // https://github.com/facebook/flow/issues/285
+      window.addEventListener('test-passive', null, opts);
+    } catch (e) {}
+  }
+
+  // this needs to be lazy-evaled because vue may be required before
+  // vue-server-renderer can set VUE_ENV
+  var _isServer;
+  var isServerRendering = function () {
+    if (_isServer === undefined) {
+      /* istanbul ignore if */
+      if (!inBrowser && !inWeex && typeof global !== 'undefined') {
+        // detect presence of vue-server-renderer and avoid
+        // Webpack shimming the process
+        _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
+      } else {
+        _isServer = false;
+      }
+    }
+    return _isServer
+  };
+
+  // detect devtools
+  var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
+
+  /* istanbul ignore next */
+  function isNative (Ctor) {
+    return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
+  }
+
+  var hasSymbol =
+    typeof Symbol !== 'undefined' && isNative(Symbol) &&
+    typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
+
+  var _Set;
+  /* istanbul ignore if */ // $flow-disable-line
+  if (typeof Set !== 'undefined' && isNative(Set)) {
+    // use native Set when available.
+    _Set = Set;
+  } else {
+    // a non-standard Set polyfill that only works with primitive keys.
+    _Set = /*@__PURE__*/(function () {
+      function Set () {
+        this.set = Object.create(null);
+      }
+      Set.prototype.has = function has (key) {
+        return this.set[key] === true
+      };
+      Set.prototype.add = function add (key) {
+        this.set[key] = true;
+      };
+      Set.prototype.clear = function clear () {
+        this.set = Object.create(null);
+      };
+
+      return Set;
+    }());
+  }
+
+  /*  */
+
+  var warn = noop;
+  var tip = noop;
+  var generateComponentTrace = (noop); // work around flow check
+  var formatComponentName = (noop);
+
+  {
+    var hasConsole = typeof console !== 'undefined';
+    var classifyRE = /(?:^|[-_])(\w)/g;
+    var classify = function (str) { return str
+      .replace(classifyRE, function (c) { return c.toUpperCase(); })
+      .replace(/[-_]/g, ''); };
+
+    warn = function (msg, vm) {
+      var trace = vm ? generateComponentTrace(vm) : '';
+
+      if (config.warnHandler) {
+        config.warnHandler.call(null, msg, vm, trace);
+      } else if (hasConsole && (!config.silent)) {
+        console.error(("[Vue warn]: " + msg + trace));
+      }
+    };
+
+    tip = function (msg, vm) {
+      if (hasConsole && (!config.silent)) {
+        console.warn("[Vue tip]: " + msg + (
+          vm ? generateComponentTrace(vm) : ''
+        ));
+      }
+    };
+
+    formatComponentName = function (vm, includeFile) {
+      if (vm.$root === vm) {
+        return ''
+      }
+      var options = typeof vm === 'function' && vm.cid != null
+        ? vm.options
+        : vm._isVue
+          ? vm.$options || vm.constructor.options
+          : vm;
+      var name = options.name || options._componentTag;
+      var file = options.__file;
+      if (!name && file) {
+        var match = file.match(/([^/\\]+)\.vue$/);
+        name = match && match[1];
+      }
+
+      return (
+        (name ? ("<" + (classify(name)) + ">") : "") +
+        (file && includeFile !== false ? (" at " + file) : '')
+      )
+    };
+
+    var repeat = function (str, n) {
+      var res = '';
+      while (n) {
+        if (n % 2 === 1) { res += str; }
+        if (n > 1) { str += str; }
+        n >>= 1;
+      }
+      return res
+    };
+
+    generateComponentTrace = function (vm) {
+      if (vm._isVue && vm.$parent) {
+        var tree = [];
+        var currentRecursiveSequence = 0;
+        while (vm) {
+          if (tree.length > 0) {
+            var last = tree[tree.length - 1];
+            if (last.constructor === vm.constructor) {
+              currentRecursiveSequence++;
+              vm = vm.$parent;
+              continue
+            } else if (currentRecursiveSequence > 0) {
+              tree[tree.length - 1] = [last, currentRecursiveSequence];
+              currentRecursiveSequence = 0;
+            }
+          }
+          tree.push(vm);
+          vm = vm.$parent;
+        }
+        return '\n\nfound in\n\n' + tree
+          .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
+              ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
+              : formatComponentName(vm))); })
+          .join('\n')
+      } else {
+        return ("\n\n(found in " + (formatComponentName(vm)) + ")")
+      }
+    };
+  }
+
+  /*  */
+
+  var uid = 0;
+
+  /**
+   * A dep is an observable that can have multiple
+   * directives subscribing to it.
+   */
+  var Dep = function Dep () {
+    this.id = uid++;
+    this.subs = [];
+  };
+
+  Dep.prototype.addSub = function addSub (sub) {
+    this.subs.push(sub);
+  };
+
+  Dep.prototype.removeSub = function removeSub (sub) {
+    remove(this.subs, sub);
+  };
+
+  Dep.prototype.depend = function depend () {
+    if (Dep.target) {
+      Dep.target.addDep(this);
+    }
+  };
+
+  Dep.prototype.notify = function notify () {
+    // stabilize the subscriber list first
+    var subs = this.subs.slice();
+    if (!config.async) {
+      // subs aren't sorted in scheduler if not running async
+      // we need to sort them now to make sure they fire in correct
+      // order
+      subs.sort(function (a, b) { return a.id - b.id; });
+    }
+    for (var i = 0, l = subs.length; i < l; i++) {
+      subs[i].update();
+    }
+  };
+
+  // The current target watcher being evaluated.
+  // This is globally unique because only one watcher
+  // can be evaluated at a time.
+  Dep.target = null;
+  var targetStack = [];
+
+  function pushTarget (target) {
+    targetStack.push(target);
+    Dep.target = target;
+  }
+
+  function popTarget () {
+    targetStack.pop();
+    Dep.target = targetStack[targetStack.length - 1];
+  }
+
+  /*  */
+
+  var VNode = function VNode (
+    tag,
+    data,
+    children,
+    text,
+    elm,
+    context,
+    componentOptions,
+    asyncFactory
+  ) {
+    this.tag = tag;
+    this.data = data;
+    this.children = children;
+    this.text = text;
+    this.elm = elm;
+    this.ns = undefined;
+    this.context = context;
+    this.fnContext = undefined;
+    this.fnOptions = undefined;
+    this.fnScopeId = undefined;
+    this.key = data && data.key;
+    this.componentOptions = componentOptions;
+    this.componentInstance = undefined;
+    this.parent = undefined;
+    this.raw = false;
+    this.isStatic = false;
+    this.isRootInsert = true;
+    this.isComment = false;
+    this.isCloned = false;
+    this.isOnce = false;
+    this.asyncFactory = asyncFactory;
+    this.asyncMeta = undefined;
+    this.isAsyncPlaceholder = false;
+  };
+
+  var prototypeAccessors = { child: { configurable: true } };
+
+  // DEPRECATED: alias for componentInstance for backwards compat.
+  /* istanbul ignore next */
+  prototypeAccessors.child.get = function () {
+    return this.componentInstance
+  };
+
+  Object.defineProperties( VNode.prototype, prototypeAccessors );
+
+  var createEmptyVNode = function (text) {
+    if ( text === void 0 ) text = '';
+
+    var node = new VNode();
+    node.text = text;
+    node.isComment = true;
+    return node
+  };
+
+  function createTextVNode (val) {
+    return new VNode(undefined, undefined, undefined, String(val))
+  }
+
+  // optimized shallow clone
+  // used for static nodes and slot nodes because they may be reused across
+  // multiple renders, cloning them avoids errors when DOM manipulations rely
+  // on their elm reference.
+  function cloneVNode (vnode) {
+    var cloned = new VNode(
+      vnode.tag,
+      vnode.data,
+      // #7975
+      // clone children array to avoid mutating original in case of cloning
+      // a child.
+      vnode.children && vnode.children.slice(),
+      vnode.text,
+      vnode.elm,
+      vnode.context,
+      vnode.componentOptions,
+      vnode.asyncFactory
+    );
+    cloned.ns = vnode.ns;
+    cloned.isStatic = vnode.isStatic;
+    cloned.key = vnode.key;
+    cloned.isComment = vnode.isComment;
+    cloned.fnContext = vnode.fnContext;
+    cloned.fnOptions = vnode.fnOptions;
+    cloned.fnScopeId = vnode.fnScopeId;
+    cloned.asyncMeta = vnode.asyncMeta;
+    cloned.isCloned = true;
+    return cloned
+  }
+
+  /*
+   * not type checking this file because flow doesn't play well with
+   * dynamically accessing methods on Array prototype
+   */
+
+  var arrayProto = Array.prototype;
+  var arrayMethods = Object.create(arrayProto);
+
+  var methodsToPatch = [
+    'push',
+    'pop',
+    'shift',
+    'unshift',
+    'splice',
+    'sort',
+    'reverse'
+  ];
+
+  /**
+   * Intercept mutating methods and emit events
+   */
+  methodsToPatch.forEach(function (method) {
+    // cache original method
+    var original = arrayProto[method];
+    def(arrayMethods, method, function mutator () {
+      var args = [], len = arguments.length;
+      while ( len-- ) args[ len ] = arguments[ len ];
+
+      var result = original.apply(this, args);
+      var ob = this.__ob__;
+      var inserted;
+      switch (method) {
+        case 'push':
+        case 'unshift':
+          inserted = args;
+          break
+        case 'splice':
+          inserted = args.slice(2);
+          break
+      }
+      if (inserted) { ob.observeArray(inserted); }
+      // notify change
+      ob.dep.notify();
+      return result
+    });
+  });
+
+  /*  */
+
+  var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
+
+  /**
+   * In some cases we may want to disable observation inside a component's
+   * update computation.
+   */
+  var shouldObserve = true;
+
+  function toggleObserving (value) {
+    shouldObserve = value;
+  }
+
+  /**
+   * Observer class that is attached to each observed
+   * object. Once attached, the observer converts the target
+   * object's property keys into getter/setters that
+   * collect dependencies and dispatch updates.
+   */
+  var Observer = function Observer (value) {
+    this.value = value;
+    this.dep = new Dep();
+    this.vmCount = 0;
+    def(value, '__ob__', this);
+    if (Array.isArray(value)) {
+      if (hasProto) {
+        protoAugment(value, arrayMethods);
+      } else {
+        copyAugment(value, arrayMethods, arrayKeys);
+      }
+      this.observeArray(value);
+    } else {
+      this.walk(value);
+    }
+  };
+
+  /**
+   * Walk through all properties and convert them into
+   * getter/setters. This method should only be called when
+   * value type is Object.
+   */
+  Observer.prototype.walk = function walk (obj) {
+    var keys = Object.keys(obj);
+    for (var i = 0; i < keys.length; i++) {
+      defineReactive$$1(obj, keys[i]);
+    }
+  };
+
+  /**
+   * Observe a list of Array items.
+   */
+  Observer.prototype.observeArray = function observeArray (items) {
+    for (var i = 0, l = items.length; i < l; i++) {
+      observe(items[i]);
+    }
+  };
+
+  // helpers
+
+  /**
+   * Augment a target Object or Array by intercepting
+   * the prototype chain using __proto__
+   */
+  function protoAugment (target, src) {
+    /* eslint-disable no-proto */
+    target.__proto__ = src;
+    /* eslint-enable no-proto */
+  }
+
+  /**
+   * Augment a target Object or Array by defining
+   * hidden properties.
+   */
+  /* istanbul ignore next */
+  function copyAugment (target, src, keys) {
+    for (var i = 0, l = keys.length; i < l; i++) {
+      var key = keys[i];
+      def(target, key, src[key]);
+    }
+  }
+
+  /**
+   * Attempt to create an observer instance for a value,
+   * returns the new observer if successfully observed,
+   * or the existing observer if the value already has one.
+   */
+  function observe (value, asRootData) {
+    if (!isObject(value) || value instanceof VNode) {
+      return
+    }
+    var ob;
+    if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
+      ob = value.__ob__;
+    } else if (
+      shouldObserve &&
+      !isServerRendering() &&
+      (Array.isArray(value) || isPlainObject(value)) &&
+      Object.isExtensible(value) &&
+      !value._isVue
+    ) {
+      ob = new Observer(value);
+    }
+    if (asRootData && ob) {
+      ob.vmCount++;
+    }
+    return ob
+  }
+
+  /**
+   * Define a reactive property on an Object.
+   */
+  function defineReactive$$1 (
+    obj,
+    key,
+    val,
+    customSetter,
+    shallow
+  ) {
+    var dep = new Dep();
+
+    var property = Object.getOwnPropertyDescriptor(obj, key);
+    if (property && property.configurable === false) {
+      return
+    }
+
+    // cater for pre-defined getter/setters
+    var getter = property && property.get;
+    var setter = property && property.set;
+    if ((!getter || setter) && arguments.length === 2) {
+      val = obj[key];
+    }
+
+    var childOb = !shallow && observe(val);
+    Object.defineProperty(obj, key, {
+      enumerable: true,
+      configurable: true,
+      get: function reactiveGetter () {
+        var value = getter ? getter.call(obj) : val;
+        if (Dep.target) {
+          dep.depend();
+          if (childOb) {
+            childOb.dep.depend();
+            if (Array.isArray(value)) {
+              dependArray(value);
+            }
+          }
+        }
+        return value
+      },
+      set: function reactiveSetter (newVal) {
+        var value = getter ? getter.call(obj) : val;
+        /* eslint-disable no-self-compare */
+        if (newVal === value || (newVal !== newVal && value !== value)) {
+          return
+        }
+        /* eslint-enable no-self-compare */
+        if (customSetter) {
+          customSetter();
+        }
+        // #7981: for accessor properties without setter
+        if (getter && !setter) { return }
+        if (setter) {
+          setter.call(obj, newVal);
+        } else {
+          val = newVal;
+        }
+        childOb = !shallow && observe(newVal);
+        dep.notify();
+      }
+    });
+  }
+
+  /**
+   * Set a property on an object. Adds the new property and
+   * triggers change notification if the property doesn't
+   * already exist.
+   */
+  function set (target, key, val) {
+    if (isUndef(target) || isPrimitive(target)
+    ) {
+      warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
+    }
+    if (Array.isArray(target) && isValidArrayIndex(key)) {
+      target.length = Math.max(target.length, key);
+      target.splice(key, 1, val);
+      return val
+    }
+    if (key in target && !(key in Object.prototype)) {
+      target[key] = val;
+      return val
+    }
+    var ob = (target).__ob__;
+    if (target._isVue || (ob && ob.vmCount)) {
+      warn(
+        'Avoid adding reactive properties to a Vue instance or its root $data ' +
+        'at runtime - declare it upfront in the data option.'
+      );
+      return val
+    }
+    if (!ob) {
+      target[key] = val;
+      return val
+    }
+    defineReactive$$1(ob.value, key, val);
+    ob.dep.notify();
+    return val
+  }
+
+  /**
+   * Delete a property and trigger change if necessary.
+   */
+  function del (target, key) {
+    if (isUndef(target) || isPrimitive(target)
+    ) {
+      warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
+    }
+    if (Array.isArray(target) && isValidArrayIndex(key)) {
+      target.splice(key, 1);
+      return
+    }
+    var ob = (target).__ob__;
+    if (target._isVue || (ob && ob.vmCount)) {
+      warn(
+        'Avoid deleting properties on a Vue instance or its root $data ' +
+        '- just set it to null.'
+      );
+      return
+    }
+    if (!hasOwn(target, key)) {
+      return
+    }
+    delete target[key];
+    if (!ob) {
+      return
+    }
+    ob.dep.notify();
+  }
+
+  /**
+   * Collect dependencies on array elements when the array is touched, since
+   * we cannot intercept array element access like property getters.
+   */
+  function dependArray (value) {
+    for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
+      e = value[i];
+      e && e.__ob__ && e.__ob__.dep.depend();
+      if (Array.isArray(e)) {
+        dependArray(e);
+      }
+    }
+  }
+
+  /*  */
+
+  /**
+   * Option overwriting strategies are functions that handle
+   * how to merge a parent option value and a child option
+   * value into the final value.
+   */
+  var strats = config.optionMergeStrategies;
+
+  /**
+   * Options with restrictions
+   */
+  {
+    strats.el = strats.propsData = function (parent, child, vm, key) {
+      if (!vm) {
+        warn(
+          "option \"" + key + "\" can only be used during instance " +
+          'creation with the `new` keyword.'
+        );
+      }
+      return defaultStrat(parent, child)
+    };
+  }
+
+  /**
+   * Helper that recursively merges two data objects together.
+   */
+  function mergeData (to, from) {
+    if (!from) { return to }
+    var key, toVal, fromVal;
+
+    var keys = hasSymbol
+      ? Reflect.ownKeys(from)
+      : Object.keys(from);
+
+    for (var i = 0; i < keys.length; i++) {
+      key = keys[i];
+      // in case the object is already observed...
+      if (key === '__ob__') { continue }
+      toVal = to[key];
+      fromVal = from[key];
+      if (!hasOwn(to, key)) {
+        set(to, key, fromVal);
+      } else if (
+        toVal !== fromVal &&
+        isPlainObject(toVal) &&
+        isPlainObject(fromVal)
+      ) {
+        mergeData(toVal, fromVal);
+      }
+    }
+    return to
+  }
+
+  /**
+   * Data
+   */
+  function mergeDataOrFn (
+    parentVal,
+    childVal,
+    vm
+  ) {
+    if (!vm) {
+      // in a Vue.extend merge, both should be functions
+      if (!childVal) {
+        return parentVal
+      }
+      if (!parentVal) {
+        return childVal
+      }
+      // when parentVal & childVal are both present,
+      // we need to return a function that returns the
+      // merged result of both functions... no need to
+      // check if parentVal is a function here because
+      // it has to be a function to pass previous merges.
+      return function mergedDataFn () {
+        return mergeData(
+          typeof childVal === 'function' ? childVal.call(this, this) : childVal,
+          typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
+        )
+      }
+    } else {
+      return function mergedInstanceDataFn () {
+        // instance merge
+        var instanceData = typeof childVal === 'function'
+          ? childVal.call(vm, vm)
+          : childVal;
+        var defaultData = typeof parentVal === 'function'
+          ? parentVal.call(vm, vm)
+          : parentVal;
+        if (instanceData) {
+          return mergeData(instanceData, defaultData)
+        } else {
+          return defaultData
+        }
+      }
+    }
+  }
+
+  strats.data = function (
+    parentVal,
+    childVal,
+    vm
+  ) {
+    if (!vm) {
+      if (childVal && typeof childVal !== 'function') {
+        warn(
+          'The "data" option should be a function ' +
+          'that returns a per-instance value in component ' +
+          'definitions.',
+          vm
+        );
+
+        return parentVal
+      }
+      return mergeDataOrFn(parentVal, childVal)
+    }
+
+    return mergeDataOrFn(parentVal, childVal, vm)
+  };
+
+  /**
+   * Hooks and props are merged as arrays.
+   */
+  function mergeHook (
+    parentVal,
+    childVal
+  ) {
+    var res = childVal
+      ? parentVal
+        ? parentVal.concat(childVal)
+        : Array.isArray(childVal)
+          ? childVal
+          : [childVal]
+      : parentVal;
+    return res
+      ? dedupeHooks(res)
+      : res
+  }
+
+  function dedupeHooks (hooks) {
+    var res = [];
+    for (var i = 0; i < hooks.length; i++) {
+      if (res.indexOf(hooks[i]) === -1) {
+        res.push(hooks[i]);
+      }
+    }
+    return res
+  }
+
+  LIFECYCLE_HOOKS.forEach(function (hook) {
+    strats[hook] = mergeHook;
+  });
+
+  /**
+   * Assets
+   *
+   * When a vm is present (instance creation), we need to do
+   * a three-way merge between constructor options, instance
+   * options and parent options.
+   */
+  function mergeAssets (
+    parentVal,
+    childVal,
+    vm,
+    key
+  ) {
+    var res = Object.create(parentVal || null);
+    if (childVal) {
+      assertObjectType(key, childVal, vm);
+      return extend(res, childVal)
+    } else {
+      return res
+    }
+  }
+
+  ASSET_TYPES.forEach(function (type) {
+    strats[type + 's'] = mergeAssets;
+  });
+
+  /**
+   * Watchers.
+   *
+   * Watchers hashes should not overwrite one
+   * another, so we merge them as arrays.
+   */
+  strats.watch = function (
+    parentVal,
+    childVal,
+    vm,
+    key
+  ) {
+    // work around Firefox's Object.prototype.watch...
+    if (parentVal === nativeWatch) { parentVal = undefined; }
+    if (childVal === nativeWatch) { childVal = undefined; }
+    /* istanbul ignore if */
+    if (!childVal) { return Object.create(parentVal || null) }
+    {
+      assertObjectType(key, childVal, vm);
+    }
+    if (!parentVal) { return childVal }
+    var ret = {};
+    extend(ret, parentVal);
+    for (var key$1 in childVal) {
+      var parent = ret[key$1];
+      var child = childVal[key$1];
+      if (parent && !Array.isArray(parent)) {
+        parent = [parent];
+      }
+      ret[key$1] = parent
+        ? parent.concat(child)
+        : Array.isArray(child) ? child : [child];
+    }
+    return ret
+  };
+
+  /**
+   * Other object hashes.
+   */
+  strats.props =
+  strats.methods =
+  strats.inject =
+  strats.computed = function (
+    parentVal,
+    childVal,
+    vm,
+    key
+  ) {
+    if (childVal && "development" !== 'production') {
+      assertObjectType(key, childVal, vm);
+    }
+    if (!parentVal) { return childVal }
+    var ret = Object.create(null);
+    extend(ret, parentVal);
+    if (childVal) { extend(ret, childVal); }
+    return ret
+  };
+  strats.provide = mergeDataOrFn;
+
+  /**
+   * Default strategy.
+   */
+  var defaultStrat = function (parentVal, childVal) {
+    return childVal === undefined
+      ? parentVal
+      : childVal
+  };
+
+  /**
+   * Validate component names
+   */
+  function checkComponents (options) {
+    for (var key in options.components) {
+      validateComponentName(key);
+    }
+  }
+
+  function validateComponentName (name) {
+    if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
+      warn(
+        'Invalid component name: "' + name + '". Component names ' +
+        'should conform to valid custom element name in html5 specification.'
+      );
+    }
+    if (isBuiltInTag(name) || config.isReservedTag(name)) {
+      warn(
+        'Do not use built-in or reserved HTML elements as component ' +
+        'id: ' + name
+      );
+    }
+  }
+
+  /**
+   * Ensure all props option syntax are normalized into the
+   * Object-based format.
+   */
+  function normalizeProps (options, vm) {
+    var props = options.props;
+    if (!props) { return }
+    var res = {};
+    var i, val, name;
+    if (Array.isArray(props)) {
+      i = props.length;
+      while (i--) {
+        val = props[i];
+        if (typeof val === 'string') {
+          name = camelize(val);
+          res[name] = { type: null };
+        } else {
+          warn('props must be strings when using array syntax.');
+        }
+      }
+    } else if (isPlainObject(props)) {
+      for (var key in props) {
+        val = props[key];
+        name = camelize(key);
+        res[name] = isPlainObject(val)
+          ? val
+          : { type: val };
+      }
+    } else {
+      warn(
+        "Invalid value for option \"props\": expected an Array or an Object, " +
+        "but got " + (toRawType(props)) + ".",
+        vm
+      );
+    }
+    options.props = res;
+  }
+
+  /**
+   * Normalize all injections into Object-based format
+   */
+  function normalizeInject (options, vm) {
+    var inject = options.inject;
+    if (!inject) { return }
+    var normalized = options.inject = {};
+    if (Array.isArray(inject)) {
+      for (var i = 0; i < inject.length; i++) {
+        normalized[inject[i]] = { from: inject[i] };
+      }
+    } else if (isPlainObject(inject)) {
+      for (var key in inject) {
+        var val = inject[key];
+        normalized[key] = isPlainObject(val)
+          ? extend({ from: key }, val)
+          : { from: val };
+      }
+    } else {
+      warn(
+        "Invalid value for option \"inject\": expected an Array or an Object, " +
+        "but got " + (toRawType(inject)) + ".",
+        vm
+      );
+    }
+  }
+
+  /**
+   * Normalize raw function directives into object format.
+   */
+  function normalizeDirectives (options) {
+    var dirs = options.directives;
+    if (dirs) {
+      for (var key in dirs) {
+        var def$$1 = dirs[key];
+        if (typeof def$$1 === 'function') {
+          dirs[key] = { bind: def$$1, update: def$$1 };
+        }
+      }
+    }
+  }
+
+  function assertObjectType (name, value, vm) {
+    if (!isPlainObject(value)) {
+      warn(
+        "Invalid value for option \"" + name + "\": expected an Object, " +
+        "but got " + (toRawType(value)) + ".",
+        vm
+      );
+    }
+  }
+
+  /**
+   * Merge two option objects into a new one.
+   * Core utility used in both instantiation and inheritance.
+   */
+  function mergeOptions (
+    parent,
+    child,
+    vm
+  ) {
+    {
+      checkComponents(child);
+    }
+
+    if (typeof child === 'function') {
+      child = child.options;
+    }
+
+    normalizeProps(child, vm);
+    normalizeInject(child, vm);
+    normalizeDirectives(child);
+
+    // Apply extends and mixins on the child options,
+    // but only if it is a raw options object that isn't
+    // the result of another mergeOptions call.
+    // Only merged options has the _base property.
+    if (!child._base) {
+      if (child.extends) {
+        parent = mergeOptions(parent, child.extends, vm);
+      }
+      if (child.mixins) {
+        for (var i = 0, l = child.mixins.length; i < l; i++) {
+          parent = mergeOptions(parent, child.mixins[i], vm);
+        }
+      }
+    }
+
+    var options = {};
+    var key;
+    for (key in parent) {
+      mergeField(key);
+    }
+    for (key in child) {
+      if (!hasOwn(parent, key)) {
+        mergeField(key);
+      }
+    }
+    function mergeField (key) {
+      var strat = strats[key] || defaultStrat;
+      options[key] = strat(parent[key], child[key], vm, key);
+    }
+    return options
+  }
+
+  /**
+   * Resolve an asset.
+   * This function is used because child instances need access
+   * to assets defined in its ancestor chain.
+   */
+  function resolveAsset (
+    options,
+    type,
+    id,
+    warnMissing
+  ) {
+    /* istanbul ignore if */
+    if (typeof id !== 'string') {
+      return
+    }
+    var assets = options[type];
+    // check local registration variations first
+    if (hasOwn(assets, id)) { return assets[id] }
+    var camelizedId = camelize(id);
+    if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
+    var PascalCaseId = capitalize(camelizedId);
+    if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
+    // fallback to prototype chain
+    var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
+    if (warnMissing && !res) {
+      warn(
+        'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
+        options
+      );
+    }
+    return res
+  }
+
+  /*  */
+
+
+
+  function validateProp (
+    key,
+    propOptions,
+    propsData,
+    vm
+  ) {
+    var prop = propOptions[key];
+    var absent = !hasOwn(propsData, key);
+    var value = propsData[key];
+    // boolean casting
+    var booleanIndex = getTypeIndex(Boolean, prop.type);
+    if (booleanIndex > -1) {
+      if (absent && !hasOwn(prop, 'default')) {
+        value = false;
+      } else if (value === '' || value === hyphenate(key)) {
+        // only cast empty string / same name to boolean if
+        // boolean has higher priority
+        var stringIndex = getTypeIndex(String, prop.type);
+        if (stringIndex < 0 || booleanIndex < stringIndex) {
+          value = true;
+        }
+      }
+    }
+    // check default value
+    if (value === undefined) {
+      value = getPropDefaultValue(vm, prop, key);
+      // since the default value is a fresh copy,
+      // make sure to observe it.
+      var prevShouldObserve = shouldObserve;
+      toggleObserving(true);
+      observe(value);
+      toggleObserving(prevShouldObserve);
+    }
+    {
+      assertProp(prop, key, value, vm, absent);
+    }
+    return value
+  }
+
+  /**
+   * Get the default value of a prop.
+   */
+  function getPropDefaultValue (vm, prop, key) {
+    // no default, return undefined
+    if (!hasOwn(prop, 'default')) {
+      return undefined
+    }
+    var def = prop.default;
+    // warn against non-factory defaults for Object & Array
+    if (isObject(def)) {
+      warn(
+        'Invalid default value for prop "' + key + '": ' +
+        'Props with type Object/Array must use a factory function ' +
+        'to return the default value.',
+        vm
+      );
+    }
+    // the raw prop value was also undefined from previous render,
+    // return previous default value to avoid unnecessary watcher trigger
+    if (vm && vm.$options.propsData &&
+      vm.$options.propsData[key] === undefined &&
+      vm._props[key] !== undefined
+    ) {
+      return vm._props[key]
+    }
+    // call factory function for non-Function types
+    // a value is Function if its prototype is function even across different execution context
+    return typeof def === 'function' && getType(prop.type) !== 'Function'
+      ? def.call(vm)
+      : def
+  }
+
+  /**
+   * Assert whether a prop is valid.
+   */
+  function assertProp (
+    prop,
+    name,
+    value,
+    vm,
+    absent
+  ) {
+    if (prop.required && absent) {
+      warn(
+        'Missing required prop: "' + name + '"',
+        vm
+      );
+      return
+    }
+    if (value == null && !prop.required) {
+      return
+    }
+    var type = prop.type;
+    var valid = !type || type === true;
+    var expectedTypes = [];
+    if (type) {
+      if (!Array.isArray(type)) {
+        type = [type];
+      }
+      for (var i = 0; i < type.length && !valid; i++) {
+        var assertedType = assertType(value, type[i]);
+        expectedTypes.push(assertedType.expectedType || '');
+        valid = assertedType.valid;
+      }
+    }
+
+    if (!valid) {
+      warn(
+        getInvalidTypeMessage(name, value, expectedTypes),
+        vm
+      );
+      return
+    }
+    var validator = prop.validator;
+    if (validator) {
+      if (!validator(value)) {
+        warn(
+          'Invalid prop: custom validator check failed for prop "' + name + '".',
+          vm
+        );
+      }
+    }
+  }
+
+  var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
+
+  function assertType (value, type) {
+    var valid;
+    var expectedType = getType(type);
+    if (simpleCheckRE.test(expectedType)) {
+      var t = typeof value;
+      valid = t === expectedType.toLowerCase();
+      // for primitive wrapper objects
+      if (!valid && t === 'object') {
+        valid = value instanceof type;
+      }
+    } else if (expectedType === 'Object') {
+      valid = isPlainObject(value);
+    } else if (expectedType === 'Array') {
+      valid = Array.isArray(value);
+    } else {
+      valid = value instanceof type;
+    }
+    return {
+      valid: valid,
+      expectedType: expectedType
+    }
+  }
+
+  /**
+   * Use function string name to check built-in types,
+   * because a simple equality check will fail when running
+   * across different vms / iframes.
+   */
+  function getType (fn) {
+    var match = fn && fn.toString().match(/^\s*function (\w+)/);
+    return match ? match[1] : ''
+  }
+
+  function isSameType (a, b) {
+    return getType(a) === getType(b)
+  }
+
+  function getTypeIndex (type, expectedTypes) {
+    if (!Array.isArray(expectedTypes)) {
+      return isSameType(expectedTypes, type) ? 0 : -1
+    }
+    for (var i = 0, len = expectedTypes.length; i < len; i++) {
+      if (isSameType(expectedTypes[i], type)) {
+        return i
+      }
+    }
+    return -1
+  }
+
+  function getInvalidTypeMessage (name, value, expectedTypes) {
+    var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
+      " Expected " + (expectedTypes.map(capitalize).join(', '));
+    var expectedType = expectedTypes[0];
+    var receivedType = toRawType(value);
+    var expectedValue = styleValue(value, expectedType);
+    var receivedValue = styleValue(value, receivedType);
+    // check if we need to specify expected value
+    if (expectedTypes.length === 1 &&
+        isExplicable(expectedType) &&
+        !isBoolean(expectedType, receivedType)) {
+      message += " with value " + expectedValue;
+    }
+    message += ", got " + receivedType + " ";
+    // check if we need to specify received value
+    if (isExplicable(receivedType)) {
+      message += "with value " + receivedValue + ".";
+    }
+    return message
+  }
+
+  function styleValue (value, type) {
+    if (type === 'String') {
+      return ("\"" + value + "\"")
+    } else if (type === 'Number') {
+      return ("" + (Number(value)))
+    } else {
+      return ("" + value)
+    }
+  }
+
+  function isExplicable (value) {
+    var explicitTypes = ['string', 'number', 'boolean'];
+    return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
+  }
+
+  function isBoolean () {
+    var args = [], len = arguments.length;
+    while ( len-- ) args[ len ] = arguments[ len ];
+
+    return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
+  }
+
+  /*  */
+
+  function handleError (err, vm, info) {
+    // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
+    // See: https://github.com/vuejs/vuex/issues/1505
+    pushTarget();
+    try {
+      if (vm) {
+        var cur = vm;
+        while ((cur = cur.$parent)) {
+          var hooks = cur.$options.errorCaptured;
+          if (hooks) {
+            for (var i = 0; i < hooks.length; i++) {
+              try {
+                var capture = hooks[i].call(cur, err, vm, info) === false;
+                if (capture) { return }
+              } catch (e) {
+                globalHandleError(e, cur, 'errorCaptured hook');
+              }
+            }
+          }
+        }
+      }
+      globalHandleError(err, vm, info);
+    } finally {
+      popTarget();
+    }
+  }
+
+  function invokeWithErrorHandling (
+    handler,
+    context,
+    args,
+    vm,
+    info
+  ) {
+    var res;
+    try {
+      res = args ? handler.apply(context, args) : handler.call(context);
+      if (res && !res._isVue && isPromise(res) && !res._handled) {
+        res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
+        // issue #9511
+        // avoid catch triggering multiple times when nested calls
+        res._handled = true;
+      }
+    } catch (e) {
+      handleError(e, vm, info);
+    }
+    return res
+  }
+
+  function globalHandleError (err, vm, info) {
+    if (config.errorHandler) {
+      try {
+        return config.errorHandler.call(null, err, vm, info)
+      } catch (e) {
+        // if the user intentionally throws the original error in the handler,
+        // do not log it twice
+        if (e !== err) {
+          logError(e, null, 'config.errorHandler');
+        }
+      }
+    }
+    logError(err, vm, info);
+  }
+
+  function logError (err, vm, info) {
+    {
+      warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
+    }
+    /* istanbul ignore else */
+    if ((inBrowser || inWeex) && typeof console !== 'undefined') {
+      console.error(err);
+    } else {
+      throw err
+    }
+  }
+
+  /*  */
+
+  var isUsingMicroTask = false;
+
+  var callbacks = [];
+  var pending = false;
+
+  function flushCallbacks () {
+    pending = false;
+    var copies = callbacks.slice(0);
+    callbacks.length = 0;
+    for (var i = 0; i < copies.length; i++) {
+      copies[i]();
+    }
+  }
+
+  // Here we have async deferring wrappers using microtasks.
+  // In 2.5 we used (macro) tasks (in combination with microtasks).
+  // However, it has subtle problems when state is changed right before repaint
+  // (e.g. #6813, out-in transitions).
+  // Also, using (macro) tasks in event handler would cause some weird behaviors
+  // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
+  // So we now use microtasks everywhere, again.
+  // A major drawback of this tradeoff is that there are some scenarios
+  // where microtasks have too high a priority and fire in between supposedly
+  // sequential events (e.g. #4521, #6690, which have workarounds)
+  // or even between bubbling of the same event (#6566).
+  var timerFunc;
+
+  // The nextTick behavior leverages the microtask queue, which can be accessed
+  // via either native Promise.then or MutationObserver.
+  // MutationObserver has wider support, however it is seriously bugged in
+  // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
+  // completely stops working after triggering a few times... so, if native
+  // Promise is available, we will use it:
+  /* istanbul ignore next, $flow-disable-line */
+  if (typeof Promise !== 'undefined' && isNative(Promise)) {
+    var p = Promise.resolve();
+    timerFunc = function () {
+      p.then(flushCallbacks);
+      // In problematic UIWebViews, Promise.then doesn't completely break, but
+      // it can get stuck in a weird state where callbacks are pushed into the
+      // microtask queue but the queue isn't being flushed, until the browser
+      // needs to do some other work, e.g. handle a timer. Therefore we can
+      // "force" the microtask queue to be flushed by adding an empty timer.
+      if (isIOS) { setTimeout(noop); }
+    };
+    isUsingMicroTask = true;
+  } else if (!isIE && typeof MutationObserver !== 'undefined' && (
+    isNative(MutationObserver) ||
+    // PhantomJS and iOS 7.x
+    MutationObserver.toString() === '[object MutationObserverConstructor]'
+  )) {
+    // Use MutationObserver where native Promise is not available,
+    // e.g. PhantomJS, iOS7, Android 4.4
+    // (#6466 MutationObserver is unreliable in IE11)
+    var counter = 1;
+    var observer = new MutationObserver(flushCallbacks);
+    var textNode = document.createTextNode(String(counter));
+    observer.observe(textNode, {
+      characterData: true
+    });
+    timerFunc = function () {
+      counter = (counter + 1) % 2;
+      textNode.data = String(counter);
+    };
+    isUsingMicroTask = true;
+  } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
+    // Fallback to setImmediate.
+    // Technically it leverages the (macro) task queue,
+    // but it is still a better choice than setTimeout.
+    timerFunc = function () {
+      setImmediate(flushCallbacks);
+    };
+  } else {
+    // Fallback to setTimeout.
+    timerFunc = function () {
+      setTimeout(flushCallbacks, 0);
+    };
+  }
+
+  function nextTick (cb, ctx) {
+    var _resolve;
+    callbacks.push(function () {
+      if (cb) {
+        try {
+          cb.call(ctx);
+        } catch (e) {
+          handleError(e, ctx, 'nextTick');
+        }
+      } else if (_resolve) {
+        _resolve(ctx);
+      }
+    });
+    if (!pending) {
+      pending = true;
+      timerFunc();
+    }
+    // $flow-disable-line
+    if (!cb && typeof Promise !== 'undefined') {
+      return new Promise(function (resolve) {
+        _resolve = resolve;
+      })
+    }
+  }
+
+  /*  */
+
+  var mark;
+  var measure;
+
+  {
+    var perf = inBrowser && window.performance;
+    /* istanbul ignore if */
+    if (
+      perf &&
+      perf.mark &&
+      perf.measure &&
+      perf.clearMarks &&
+      perf.clearMeasures
+    ) {
+      mark = function (tag) { return perf.mark(tag); };
+      measure = function (name, startTag, endTag) {
+        perf.measure(name, startTag, endTag);
+        perf.clearMarks(startTag);
+        perf.clearMarks(endTag);
+        // perf.clearMeasures(name)
+      };
+    }
+  }
+
+  /* not type checking this file because flow doesn't play well with Proxy */
+
+  var initProxy;
+
+  {
+    var allowedGlobals = makeMap(
+      'Infinity,undefined,NaN,isFinite,isNaN,' +
+      'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
+      'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
+      'require' // for Webpack/Browserify
+    );
+
+    var warnNonPresent = function (target, key) {
+      warn(
+        "Property or method \"" + key + "\" is not defined on the instance but " +
+        'referenced during render. Make sure that this property is reactive, ' +
+        'either in the data option, or for class-based components, by ' +
+        'initializing the property. ' +
+        'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
+        target
+      );
+    };
+
+    var warnReservedPrefix = function (target, key) {
+      warn(
+        "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
+        'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
+        'prevent conflicts with Vue internals. ' +
+        'See: https://vuejs.org/v2/api/#data',
+        target
+      );
+    };
+
+    var hasProxy =
+      typeof Proxy !== 'undefined' && isNative(Proxy);
+
+    if (hasProxy) {
+      var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
+      config.keyCodes = new Proxy(config.keyCodes, {
+        set: function set (target, key, value) {
+          if (isBuiltInModifier(key)) {
+            warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
+            return false
+          } else {
+            target[key] = value;
+            return true
+          }
+        }
+      });
+    }
+
+    var hasHandler = {
+      has: function has (target, key) {
+        var has = key in target;
+        var isAllowed = allowedGlobals(key) ||
+          (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
+        if (!has && !isAllowed) {
+          if (key in target.$data) { warnReservedPrefix(target, key); }
+          else { warnNonPresent(target, key); }
+        }
+        return has || !isAllowed
+      }
+    };
+
+    var getHandler = {
+      get: function get (target, key) {
+        if (typeof key === 'string' && !(key in target)) {
+          if (key in target.$data) { warnReservedPrefix(target, key); }
+          else { warnNonPresent(target, key); }
+        }
+        return target[key]
+      }
+    };
+
+    initProxy = function initProxy (vm) {
+      if (hasProxy) {
+        // determine which proxy handler to use
+        var options = vm.$options;
+        var handlers = options.render && options.render._withStripped
+          ? getHandler
+          : hasHandler;
+        vm._renderProxy = new Proxy(vm, handlers);
+      } else {
+        vm._renderProxy = vm;
+      }
+    };
+  }
+
+  /*  */
+
+  var seenObjects = new _Set();
+
+  /**
+   * Recursively traverse an object to evoke all converted
+   * getters, so that every nested property inside the object
+   * is collected as a "deep" dependency.
+   */
+  function traverse (val) {
+    _traverse(val, seenObjects);
+    seenObjects.clear();
+  }
+
+  function _traverse (val, seen) {
+    var i, keys;
+    var isA = Array.isArray(val);
+    if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
+      return
+    }
+    if (val.__ob__) {
+      var depId = val.__ob__.dep.id;
+      if (seen.has(depId)) {
+        return
+      }
+      seen.add(depId);
+    }
+    if (isA) {
+      i = val.length;
+      while (i--) { _traverse(val[i], seen); }
+    } else {
+      keys = Object.keys(val);
+      i = keys.length;
+      while (i--) { _traverse(val[keys[i]], seen); }
+    }
+  }
+
+  /*  */
+
+  var normalizeEvent = cached(function (name) {
+    var passive = name.charAt(0) === '&';
+    name = passive ? name.slice(1) : name;
+    var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
+    name = once$$1 ? name.slice(1) : name;
+    var capture = name.charAt(0) === '!';
+    name = capture ? name.slice(1) : name;
+    return {
+      name: name,
+      once: once$$1,
+      capture: capture,
+      passive: passive
+    }
+  });
+
+  function createFnInvoker (fns, vm) {
+    function invoker () {
+      var arguments$1 = arguments;
+
+      var fns = invoker.fns;
+      if (Array.isArray(fns)) {
+        var cloned = fns.slice();
+        for (var i = 0; i < cloned.length; i++) {
+          invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
+        }
+      } else {
+        // return handler return value for single handlers
+        return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
+      }
+    }
+    invoker.fns = fns;
+    return invoker
+  }
+
+  function updateListeners (
+    on,
+    oldOn,
+    add,
+    remove$$1,
+    createOnceHandler,
+    vm
+  ) {
+    var name, def$$1, cur, old, event;
+    for (name in on) {
+      def$$1 = cur = on[name];
+      old = oldOn[name];
+      event = normalizeEvent(name);
+      if (isUndef(cur)) {
+        warn(
+          "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
+          vm
+        );
+      } else if (isUndef(old)) {
+        if (isUndef(cur.fns)) {
+          cur = on[name] = createFnInvoker(cur, vm);
+        }
+        if (isTrue(event.once)) {
+          cur = on[name] = createOnceHandler(event.name, cur, event.capture);
+        }
+        add(event.name, cur, event.capture, event.passive, event.params);
+      } else if (cur !== old) {
+        old.fns = cur;
+        on[name] = old;
+      }
+    }
+    for (name in oldOn) {
+      if (isUndef(on[name])) {
+        event = normalizeEvent(name);
+        remove$$1(event.name, oldOn[name], event.capture);
+      }
+    }
+  }
+
+  /*  */
+
+  function mergeVNodeHook (def, hookKey, hook) {
+    if (def instanceof VNode) {
+      def = def.data.hook || (def.data.hook = {});
+    }
+    var invoker;
+    var oldHook = def[hookKey];
+
+    function wrappedHook () {
+      hook.apply(this, arguments);
+      // important: remove merged hook to ensure it's called only once
+      // and prevent memory leak
+      remove(invoker.fns, wrappedHook);
+    }
+
+    if (isUndef(oldHook)) {
+      // no existing hook
+      invoker = createFnInvoker([wrappedHook]);
+    } else {
+      /* istanbul ignore if */
+      if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
+        // already a merged invoker
+        invoker = oldHook;
+        invoker.fns.push(wrappedHook);
+      } else {
+        // existing plain hook
+        invoker = createFnInvoker([oldHook, wrappedHook]);
+      }
+    }
+
+    invoker.merged = true;
+    def[hookKey] = invoker;
+  }
+
+  /*  */
+
+  function extractPropsFromVNodeData (
+    data,
+    Ctor,
+    tag
+  ) {
+    // we are only extracting raw values here.
+    // validation and default values are handled in the child
+    // component itself.
+    var propOptions = Ctor.options.props;
+    if (isUndef(propOptions)) {
+      return
+    }
+    var res = {};
+    var attrs = data.attrs;
+    var props = data.props;
+    if (isDef(attrs) || isDef(props)) {
+      for (var key in propOptions) {
+        var altKey = hyphenate(key);
+        {
+          var keyInLowerCase = key.toLowerCase();
+          if (
+            key !== keyInLowerCase &&
+            attrs && hasOwn(attrs, keyInLowerCase)
+          ) {
+            tip(
+              "Prop \"" + keyInLowerCase + "\" is passed to component " +
+              (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
+              " \"" + key + "\". " +
+              "Note that HTML attributes are case-insensitive and camelCased " +
+              "props need to use their kebab-case equivalents when using in-DOM " +
+              "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
+            );
+          }
+        }
+        checkProp(res, props, key, altKey, true) ||
+        checkProp(res, attrs, key, altKey, false);
+      }
+    }
+    return res
+  }
+
+  function checkProp (
+    res,
+    hash,
+    key,
+    altKey,
+    preserve
+  ) {
+    if (isDef(hash)) {
+      if (hasOwn(hash, key)) {
+        res[key] = hash[key];
+        if (!preserve) {
+          delete hash[key];
+        }
+        return true
+      } else if (hasOwn(hash, altKey)) {
+        res[key] = hash[altKey];
+        if (!preserve) {
+          delete hash[altKey];
+        }
+        return true
+      }
+    }
+    return false
+  }
+
+  /*  */
+
+  // The template compiler attempts to minimize the need for normalization by
+  // statically analyzing the template at compile time.
+  //
+  // For plain HTML markup, normalization can be completely skipped because the
+  // generated render function is guaranteed to return Array. There are
+  // two cases where extra normalization is needed:
+
+  // 1. When the children contains components - because a functional component
+  // may return an Array instead of a single root. In this case, just a simple
+  // normalization is needed - if any child is an Array, we flatten the whole
+  // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
+  // because functional components already normalize their own children.
+  function simpleNormalizeChildren (children) {
+    for (var i = 0; i < children.length; i++) {
+      if (Array.isArray(children[i])) {
+        return Array.prototype.concat.apply([], children)
+      }
+    }
+    return children
+  }
+
+  // 2. When the children contains constructs that always generated nested Arrays,
+  // e.g.